Program locked at joinAll and sched_yield

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 3 10:19:04 PDT 2016


On Friday, 1 July 2016 at 12:02:11 UTC, tcak wrote:
> I have my own Http Server. Every request is handled by a 
> thread, and threads are reused.
>
> I send 35,000 request (7 different terminals are sending 5000 
> requests each) to the server again and again (each of them 
> lives for short).
>
> Anyway, everything works great, there is no problem at all.
>
> I put "readln" in main function. So, when I press enter, all 
> currently idle threads are stopped. (I use thread.join()).
>
> Problem is that, all threads are stopped, by the last thread 
> Thread#1 gets locked at sched_yield(), it uses one of CPU cores 
> at 100%, and program never quits and stays there.
>
> There is only one remaining thread at the end, and below is its 
> stack trace.
>
> sched_yield() in 
> /build/glibc-GKVZIf/glibc-2.23/posix/../sysdeps/unix/syscall-template.S:84
>
> thread_joinAll() in
>
> rt_term() in
>
> rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) 
> function).runAll()() in
>
> rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) 
> function).tryExec(scope void() delegate)() in
>
> _d_run_main() in
>
> main() in
>
> __libc_start_main(int (*)(int, char **, char **) main, int 
> argc, char ** argv, int (*)(int, char **, char **) init, void 
> (*)(void) fini, void (*)(void) rtld_fini, void * stack_end) in 
> /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291
>
> _start() in
>
>
> Is there any known issue about this? or anything that is known 
> to cause this problem?

Hi!

Can you provide a reduced test case that shows the issue? Without 
any code, it's difficult to tell what's going on.


More information about the Digitalmars-d-learn mailing list