Segfault while using @threads

With Julia v1.1.1 (official Arch Linux installation), I get a segmentation fault when running this example code:

Threads.@threads for i = 1:10
    println("i = $i on thread $(Threads.threadid())")
end

The exact message I get varies but some examples are

signal (11): Segmentation fault
in expression starting at no file:0
__longjmp at /usr/bin/…/lib/libc.so.6 (unknown line)
unknown function (ip: 0x7639e244047a91a9)
Allocations: 455106 (Pool: 454952; Big: 154); GC: 0
[1] 31254 segmentation fault (core dumped) julia

and

signal (11): Segmentation fault
in expression starting at no file:0
unknown function (ip: 0x7f8380344f08)
Allocations: 455109 (Pool: 454955; Big: 154); GC: 0
[1] 31623 segmentation fault (core dumped) julia

and

signal (6): Aborted
in expression starting at no file:0
in expres11): Segmentation fault
in expression starting at no file:0
gsignal at /usr/bin/…/lib/libc.so.6 (unknown line)
Allocations: 13838612 (Pool: 13835498; Big: 3114); GC: 38
abort at /usr/bin/…/lib/libc.so.6 (unknown line)
[1] 31021 segmentation fault (core dumped) julia

I’m using Arch Linux 5.2.1 x86_64, CPU is “Intel® Core™ i7-4790K CPU @ 4.00GHz”. Please advise.

Try the just-released v1.3-alpha, that will be the release with the threading improvements.

2 Likes

Thank you, I’ll try that. Is this kind of issue to be expected when using v1.1.x?

Yes, I/O has only recently been made thread safe. See the blog post for more details on what has changed.

1 Like

Got it, thanks.

Did v1.3 fix the problem? Im running into the same thing in v.1.1.1

Yes, it was solved. In next version 1.3 I/O is suppose to be completely thread safe. You can test it by ourself (you can download the prerelease from https://julialang.org/downloads/).