Skip to content

Conversation

@s01st
Copy link
Contributor

@s01st s01st commented Nov 24, 2025

No description provided.

@s01st
Copy link
Contributor Author

s01st commented Nov 25, 2025

@jph00 Thoughts?

@jph00
Copy link
Contributor

jph00 commented Nov 26, 2025

Thanks for this. Can you run nbdev_export please, otherwise CI will fail when I try to merge.

I don't actually know what's happening in this PR. Can you tell me about the problem and solution?

@s01st
Copy link
Contributor Author

s01st commented Nov 28, 2025

@jph00 can do, apologies, that I forgot to do so

@s01st
Copy link
Contributor Author

s01st commented Dec 1, 2025

@jph00 I think this is an issue with nbs/02b_nets.ipynb

Specifically the cell:

test_eq(urljson('https://httpbin.org/get')['headers']['User-Agent'], url_default_headers['User-Agent'])

Re-running this multiple times on both main and on this branch I've found non-deterministic behavior.

@s01st
Copy link
Contributor Author

s01st commented Dec 6, 2025

@jph00 thoughts? Or how else should I address this?

@jph00 jph00 closed this Dec 7, 2025
@jph00 jph00 reopened this Dec 7, 2025
Copy link
Contributor

@jph00 jph00 left a comment

Choose a reason for hiding this comment

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

I'm not sure about these changes, but certainly interested in discussing them. Would love to hear your more detailed thoughts.

@wraps(f)
def _f(*args, **kwargs):
res = (Thread,Process)[process](target=g, args=args, kwargs=kwargs)
if process:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want this, do we? I'd expect process=True to give us a normal Process. Why would we want something different on Mac?

if threadpool: pool = ThreadPoolExecutor
else:
if not method and sys.platform == 'darwin': method='fork'
if not method and sys.platform == 'darwin':
Copy link
Contributor

Choose a reason for hiding this comment

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

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES is a good workaround in practice, in our experience. How about we check for that first?

def run_procs(f, f_done, args):
"Call `f` for each item in `args` in parallel, yielding `f_done`"
processes = L(args).map(Process, args=arg0, target=f)
Proc = get_context('fork').Process if sys.platform == 'darwin' else Process
Copy link
Contributor

Choose a reason for hiding this comment

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

fork feels a bit unexpected to me here too.

@jph00
Copy link
Contributor

jph00 commented Dec 7, 2025

@jph00 thoughts? Or how else should I address this?

I re-ran the tests - sorry about that!

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.

2 participants