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

"Illegal storage access" when creating new Thread inside sharedTable lock #12808

Open
0xE111 opened this issue Dec 4, 2019 · 0 comments
Open

Comments

@0xE111
Copy link

0xE111 commented Dec 4, 2019

When creating new thread inside sharedTable lock, the thread falls with SIGSEGV: Illegal storage access. (Attempt to read from nil?).

Example

import sharedtables
import os

var threads: SharedTable[string, Thread[void]]
threads.init()

when isMainModule:
  threads.withKey("Some key") do (key: string, value: var Thread[void], pairExists: var bool):
    echo "Creating thread"
    value.createThread(tp=proc() {.thread.} = echo "Inside thread")
    pairExists = true
    echo "Created thread"

  sleep 1000

Current Output

Creating thread
Created thread
No stack traceback available
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Expected Output

Creating thread
Created thread
Inside thread

Additional Information

$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2019-11-25
git hash: dfe5d115fbc644413fa8747d68c9cf63848e3dee
active boot switches: -d:release -d:nativeStackTrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants