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

Race condition in threads initialization. #14091

Closed
yuyichao opened this issue Nov 21, 2015 · 2 comments
Closed

Race condition in threads initialization. #14091

yuyichao opened this issue Nov 21, 2015 · 2 comments
Labels
multithreading Base.Threads and related functionality

Comments

@yuyichao
Copy link
Contributor

When working on #14083, I'm getting a intermittent initialization SegFault during bootstrap. It seems to be caused by a race condition between setting up the thread states and using it.

The jl_all_task_states[tid] is set up inside each threads here. It is used in init.c at here and here. (The first use in particular is very early and is really easy to trigger for me during compilation of inference0.ji)

sleeping for 1 second in init.c before the use make the issue disappear and sleeping for 2 second before the setup in addition to that make the issue happen 100% of the time so these appears to be not synchronized.

Report as an issue instead of a PR since I haven't figure out how do we do thread synchronization yet (especially at this early stage).

@vtjnash

@tkelman tkelman added the multithreading Base.Threads and related functionality label Nov 21, 2015
@tkelman
Copy link
Contributor

tkelman commented Nov 22, 2015

We're using libuv for our threads, right? Do we just need a uv_barrier http://docs.libuv.org/en/v1.x/threading.html#barriers before the first usage of any thread state to make sure they're ready?

@carnaval
Copy link
Contributor

a fix is also in #12904 by the way but I don't know when this branch is intended to be merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants