crossbeam icon indicating copy to clipboard operation
crossbeam copied to clipboard

SEGV when running lots threads with stack [u8; 32000] in them

Open przygienda opened this issue 4 years ago • 1 comments

on 0.7 we are having a very strange problem we narrowed down. It looks like crossbeam when starting enough threads in scopes and allocating stack buffers in them (we use 32KB and 50+ threads) sporadically SEGV the executable. the core isn't clear but it looks like the thread stack is blown out. once the buffers go onto heap stuff works. worth thinking over ...

przygienda avatar Jun 03 '20 02:06 przygienda

Could you provide code to reproduce this issue?

taiki-e avatar Sep 01 '20 09:09 taiki-e

Closing due to inactivity.

Perhaps the problem is that you are allocating a value to the stack that is larger than the stack size of the generated thread, which does not appear to be caused by crossbeam itself.

It may be possible to work around this by using ThreadBuilder::stack_size or ScopedThreadBuilder::stack_size, but usually it is inefficient to allocate such large values on the stack, so it may be better to allocate them on the heap.

taiki-e avatar Jan 11 '23 04:01 taiki-e