LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 18065 - TestConcurrentEvents failing on FreeBSD due to "Expected 1 stops due to signal delivery, but got 2"
Summary: TestConcurrentEvents failing on FreeBSD due to "Expected 1 stops due to signa...
Status: RESOLVED MOVED
Alias: None
Product: lldb
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC FreeBSD
: P normal
Assignee: emaste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-26 08:29 PST by emaste
Modified: 2014-11-17 10:41 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
LLDB stdout - demonstrating double signals from pthread_kill() (4.76 KB, text/plain)
2014-01-31 15:38 PST, John Wolfe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description emaste 2013-11-26 08:29:35 PST
These 5 tests fail w/ the FreeBSD WIP (http://llvm-reviews.chandlerc.com/D2267) and a hack to avoid using libstdc++ (pr17910):

test_breakpoint_delay_breakpoint_one_signal_dwarf (TestConcurrentEvents.ConcurrentEventsTestCase)
test_delay_signal_break_dwarf (TestConcurrentEvents.ConcurrentEventsTestCase)
test_signal_break_dwarf (TestConcurrentEvents.ConcurrentEventsTestCase)
test_signal_delay_break_dwarf (TestConcurrentEvents.ConcurrentEventsTestCase)
test_two_breakpoints_one_signal_dwarf (TestConcurrentEvents.ConcurrentEventsTestCase)

example with two stop reason = signal:

runCmd: continue
output: Process 75923 resuming
Process 75923 stopped


runCmd: thread backtrace all
output: * thread #2: tid = 102734, 0x0000000000400df1 a.out`breakpoint_func(input=0x0000000000000000) + 337 at main.cpp:66, stop reason = breakpoint 3.1
  * frame #0: 0x0000000000400df1 a.out`breakpoint_func(input=0x0000000000000000) + 337 at main.cpp:66
    frame #1: 0x0000000800827d34 libthr.so.3`thread_start(curthread=0x0000000801808000) + 260 at thr_create.c:284
                                                                                
  thread #3: tid = 101594, 0x000000080060d2cd ld-elf.so.1`??? + 189             
    frame #0: 0x000000080060d2cd ld-elf.so.1`??? + 189                          
    frame #1: 0x000000080060d45f ld-elf.so.1`??? + 127                          
    frame #2: 0x00000008006070bd ld-elf.so.1                                    
    frame #3: 0x0000000800827d34 libthr.so.3`thread_start(curthread=0x0000000801807c00) + 260 at thr_create.c:284
                                                                                
  thread #4: tid = 101583, 0x0000000000400df8 a.out`breakpoint_func(input=0x0000000000000000) + 344 at main.cpp:66
    frame #0: 0x0000000000400df8 a.out`breakpoint_func(input=0x0000000000000000) + 344 at main.cpp:66
    frame #1: 0x0000000800827d34 libthr.so.3`thread_start(curthread=0x0000000801807800) + 260 at thr_create.c:284
                                                                                
  thread #1: tid = 100849, 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37  
    frame #0: 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37               
                                                                                
                                                                                
runCmd: continue                                                                
output: Process 75923 resuming                                                  
Process 75923 stopped                                                           
                                                                                
                                                                                
runCmd: thread backtrace all                                                    
output: * thread #2: tid = 102734, 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37
  * frame #0: 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37               
                                                                                
  thread #3: tid = 101594, 0x000000080118f23c libc.so.7`__sys_thr_kill + 12 at thr_kill.S:3, stop reason = signal SIGUSR1
    frame #0: 0x000000080118f23c libc.so.7`__sys_thr_kill + 12 at thr_kill.S:3  
    frame #1: 0x000000080082ebd5 libthr.so.3`_pthread_kill(pthread=0x0000000801807c00, sig=30) + 181 at thr_kill.c:59
    frame #2: 0x0000000000400f69 a.out`signal_func(input=0x0000000000000000) + 345 at main.cpp:79
    frame #3: 0x0000000800827d34 libthr.so.3`thread_start(curthread=0x0000000801807c00) + 260 at thr_create.c:284
                                                                                
  thread #4: tid = 101583, 0x0000000800611005 ld-elf.so.1`??? + 5               
    frame #0: 0x0000000800611005 ld-elf.so.1`??? + 5                            
    frame #1: 0x000000080060b519 ld-elf.so.1`??? + 185                          
    frame #2: 0x000000080060c203 ld-elf.so.1`??? + 131                          
    frame #3: 0x000000080060cf27 ld-elf.so.1`??? + 151                          
    frame #4: 0x0000000800832c42 libthr.so.3`_pthread_exit_mask(status=0x0000000000000000, mask=0x0000000000000000) + 290 at thr_exit.c:86
    frame #5: 0x0000000800832d4b libthr.so.3`_pthread_exit(status=<unavailable>) + 11 at thr_exit.c:188
    frame #6: 0x0000000800827d3c libthr.so.3`thread_start(curthread=0x0000000801807800) + 268 at thr_create.c:284
                                                                                
  thread #1: tid = 100849, 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37  
    frame #0: 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37               
                                                                                
                                                                                
runCmd: continue                                                                
output: Process 75923 resuming                                                  
Process 75923 stopped                                                           
                                                                                
                                                                                
runCmd: thread backtrace all                                                    
output: * thread #2: tid = 102734, 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37
  * frame #0: 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37               
                                                                                
  thread #3: tid = 101594, 0x000000080118f23c libc.so.7`__sys_thr_kill + 12 at thr_kill.S:3, stop reason = signal SIGUSR1
    frame #0: 0x000000080118f23c libc.so.7`__sys_thr_kill + 12 at thr_kill.S:3  
    frame #1: 0x000000080082eb78 libthr.so.3`_pthread_kill(pthread=0x0000000801807c00, sig=30) + 88 at thr_kill.c:64
    frame #2: 0x0000000000400f69 a.out`signal_func(input=0x0000000000000000) + 345 at main.cpp:79
    frame #3: 0x0000000800827d34 libthr.so.3`thread_start(curthread=0x0000000801807c00) + 260 at thr_create.c:284
                                                                                
  thread #4: tid = 101583, 0x0000000800611f6c ld-elf.so.1                       
    frame #0: 0x0000000800611f6c ld-elf.so.1                                    
                                                                                
  thread #1: tid = 100849, 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37  
    frame #0: 0x000000080082f4dc libthr.so.3 at _umtx_op_err.S:37               
                                                                                
                                                                                
runCmd: continue                                                                
output: Process 75923 resuming                                                  
Process 75923 stopped
Comment 1 John Wolfe 2014-01-31 15:31:16 PST
I believe the problem is actually in the pthread_kill() routine.

I have attached an lldb session stdout which clearly shows that pthread_kill() is calling  __sys_thr_kill() twice (from different locations) for each pthread_kill call in the a.out.

I have filed a problem report and proposed fix (pr186309) with FreeBSD for this threads bug.

http://www.freebsd.org/cgi/query-pr.cgi?pr=186309
Comment 2 John Wolfe 2014-01-31 15:38:11 PST
Created attachment 11988 [details]
LLDB stdout - demonstrating double signals from pthread_kill()
Comment 3 emaste 2014-02-02 12:38:14 PST
As John identified this is a FreeBSD bug, now tracked in:
http://www.freebsd.org/cgi/query-pr.cgi?pr=186309

It has been fixed in FreeBSD-HEAD as of r261354 by kib@freebsd.org and will be merged to release branches shortly.

http://svnweb.freebsd.org/base?view=revision&revision=261354
Comment 4 emaste 2014-11-17 10:41:20 PST
For the benefit of anyone finding this bug report while testing on a FreeBSD release: this issue affects FreeBSD 10.0, and is fixed in FreeBSD 10.1.