yglukhov / threadpools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SIGSEGV in `threadpools_simple.threadProc` on current devel

Vindaar opened this issue · comments

I updated my nim compiler the other day (and again today) and it seems something broke (at least) the simple threadpool.

On:

Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-01-20
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 470faa97c60aa5d8153f00083913aca4f0dc1fdf
active boot switches: -d:danger

running the tests results in:

thread: 3 total: 11991, hits: 5918, misses: 6073                                                                       
thread: 2 total: 13427, hits: 6765, misses: 6662                                                                       
thread: 8 total: 4162, hits: 321, misses: 3841         
thread: 0 total: 15454, hits: 7711, misses: 7743
thread: 4 total: 10143, hits: 4577, misses: 5566
thread: 1 total: 14307, hits: 7250, misses: 7057
thread: 7 total: 4787, hits: 798, misses: 3989
thread: 6 total: 6161, hits: 1717, misses: 4444   
thread: 11 total: 3832, hits: 57, misses: 3775
thread: 5 total: 8165, hits: 3139, misses: 5026
thread: 10 total: 3708, hits: 91, misses: 3617
thread: 9 total: 3863, hits: 157, misses: 3706
complex pool - simpleCall: 1.830591201782227
Traceback (most recent call last)
/home/basti/src/nim/threadpools/threadpool_simple.nim(68) threadProc
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Traceback (most recent call last)
/home/basti/src/nim/threadpools/threadpool_simple.nim(68) threadProc
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: '/home/basti/src/nim/threadpools/test '

which points here:
https://github.com/yglukhov/threadpools/blob/master/threadpool_simple.nim#L68

It seems to be the action proc which is nil all of a sudden. I don't really understand that unfortunately.

As a side note: apparently the current stdlib doesn't like a seed of 0 for randomize anymore, which happens here for thread 0:
https://github.com/yglukhov/threadpools/blob/master/threadpool_complex.nim#L99.

Any chance to make a reproducible sample?

Like I said this happens just by running the test file of this repo. Or do you mean to strip the test file to only the crashing part?

edit: Yeah, reading my statement again I probably wasn't clear that I was talking about the test.nim from here.

Oh I see, that's fine, thanks.

Corresponding nim issue: nim-lang/Nim#13219

Hi @yglukhov ,

I have hit the same error but triggered by threadpool_complex.nim running the test.nim with nim version


Nim Compiler Version 1.4.0 [Linux: amd64]
Compiled at 2020-10-18
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: bdcd87afca238a0a7b2c70971827cf9172817b12
active boot switches: -d:release


Traceback (most recent call last)
/mnt/mcfiles/rlyu/.nimble/pkgs/threadpools-0.1.0/threadpool_complex.nim(105) threadProc
/mnt/mcfiles/rlyu/.nimble/pkgs/threadpools-0.1.0/threadpool_complex.nim(86) step
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Traceback (most recent call last)
/mnt/mcfiles/rlyu/.nimble/pkgs/threadpools-0.1.0/threadpool_complex.nim(105) threadProc
/mnt/mcfiles/rlyu/.nimble/pkgs/threadpools-0.1.0/threadpool_complex.nim(86) step
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Thanks,
Ruqian