# EXCEPTION\_ACCESS\_VIOLATION with 1 thread

**URL:** https://community.konduit.ai/t/exception-access-violation-with-1-thread/1353
**Category:** DL4J
**Created:** [April 28, 2021, 2:10pm UTC](https://community.konduit.ai/t/exception-access-violation-with-1-thread/1353 "2021-04-28T14:10:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![marekhanus1994](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@marekhanus1994](https://community.konduit.ai/u/marekhanus1994)
#### Post date: [April 28, 2021, 2:10pm UTC](https://community.konduit.ai/t/exception-access-violation-with-1-thread/1353/1 "2021-04-28T14:10:00Z")

</div>

Hello,

is it possible to run calculations only on current thread? I tried setting env variable OMP\_NUM\_THREADS=1 and use 2+ threads to do some computation, but I am getting EXCEPTION\_ACCESS\_VIOLATION error. Each thread has its own network. Is there anything else I need to configure?

---

<div class="post-metadata">

### Author: ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)
#### Post date: [April 28, 2021, 5:11pm UTC](https://community.konduit.ai/t/exception-access-violation-with-1-thread/1353/2 "2021-04-28T17:11:28Z")

</div>

EXCEPTION\_ACCESS\_VIOLATION is usually something you only see when the entire JVM crashes. It typically shouldn’t do that under normal conditions.

What exactly are you doing?

---

<div class="post-metadata">

### Author: ![marekhanus1994](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@marekhanus1994](https://community.konduit.ai/u/marekhanus1994)
#### Post date: [April 29, 2021, 5:42am UTC](https://community.konduit.ai/t/exception-access-violation-with-1-thread/1353/3 "2021-04-29T05:42:01Z")

</div>

Nothing crazy, just trying to fit neural network (it crashes when calling output aswell). Simple code that crashes when OMP\_NUM\_THREADS=1 (it works with any other number) is here: [gist:f7fa5aa0884a2cfeff96e9a1818e4dfa · GitHub](https://gist.github.com/MareHanus/f7fa5aa0884a2cfeff96e9a1818e4dfa).

Complete error + log file is here: [gist:0e50cb42c9844b2919f25eaf3501e79b · GitHub](https://gist.github.com/MareHanus/0e50cb42c9844b2919f25eaf3501e79b)

---

<div class="post-metadata">

### Author: ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)
#### Post date: [April 29, 2021, 6:37am UTC](https://community.konduit.ai/t/exception-access-violation-with-1-thread/1353/4 "2021-04-29T06:37:08Z")

</div>

Huh, that looks like it should work. I don’t see any sharing of Tensors in your example.

@agibsonccc You might want to take a look at this too

---

<div class="post-metadata">

### Author: ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)
#### Post date: [April 29, 2021, 12:06pm UTC](https://community.konduit.ai/t/exception-access-violation-with-1-thread/1353/5 "2021-04-29T12:06:27Z")

</div>

@marekhanus1994  
I’ve successfully reproduced it with beta7 and it doesn’t happen with our latest code version.

I guess the bug, what ever it was, has already been fixed and it should work in the next release (which will happen very soon).

You can try it out with snapshots already, or wait a bit longer for the proper release.
