# Tracking down instant crashes with multithreading

**URL:** <https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686>\
**Category:** General Usage\
**Created:** [June 13, 2022, 3:59pm UTC](https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686 "2022-06-13T15:59:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Barker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jon_barker/32/18997_2.png) [@Jon\_Barker](https://discourse.julialang.org/u/Jon_Barker)\
**Post date:** [June 13, 2022, 3:59pm UTC](https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686/1 "2022-06-13T15:59:24Z")

</div>

Hi All,

I’m working on converting a program from multi-process to multi-threading.  
I’ve been through the code and am very confident that everything works in its own memoryspace (not writing to the same variables at the same time) and i’m using ReentrantLock appropriately.

However, I’m sometimes getting fail-fast crashes where the Julia application just exits with no indication what’s wrong.

No doubt it’s something I’m doing that’s caused this, but I don’t see a path forward using Julia in this manner, as it’s inevitable in future that further bugs will be introduced, and they are almost impossible to track down.

Does anyone know how I can use GDB or a similar package to track down instant process quits?

Thanks  
Jon

---

<div class="post-metadata">

**Author:** ![Jon\_Barker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jon_barker/32/18997_2.png) [@Jon\_Barker](https://discourse.julialang.org/u/Jon_Barker)\
**Post date:** [June 21, 2022, 4:53pm UTC](https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686/2 "2022-06-21T16:53:03Z")

</div>

No-one can assist? Seems that there should be a way of determining the cause of a crash instead of the process just instantly quitting.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [June 21, 2022, 4:54pm UTC](https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686/3 "2022-06-21T16:54:09Z")

</div>

running with `--checkbounds=yes` is always a good idea here. RR can also be helpful.

---

<div class="post-metadata">

**Author:** ![Jon\_Barker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jon_barker/32/18997_2.png) [@Jon\_Barker](https://discourse.julialang.org/u/Jon_Barker)\
**Post date:** [June 21, 2022, 4:57pm UTC](https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686/4 "2022-06-21T16:57:41Z")

</div>

> [@Oscar\_Smith](#):
>
> -checkbounds=yes

Thanks for the pointer - however I would expect to get failures in single threaded mode if boundary issues were the case? Single threaded mode works fine - it’s just my worker processes suddenly quit with no explanation:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/e/0e3aeab0c3bd4f4fd55c4ce6b71228880061b35b.png)

> [@Oscar\_Smith](#):
>
> RR

Unfortunately we are on windows. I guess I could spin up a linux VM and play there?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [June 21, 2022, 5:03pm UTC](https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686/5 "2022-06-21T17:03:32Z")

</div>

Any chance you are calling into non-julia code that isn’t threadsafe? Other than that, it’s hard to say what’s going wrong.

---

<div class="post-metadata">

**Author:** ![Jon\_Barker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jon_barker/32/18997_2.png) [@Jon\_Barker](https://discourse.julialang.org/u/Jon_Barker)\
**Post date:** [June 21, 2022, 5:17pm UTC](https://discourse.julialang.org/t/tracking-down-instant-crashes-with-multithreading/82686/6 "2022-06-21T17:17:48Z")

</div>

Maybe… the question is how do I determine what’s gone wrong?

At a very high level, the process knows that it has attempted to do X, and X is not possible, so it has quit.

The question is, how do I find out what X was?
