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

Libuv and tasks are not thread safe #14494

Closed
ranjanan opened this issue Dec 28, 2015 · 11 comments
Closed

Libuv and tasks are not thread safe #14494

ranjanan opened this issue Dec 28, 2015 · 11 comments
Labels
io Involving the I/O subsystem: libuv, read, write, etc. multithreading Base.Threads and related functionality

Comments

@ranjanan
Copy link
Contributor

Doing
@threads for i = 1:10 sleep(2) end
regularly segfaults.

This is the backtrace. I understand that sleep() doesn't apply to threads and applies to tasks, but I just thought I'd post this here:

#0  0x00007ffff6e248c9 in jl_apply (nargs=0, args=0x0, f=0x0) at /home/ranjan/julia-threading5/src/julia.h:1375
#1  start_task () at /home/ranjan/julia-threading5/src/task.c:246
#2  0x0000000000000000 in ?? ()
@ViralBShah ViralBShah added the multithreading Base.Threads and related functionality label Dec 28, 2015
@yuyichao
Copy link
Contributor

Right. Task switches and IO's are the only two segfaults left with threading that I've reproduced.

@vtjnash
Copy link
Member

vtjnash commented Dec 28, 2015

You can use Libc.systemsleep(2) for a blocking pause. sleep also tries to access/modify libuv state, which is not threadsafe.

@yuyichao yuyichao changed the title Segfault when putting sleep() inside @threads block Libuv and tasks are not thread safe Aug 30, 2016
@jeff-regier
Copy link

Is this a Julia 0.6 issue? Or Julia 1.0?

@yuyichao
Copy link
Contributor

It will not block 0.6

@Keno
Copy link
Member

Keno commented Nov 15, 2016

There's two issues here. This first is a fully thread-safe multi-threaded I/O system which is a big issue. The second is just the original report that sleep doesn't work right, which is related, but could probably be fixed differently (e.g. if on a thread sleep does systemsleep). Which one were you asking about?

@jeff-regier
Copy link

jeff-regier commented Nov 15, 2016

Thanks for the responses. I was wondering about the former--thread-safe IO in general. Seems like this issue has become a catch-all for libuv+threading issues, with others closed as duplicates.

@xiuliren
Copy link

just tested in Julia 1.0.2, still have the segfault error.

@ViralBShah
Copy link
Member

ViralBShah commented Dec 13, 2018

This is not expected to work until PARTR multi-threading is officially announced as available.

@StefanKarpinski
Copy link
Member

Specifically, this issue will be closed when #29706 is merged.

@StefanKarpinski
Copy link
Member

@JeffBezanson: close this now?

@JeffBezanson
Copy link
Member

Fixed by #32174 and #32309.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Involving the I/O subsystem: libuv, read, write, etc. multithreading Base.Threads and related functionality
Projects
None yet
Development

No branches or pull requests

9 participants