halayli/lthread

Core dump is thrown in lthread_compute_end()

Closed this issue · 7 comments

When I tried to run example program (webserver.c), it crashes with core dump.
With gdb program halts at following:

Program received signal SIGSEGV, Segmentation fault.
0x001352ea in lthread_compute_end () at lthread_compute.c:126
126     asm("movl %0, 0(%%ebp)\n" ::"a"(lt->ebp));

Library and program compiled on Linux 3.0.0-16-generic #29-Ubuntu SMP i686 i686 i386 GNU/Linux

I noticed this is happening on FreeBSD 9 as well when -02 is passed to gcc. Can you drop -O2 from src/Makefile.am, and ./autogen.sh ./configure, sudo make install ?

Ok this seems to be a different issue related to Linux 3.x. I am looking into it.

Sorry, bit confused. Is it or is not issue related to 3.x? I tried removing the '-O2' flag as you suggested, but it didnt work...
I will retry with your commited changes, and let you know.

My initial suspicion was right, the -O2 was causing the issue and it had nothing to do with linux 3.x specifically. I dropped the -O2 from the complication for now until I figure out a better fix. You can pull and compile/test it again.

Yup. It works. thanks.

when using -DNDEBUG, it cause core dump because of
lthread.c:441 lt->sched->ready is null.

when using -DNDEBUG
the line in lthread.c like
assert(pthread_key_create(&lthread_sched_key,
_lthread_key_destructor) == 0);

will be ignored. some the code is error and cause core dump.