Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RPC] Make RPC fork safe on macOS? #2903

Closed
eqy opened this issue Mar 26, 2019 · 3 comments
Closed

[RPC] Make RPC fork safe on macOS? #2903

eqy opened this issue Mar 26, 2019 · 3 comments

Comments

@eqy
Copy link
Contributor

eqy commented Mar 26, 2019

(Observed On macOS 10.14.3)
RPC seems to work fine when it is just a single process (e.g., in simple test cases such as android_rpc_test.py).

We currently use RPC for AutoTVM tuning, and we fork a different process for each measurement for parallelism/robustness. However, this seems to break with something like

objc[17591]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead.

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES seems to be a workaround; found randomly here, but while it works (partially) for a simple Pool -> map wrapping of RPC, tuning still crashes with a segmentation fault in get_addr_info.

@eqy
Copy link
Contributor Author

eqy commented Mar 26, 2019

CC @antinucleon @tqchen

@ajtulloch
Copy link
Contributor

Yeah, we (@hlu1 @antinucleon) noticed some bizarre issues in the new OS X version after the Facetime bug update (including a segfault deep inside the OS X networking stack). I wonder if CPython needs this block to be fixed: https://github.com/python/cpython/blob/8b9dbc017a190d13f717e714630d620adb7c7ac2/Modules/socketmodule.c#L220-L227.

Alternatively, passing numerical addresses directly avoids going into getaddrinfo(..), e.g. https://github.com/python/cpython/blob/8b9dbc017a190d13f717e714630d620adb7c7ac2/Modules/socketmodule.c#L1097-L1125.

@tqchen tqchen changed the title get_addr_info not fork safe on macOS? [RPC] Make RPC fork safe on macOS? Mar 27, 2019
@ajtulloch
Copy link
Contributor

@eqy do you have a simple local-only reproduction that works? IIRC setting LocalExecutor(..., do_fork=False) was an alternative workaround in this case, but it would good to have a local-only repro so we can a) send a bug to Apple, b) see if these proposed fixes actually fix the problem that you're observing.

@tqchen tqchen closed this as completed Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants