Hello! >> Failing to rethrow a __forced_unwind exception is very bad. >> >> This patch ensures we rethrow them in async tasks, and makes the >> shared state ready with a broken_promise so that waiting threads >> don't block forever. That seems reasonable to me, does anyone have any >> better ideas? >> >> Tested x86_64-linux, will wait for feedback before committing. >> >> Committed to trunk.
* testsuite/30_threads/async/forced_unwind.cc: New. * testsuite/30_threads/packaged_task/forced_unwind.cc: New. These two tests timeout on alpha-linux-gnu: FAIL: 30_threads/async/forced_unwind.cc execution test WARNING: program timed out. FAIL: 30_threads/packaged_task/forced_unwind.cc execution test WARNING: program timed out. strace -f of 30_threads/async/forced_unwind.cc execution test: ... open("/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&\220\1\0\0\0\320r\0\0\0\0\0\0"..., 832) = 832 fstat64(3, {st_mode=S_IFREG|0755, st_size=141449, ...}) = 0 mmap(NULL, 189528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2000027c000 mprotect(0x20000296000, 57344, PROT_NONE) = 0 mmap(0x200002a4000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x200002a4000 mmap(0x200002a8000, 9304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x200002a8000 close(3) = 0 open("/lib/libc.so.6.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&\220\1\0\0\0`_\2\0\0\0\0\0"..., 832) = 832 fstat64(3, {st_mode=S_IFREG|0755, st_size=1646104, ...}) = 0 mmap(NULL, 1719888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x200002ac000 mprotect(0x20000438000, 57344, PROT_NONE) = 0 mmap(0x20000446000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x20000446000 mmap(0x2000044e000, 7760, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2000044e000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20000450000 mprotect(0x20000446000, 16384, PROT_READ) = 0 mprotect(0x200002a4000, 8192, PROT_READ) = 0 mprotect(0x20000278000, 8192, PROT_READ) = 0 mprotect(0x20000254000, 8192, PROT_READ) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20000452000 mprotect(0x2000017a000, 24576, PROT_READ) = 0 mprotect(0x120016000, 8192, PROT_READ) = 0 mprotect(0x20000032000, 8192, PROT_READ) = 0 munmap(0x20000024000, 41134) = 0 set_tid_address(0x20000450e50) = 18325 set_robust_list(0x20000450e60, 24) = 0 futex(0x11f813260, FUTEX_WAKE_PRIVATE, 1) = 0 futex(0x11f813260, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 200002b0248) = -1 EAGAIN (Resource temporarily unavailable) rt_sigaction(SIGRT_0, {0x20000282db0, [], SA_SIGINFO}, NULL, 8, 0) = 0 rt_sigaction(SIGRT_1, {0x20000282c70, [], SA_RESTART|SA_SIGINFO}, NULL, 8, 0) = 0 rt_sigprocmask(SIG_UNBLOCK, [RT_0 RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=9223372036854775807}) = 0 brk(0) = 0x12001a000 brk(0x12003c000) = 0x12003c000 mmap(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x20000454000 mprotect(0x20000454000, 8192, PROT_NONE) = 0 clone(Process 18326 attached child_stack=0x20000c52ae0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x20000c532c0, tls=0x20000c538e0, child_tidptr=0x20000c532c0) = 18326 [pid 18326] set_robust_list(0x20000c532d0, 24 <unfinished ...> [pid 18325] futex(0x20000c532c0, FUTEX_WAIT, 18326, NULL <unfinished ...> [pid 18326] <... set_robust_list resumed> ) = 0 [pid 18326] mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x20000c54000 [pid 18326] munmap(0x20000c54000, 54181888) = 0 [pid 18326] munmap(0x20008000000, 12926976) = 0 [pid 18326] mprotect(0x20004000000, 139264, PROT_READ|PROT_WRITE) = 0 [pid 18326] futex(0x2000027a1f4, FUTEX_WAKE_PRIVATE, 2147483647) = 0 [pid 18326] futex(0x12001a08c, FUTEX_WAKE_PRIVATE, 2147483647) = 0 [pid 18326] madvise(0x20000454000, 8355840, MADV_DONTNEED) = 0 [pid 18326] exit(0) = ? [pid 18326] +++ exited with 0 +++ <... futex resumed> ) = 0 futex(0x12001a098, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x12001a05c, FUTEX_WAIT_PRIVATE, 1, NULL ... the test hangs here ... Uros.