Skip to content

set mp start method to spawn - #38

Merged
arcisad merged 3 commits into
mainfrom
multiprocess-warning
Sep 2, 2026
Merged

arcisad merged 3 commits into
mainfrom
multiprocess-warning

Conversation

@arcisad

@arcisad arcisad commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Python 3.12+ warns about deadlocks when the parent process running multiple threads calls an os.fork(). A fix is setting the start method to spawn so it creates a clean copy on python interpreter at the cost of slower start. However, as we create out workers once then the impact should not be significant.

@arcisad
arcisad force-pushed the multiprocess-warning branch from b8ea6ed to 808eff1 Compare August 30, 2026 23:05

@abradley60 abradley60 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks Amir! Just a couple q's/comments

Comment thread pyproject.toml

[tool.pytest.ini_options]
testpaths = ["tests/*"]
filterwarnings = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the warning filter need to be added with the fix?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for some reason urlib3 which I don't know where it is being used :D will complain about another package it is importing that is enabling the global lock (GIL) for Python versions that disable it (i.e. python 3.13t or 3.14t) so I suppressed the warning in the pytest configs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless we don't want to care about the warning.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO I'm not too fussed about the warning, but if you and Caitlin want to suppress cool w me!

import boto3
import numpy as np
import rasterio
import rasterio.profiles

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can see a few imports have changed. Just confirming these are all not required

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I removed the unused imports

@caitlinadams caitlinadams left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!

@arcisad
arcisad merged commit 61b2b97 into main Sep 2, 2026
3 checks passed
@arcisad
arcisad deleted the multiprocess-warning branch September 2, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants