You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
macOS : test_setproctitle_crashes_after_fork_with_corefoundation_loaded fails in about half of the runs #622
On my Mac, test_setproctitle_crashes_after_fork_with_corefoundation_loaded fails in about half of the test suite runs with "setproctitle did NOT crash (exit code 0)", also on main without any changes. CI runs on Ubuntu only, so it never sees this test. I noticed this while trying to come up with PRs for mutmut (#621) and this non-determinism makes it quite annoying.
According to my understanding, the test is the canary for the workaround from #446 and #450. I haven't found any already reported issues regarding the non-determinism, though.
The crash that the test asserts is not deterministic: when a forked child calls setproctitle after the parent did, the child segfaults in about half of the runs and exits cleanly in the rest. I don't know why it's random: the parent is already multithreaded before every fork (pthread_is_threaded_np()), and sleeping before the fork doesn't change the rate.
Forking several children and asserting that at least one of them crashes doesn't work either: my first try hung, with a child blocked in _LSSetApplicationInformationItem, waiting for a reply from LaunchServices.
So maybe instead of trying to fix the test, it's worth removing it altogether and only keeping test_safe_setproctitle_does_not_crash_after_fork, which tests the workaround itself.
Shall I submit a PR or do you want to keep/fix the test?
Alright, I've prepared a PR removing the flaky canary, because after further research I'm confident that it cannot be made deterministic, and trying to get it to 99% or so by using multiple trials just isn't worth it - it should rather be a documented platform limitation with a positive test and left at that in my opinion.
Activity
zyv commentedon Dec 1, 2026
Alright, I've prepared a PR removing the flaky canary, because after further research I'm confident that it cannot be made deterministic, and trying to get it to 99% or so by using multiple trials just isn't worth it - it should rather be a documented platform limitation with a positive test and left at that in my opinion.