From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20544 invoked by alias); 26 Aug 2014 20:37:13 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 20515 invoked by uid 48); 26 Aug 2014 20:37:12 -0000 From: "dje at google dot com" To: gdb-prs@sourceware.org Subject: [Bug python/17314] New: Any thread created by Python must block SIGCHLD Date: Tue, 26 Aug 2014 20:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dje at google dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q3/txt/msg00352.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17314 Bug ID: 17314 Summary: Any thread created by Python must block SIGCHLD Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: dje at google dot com This is related to PR 17247, but in this case I think a simple doc improvement is what's needed, modulo going with something more robust (if possible): An alternate solution would be to have linux-nat.c:sigchld_handler detect, if possible (can one obtain the thread id in an async-safe way? seems like gettid should be async-safe) that the wrong thread has received the signal and cope. Basically, gdb is the only thread that can receive SIGCHLDs. Otherwise gdb will hang in the sigsuspend calls in linux-nat.c. For future debugging sake, IWBN to print the thread id in linux-nat.c:sigchld_handler. Repro: ---foo.py--- import thread import time def forever(): while True: time.sleep(1) def start_background_thread(): thread.start_new_thread(forever, ()) --- bash$ make run (gdb) source foo.py (gdb) py start_background_thread() (gdb) file testsuite/gdb.threads/print-threads (gdb) r ... [New Thread 0x2aaaab7a3700 (LWP 14472)] Print 1, thread 0 [New Thread 0x2aaaab9a4700 (LWP 14473)] Print 1, thread 1 C-c C-c ... gdb appears to be hung ... bash2$ gdb gdb (top-gdb) attach 14050 Attaching to program: ... ... 0x00002add9e70d5e4 in do_sigsuspend (set=0xbdf380 ) at ../sysdeps/unix/sysv/linux/sigsuspend.c:63 63 return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8); (top-gdb) bt #0 0x00002add9e70d5e4 in do_sigsuspend (set=0xbdf380 ) at ../sysdeps/unix/sysv/linux/sigsuspend.c:63 #1 __GI___sigsuspend ( During symbol reading, Child DIE 0x116692 and its abstract origin 0x1202c0 have different tags. During symbol reading, Child DIE 0x116692 and its abstract origin 0x1202c0 have different parents. During symbol reading, Multiple children of DIE 0x118ae5 refer to DIE 0x1156e3 as their abstract origin. During symbol reading, DW_AT_GNU_call_site_target target DIE has invalid low pc, for referencing DIE 0x118e57 [in module /g3/gnu/sourceware/main-gdb-git/b-maste\ r/obj64/gdb/gdb]. set=, set@entry=0xbdf380 ) at ../sysdeps/unix/sysv/linux/sigsuspend.c:78 #2 0x00000000004b95ea in wait_lwp (lp=lp@entry=0x227aec0) at ../../binutils-gdb/gdb/linux-nat.c:2314 #3 0x00000000004bb315 in stop_wait_callback (lp=0x227aec0, data=) at ../../binutils-gdb/gdb/linux-nat.c:2591 #4 0x00000000004ba1c8 in iterate_over_lwps (filter=..., callback=callback@entry=0x4bb2c0 , data=data@entry=0x0) at ../../binutils-gdb/gdb/linux-nat.c:1041 #5 0x00000000004bcc21 in linux_nat_wait_1 (ops=, target_options=1, ourstatus=0x7fffaeeadeb0, ptid=...) at ../../binutils-gdb/gdb/linux-nat.c:3530 #6 linux_nat_wait (ops=, ptid=..., ourstatus=0x7fffaeeadeb0, target_options=1) at ../../binutils-gdb/gdb/linux-nat.c:3680 #7 0x00000000004c3364 in thread_db_wait ( During symbol reading, Only single DW_OP_reg or DW_OP_fbreg is supported for DW_FORM_block* DW_AT_location is supported for DW_TAG_GNU_call_site child DIE 0x74b\ 462 [in module /g3/gnu/sourceware/main-gdb-git/b-master/obj64/gdb/gdb]. ops=, ptid=..., ourstatus=0x7fffaeeadeb0, options=1) at ../../binutils-gdb/gdb/linux-thread-db.c:1489 #8 0x00000000005e9cae in delegate_wait (self=, arg1=..., arg2=, arg3=) at ../../binutils-gdb/gdb/target-delegates.c:116 #9 0x00000000005f7425 in target_wait (ptid=..., status=, options=) at ../../binutils-gdb/gdb/target.c:2057 #10 0x00000000005b9f4d in fetch_inferior_event ( client_data=client_data@entry=0x0) at ../../binutils-gdb/gdb/infrun.c:2881 #11 0x00000000005d0453 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at ../../binutils-gdb/gdb/inf-loop.c:58 #12 0x00000000005ce733 in process_event () at ../../binutils-gdb/gdb/event-loop.c:340 #13 0x00000000005cea4a in gdb_do_one_event () at ../../binutils-gdb/gdb/event-loop.c:392 #14 0x00000000005ceca7 in start_event_loop () at ../../binutils-gdb/gdb/event-loop.c:429 #15 0x00000000005c8283 in captured_command_loop (data=data@entry=0x0) at ../../binutils-gdb/gdb/main.c:322 #16 0x00000000005c598a in catch_errors ( func=func@entry=0x5c8270 , func_args=func_args@entry=0x0, errstring=errstring@entry=0x8cb5de "", mask=mask@entry=RETURN_MASK_ALL) at ../../binutils-gdb/gdb/exceptions.c:514 #17 0x00000000005c91a6 in captured_main (data=data@entry=0x7fffaeeae1c0) at ../../binutils-gdb/gdb/main.c:1178 #18 0x00000000005c598a in catch_errors ( func=func@entry=0x5c8770 , func_args=func_args@entry=0x7fffaeeae1c0, errstring=errstring@entry=0x8cb5de "", mask=mask@entry=RETURN_MASK_ALL) at ../../binutils-gdb/gdb/exceptions.c:514 #19 0x00000000005c968b in gdb_main (args=args@entry=0x7fffaeeae1c0) at ../../binutils-gdb/gdb/main.c:1186 #20 0x00000000004740a5 in main (argc=, argv=) at ../../binutils-gdb/gdb/gdb.c:32 (top-gdb) ... same as 17247. -- You are receiving this mail because: You are on the CC list for the bug.