https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89254

--- Comment #3 from Rainer Orth <ro at gcc dot gnu.org> ---
(In reply to Iain Buclaw from comment #1)
> I don't think you should be seeing a thread deadlock in std.net.curl after
> r268746.

Indeed, thanks.

> I've not been able to reproduce the never timing out part.  The process has
> always been killed after 600 seconds.

I've finally found what was wrong: DejaGnu 1.6.1 is toxic, sometimes failing to
handle the timeouts.  That why I saw that failure on different platforms
(Linux, Solaris, ...) with different versions of expect.  That part is gone
with DejaGnu 1.6.2.

I've now looked a bit closer at this hang (32-bit Linux/x86_64 only):

WARNING: libphobos.phobos_shared/std/parallelism.d execution test program timed
out.
FAIL: libphobos.phobos_shared/std/parallelism.d execution test

For one, the test raises an exception:

core.thread.ThreadError@/vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/thread.d(3065):
Error creating thread

Since I didn't manage to print errno from gdb directly, I've just printed it:

errno = Cannot allocate memory

although pthread_create(3) doesn't document that error code.

Stacktrace at that point is

#0  core.thread.Thread.start() (this=<optimized out>)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/thread.d:733
#1  0x08063da8 in std.parallelism.TaskPool.this(uint) (this=0xf751c6c0, 
    nWorkers=159)
    at
/vol/gcc/src/hg/trunk/local/libphobos/testsuite/../src/std/parallelism.d:1461
#2  0x08063bf1 in std.parallelism.TaskPool.this() (this=0xf751c6c0)
    at
/vol/gcc/src/hg/trunk/local/libphobos/testsuite/../src/std/parallelism.d:1432
#3  0x080672e4 in std.parallelism.__unittestL3941_11() ()
    at
/vol/gcc/src/hg/trunk/local/libphobos/testsuite/../src/std/parallelism.d:4148
#4  0x080691e2 in std.parallelism.__modtest() () at <no_file>:1
#5  0xf789659c in __foreachbody2 (this=0xffffd208, 
    m=0x80d0240 <ModuleInfo for std.gdc.modtest__parallelism>)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/runtime.d:561
#6  0xf78c5631 in rt.minfo.__foreachbody2 (this=0xffffd194, sg=...)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/minfo.d:777
#7  0xf78ab899 in gcc.sections.elf_shared.DSO.opApply(scope int(ref
gcc.sections.elf_shared.DSO) delegate) (dg=...)
    at
/vol/gcc/src/hg/trunk/local/libphobos/libdruntime/gcc/sections/elf_shared.d:109
#8  0xf78c771f in rt.minfo.moduleinfos_apply(scope
int(immutable(object.ModuleIn
fo*)) delegate) (dg=...)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/minfo.d:770
#9  0xf78b8f8f in object.ModuleInfo.opApply(scope int(object.ModuleInfo*)
delegate) (dg=...) at
/vol/gcc/src/hg/trunk/local/libphobos/libdruntime/object.d:1598
#10 0xf7896990 in runModuleUnitTests ()
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/runtime.d:551
#11 0xf78c1cdd in runAll (this=0xffffd4fc)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/dmain2.d:496
#12 0xf78c1861 in tryExec (this=this@entry=0xffffd4fc, dg=...)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/dmain2.d:472
#13 0xf78c1a6c in _d_run_main (argc=1, argv=0xffffd5f4, 
    mainFunc=0x8069238 <D main>)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/dmain2.d:505
#14 0x0806922d in main (argc=1, argv=0xffffd5f4)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/__entrypoint.di:44
#15 0xf7641c09 in __libc_start_main () from /lib/libc.so.6
#16 0x080627f6 in _start ()

This is on an 8-socket system with 10-core Xeon E7-8870.  With hyperthreading,
this makes for 160 threads.

I've found no way to limit the degree of parallelism from the environment, 
std.parallelism.totalCPUs is always set to the number of cores.

If I let the test continue from here, it hangs here

#0  0xf7fd2b59 in __kernel_vsyscall ()
#1  0xf76f7080 in sched_yield () from /lib/libc.so.6
#2  0xf789e029 in core.thread.Thread.yield() ()
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/thread.d:1326
#3  thread_joinAll ()
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/core/thread.d:2361
#4  0xf78c1c0c in rt_term ()
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/dmain2.d:218
#5  0xf78c1cb9 in runAll (this=0xffffd4fc)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/dmain2.d:501
#6  0xf78c1861 in tryExec (this=this@entry=0xffffd4fc, dg=...)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/dmain2.d:472
#7  0xf78c1a6c in _d_run_main (argc=1, argv=0xffffd5f4, 
    mainFunc=0x8069238 <D main>)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/dmain2.d:505
#8  0x0806922d in main (argc=1, argv=0xffffd5f4)
    at /vol/gcc/src/hg/trunk/local/libphobos/libdruntime/__entrypoint.di:44
#9  0xf7641c09 in __libc_start_main () from /lib/libc.so.6
#10 0x080627f6 in _start ()

until it runs into the DejaGnu timeout.

Reply via email to