# Segfault while using @threads

**URL:** <https://discourse.julialang.org/t/segfault-while-using-threads/26705>\
**Category:** General Usage\
**Created:** [July 23, 2019, 10:03pm UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705 "2019-07-23T22:03:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mindbound](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mindbound/32/587_2.png) [@mindbound](https://discourse.julialang.org/u/mindbound)\
**Post date:** [July 23, 2019, 10:03pm UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705/1 "2019-07-23T22:03:14Z")

</div>

With Julia v1.1.1 ([official Arch Linux installation](https://www.archlinux.org/packages/community/x86_64/julia/)), I get a segmentation fault when running this example code:

```julia
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(R) Core™ i7-4790K CPU @ 4.00GHz”. Please advise.

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [July 23, 2019, 10:06pm UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705/2 "2019-07-23T22:06:59Z")

</div>

Try the just-released [v1.3-alpha](https://julialang.org/downloads/), that will be the release with the threading improvements.

---

<div class="post-metadata">

**Author:** ![mindbound](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mindbound/32/587_2.png) [@mindbound](https://discourse.julialang.org/u/mindbound)\
**Post date:** [July 23, 2019, 10:08pm UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705/3 "2019-07-23T22:08:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [July 23, 2019, 10:10pm UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705/4 "2019-07-23T22:10:20Z")

</div>

Yes, I/O has only recently been made thread safe. See [the blog post](https://julialang.org/blog/2019/07/multithreading) for more details on what has changed.

---

<div class="post-metadata">

**Author:** ![mindbound](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mindbound/32/587_2.png) [@mindbound](https://discourse.julialang.org/u/mindbound)\
**Post date:** [July 23, 2019, 10:10pm UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705/5 "2019-07-23T22:10:47Z")

</div>

Got it, thanks.

---

<div class="post-metadata">

**Author:** ![ASF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asf/32/10610_2.png) [@ASF](https://discourse.julialang.org/u/ASF)\
**Post date:** [October 7, 2019, 12:35am UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705/6 "2019-10-07T00:35:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dmolina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmolina/32/5246_2.png) [@dmolina](https://discourse.julialang.org/u/dmolina)\
**Post date:** [October 7, 2019, 9:13am UTC](https://discourse.julialang.org/t/segfault-while-using-threads/26705/7 "2019-10-07T09:13:18Z")

</div>

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 [Download Julia](https://julialang.org/downloads/)).
