Skip to content

runtime: Figure out how to re-enable TestCgoExternalThreadSignal on dragonfly #11847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ianlancetaylor opened this issue Jul 23, 2015 · 11 comments

Comments

@ianlancetaylor
Copy link
Contributor

On the Dragonfly builds, TestCgoExternalThreadSignal is failing:

--- FAIL: TestCgoExternalThreadSignal (6.72s)
crash_cgo_test.go:94: expected "OK\n", but got "C signal did not crash as expected\n\n\n"

I'm going to disable the test. We should figure out why it is not working on Dragonfly, and re-enable it.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/12569 mentions this issue.

@mikioh
Copy link
Contributor

mikioh commented Jul 24, 2015

Just removed a few images, burned dfly-v4.2.3.2 and run ktrace -id ./runtime.test -test.run=TestCgoExternalThreadSignal. The output of kdump is 2759000 lines, extract around SIGSEGV looks the following:

(snip)
 3913:5     1 a.exe    0.000007 CALL  set_tls_area(0,0x7fffff3fafd0,0x10)
 3913:5     1 a.exe    0.000003 RET   set_tls_area 0
 3913:0     0 a.exe    0.000002 RET   clock_gettime 0
 3913:5     1 a.exe    0.000003 CALL  sigprocmask(SIG_SETMASK,0x80081085c,0)
 3913:5     1 a.exe    0.000002 RET   sigprocmask 0
 3913:0     0 a.exe    0.000002 CALL  umtx_wakeup(0xc820026e88,0x1)
 3913:0     0 a.exe    0.000003 RET   umtx_wakeup 0
 3913:3     0 a.exe    0.000002 RET   umtx_sleep 0
 3913:0     0 a.exe    0.000002 CALL  clock_gettime(0x4,0xc820021ec0)
 3913:0     0 a.exe    0.000002 RET   clock_gettime 0
 3913:5     1 a.exe    0.000006 PSIG  SIGSEGV caught handler=0x4558d0 mask=0x0 code=0x1
 3913:5     1 a.exe    0.000224 CALL  sigprocmask(SIG_SETMASK,0,0xc820026050)
 3913:5     1 a.exe    0.000002 RET   sigprocmask 0
 3913:5     1 a.exe    0.000222 CALL  sigaltstack(0x7fffff3fa7c0,0)
 3913:5     1 a.exe    0.000002 RET   sigaltstack 0
 3913:5     1 a.exe    0.000001 CALL  sigprocmask(SIG_SETMASK,0x7fffff3fa7f8,0)
 3913:5     1 a.exe    0.000002 RET   sigprocmask 0
 3913:5     1 a.exe    0.000005 CALL  sigprocmask(SIG_UNBLOCK,0xc820034e68,0)
 3913:5     1 a.exe    0.000223 RET   sigprocmask 0
 3913:5     1 a.exe    0.000003 CALL  sigaction(SIGSEGV,0xc820034e28,0)
 3913:5     1 a.exe    0.000222 RET   sigaction 0
 3913:5     1 a.exe    0.000003 CALL  lwp_gettid
 3913:5     1 a.exe    0.000001 RET   lwp_gettid 5
 3913:5     1 a.exe    0.000001 CALL  lwp_kill(0x559b18,0xb,0)
 3913:5     1 a.exe    0.000002 RET   lwp_kill -1 errno 3 No such process
 3913:5     1 a.exe    0.000004 CALL  sigaction(SIGSEGV,0xc820034e28,0)
 3913:5     1 a.exe    0.000223 RET   sigaction 0
 3913:5     1 a.exe    0.000003 CALL  sigprocmask(SIG_SETMASK,0xc820026050,0)
 3913:5     1 a.exe    0.000222 RET   sigprocmask 0
 3913:5     1 a.exe    0.000003 CALL  sigaltstack(0x7fffff3fa7e8,0)
 3913:5     1 a.exe    0.000002 RET   sigaltstack 0
 3913:5     1 a.exe    0.000001 CALL  sigreturn(0x7fffff3fa940)
 3913:5     1 a.exe    0.000005 RET   sigreturn JUSTRETURN
 3913:5     1 a.exe    0.000224 PSIG  SIGSEGV caught handler=0x4558d0 mask=0x0 code=0x1
 3913:5     1 a.exe    0.000003 CALL  sigprocmask(SIG_SETMASK,0,0xc820026050)
 3913:5     1 a.exe    0.000220 RET   sigprocmask 0
 3913:5     1 a.exe    0.000003 CALL  sigaltstack(0x7fffff3fa7c0,0)
 3913:5     1 a.exe    0.000001 RET   sigaltstack 0
 3913:5     1 a.exe    0.000001 CALL  sigprocmask(SIG_SETMASK,0x7fffff3fa7f8,0)
 3913:5     1 a.exe    0.000004 RET   sigprocmask 0
 3913:5     1 a.exe    0.000005 CALL  sigprocmask(SIG_UNBLOCK,0xc820034e68,0)
 3913:5     1 a.exe    0.000219 RET   sigprocmask 0
 3913:5     1 a.exe    0.000002 CALL  sigaction(SIGSEGV,0xc820034e28,0)
 3913:5     1 a.exe    0.000001 RET   sigaction 0
 3913:5     1 a.exe    0.000222 CALL  lwp_gettid
 3913:5     1 a.exe    0.000002 RET   lwp_gettid 5
 3913:5     1 a.exe    0.000001 CALL  lwp_kill(0x559b18,0xb,0)
 3913:5     1 a.exe    0.000001 RET   lwp_kill -1 errno 3 No such process
 3913:5     1 a.exe    0.000002 CALL  sigaction(SIGSEGV,0xc820034e28,0)
 3913:5     1 a.exe    0.000001 RET   sigaction 0
 3913:5     1 a.exe    0.000002 CALL  sigprocmask(SIG_SETMASK,0xc820026050,0)
 3913:5     1 a.exe    0.000034 RET   sigprocmask 0
 3913:5     1 a.exe    0.000001 CALL  sigaltstack(0x7fffff3fa7e8,0)
 3913:5     1 a.exe    0.000001 RET   sigaltstack 0
 3913:5     1 a.exe    0.000002 CALL  sigreturn(0x7fffff3fa940)
 3913:5     1 a.exe    0.000001 RET   sigreturn JUSTRETURN
 3913:5     1 a.exe    0.000003 PSIG  SIGSEGV caught handler=0x4558d0 mask=0x0 code=0x1
 3913:5     1 a.exe    0.000005 CALL  sigprocmask(SIG_SETMASK,0,0xc820026050)
 3913:5     1 a.exe    0.000001 RET   sigprocmask 0
(repeated many times)
 3913:5     1 a.exe    0.000003 PSIG  SIGSEGV caught handler=0x4558d0 mask=0x0 code=0x1
 3913:5     1 a.exe    0.000005 CALL  sigprocmask(SIG_SETMASK,0,0xc820026050)
 3913:5     1 a.exe    0.000001 RET   sigprocmask 0
 3913:1     0 a.exe    0.000004 RET   nanosleep 0
 3913:5     1 a.exe    0.000012 CALL  sigaltstack(0x7fffff3fa7c0,0)
 3913:5     1 a.exe    0.000679 RET   sigaltstack 0
 3913:1     0 a.exe    0.000088 CALL  clock_gettime(0x4,0x7fffffbfeea0)
 3913:1     0 a.exe    0.000006 RET   clock_gettime 0
 3913:1     0 a.exe    0.000003 CALL  clock_gettime(0,0x7fffffbfee88)
 3913:1     0 a.exe    0.109743 RET   clock_gettime 0
 3913:0     0 a.exe    0.000026 RET   umtx_sleep -1 errno 35 Resource temporarily unavailable
 3913:1     0 a.exe    0.000014 CALL  nanosleep(0x7fffffbfeea8,0)
 3913:0     0 a.exe    0.000013 CALL  clock_gettime(0x4,0xc820021ec0)
 3913:0     0 a.exe    0.000006 RET   clock_gettime 0
 3913:0     0 a.exe    0.000037 CALL  clock_gettime(0x4,0xc820021f18)
 3913:0     0 a.exe    0.000018 RET   clock_gettime 0
 3913:0     0 a.exe    0.000013 CALL  exit(0)
 3913:5     1 a.exe    0.000479 CALL  sigprocmask(SIG_SETMASK,0x7fffff3fa7f8,0)
 3912:3     1 a.exe    0.004233 GIO   fd 4 read 0 bytes
       ""
 3912:3     1 a.exe    0.000011 RET   read 0
 3912:0     1 a.exe    0.001501 PSIG  SIGCHLD caught handler=0x4558d0 mask=0x0 code=0x0
 3912:0     1 a.exe    0.000024 RET   wait4 RESTART
 3912:0     1 a.exe    0.000008 CALL  sigreturn(0xc8200099a0)
 3912:0     1 a.exe    0.000002 RET   sigreturn JUSTRETURN
 3912:0     1 a.exe    0.000003 CALL  wait4(0xf49,0xc820045b8c,<invalid>0,0xc82008e000)
 3912:0     1 a.exe    0.000028 RET   wait4 3913/0xf49
 3912:0     1 a.exe    0.000006 CALL  umtx_wakeup(0x7cae60,0x1)
 3912:0     1 a.exe    0.000026 RET   umtx_wakeup 0
 3912:0     1 a.exe    0.000030 CALL  umtx_sleep(0x7cb3e8,0,0)
 3912:3     1 a.exe    0.000015 CALL  close(0x4)
 3912:3     1 a.exe    0.000006 RET   close 0
 3912:3     1 a.exe    0.000008 CALL  umtx_wakeup(0x7cb3e8,0x1)
 3912:3     1 a.exe    0.000003 RET   umtx_wakeup 0
 3912:0     1 a.exe    0.000003 RET   umtx_sleep 0
 3912:1     0 a.exe    0.000038 RET   umtx_sleep 0
 3912:1     0 a.exe    0.000012 CALL  clock_gettime(0x4,0x7fffffbfeea0)
 3912:1     0 a.exe    0.000002 RET   clock_gettime 0
 3912:1     0 a.exe    0.000007 CALL  clock_gettime(0,0x7fffffbfee88)
 3912:1     0 a.exe    0.000001 RET   clock_gettime 0
 3912:1     0 a.exe    0.000003 CALL  nanosleep(0x7fffffbfeea8,0)
 3912:1     0 a.exe    0.000022 RET   nanosleep 0
 3912:3     1 a.exe    0.000002 CALL  write(0x1,0xc820062330,0x24)
 3912:3     1 a.exe    0.000008 GIO   fd 1 wrote 36 bytes
       "C signal did not crash as expected

       "

@ianlancetaylor
Copy link
Contributor Author

Thanks! This makes it obvious that the problem is that runtime·raise is not implemented correctly for dragonfly. The code in runtime/sys_dragonfly_amd64.s is obviously wrong. What is less clear is what it should look like.

Can you give https://golang.org/cl/12621 a try?

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/12621 mentions this issue.

@mikioh
Copy link
Contributor

mikioh commented Jul 24, 2015

Can you give https://golang.org/cl/12621 a try?

Re-burning...

@mikioh
Copy link
Contributor

mikioh commented Jul 24, 2015

It works, congrats.

go test -v -run=Cgo
=== RUN   TestCgoCrashHandler
--- PASS: TestCgoCrashHandler (0.97s)
=== RUN   TestCgoSignalDeadlock
--- PASS: TestCgoSignalDeadlock (1.56s)
=== RUN   TestCgoTraceback
--- PASS: TestCgoTraceback (0.89s)
=== RUN   TestCgoExternalThreadPanic
--- PASS: TestCgoExternalThreadPanic (0.69s)
=== RUN   TestCgoExternalThreadSIGPROF
--- PASS: TestCgoExternalThreadSIGPROF (0.62s)
=== RUN   TestCgoExternalThreadSignal
--- PASS: TestCgoExternalThreadSignal (0.95s)
=== RUN   TestCgoDLLImports
--- SKIP: TestCgoDLLImports (0.00s)
    crash_cgo_test.go:101: skipping windows specific test
PASS
ok      runtime 5.685s

@ianlancetaylor
Copy link
Contributor Author

Thanks for testing--want to +2 the CL?

@ianlancetaylor
Copy link
Contributor Author

Oh, you did already--thanks!

@mikioh mikioh modified the milestones: Go1.5, Unplanned Jul 24, 2015
@idevz
Copy link

idevz commented Oct 12, 2015

I got this mistake when I build go1.4.3 on my mac

ok      net/smtp    0.046s
ok      net/textproto   0.011s
ok      net/url 0.014s
ok      os  0.564s
ok      os/exec 0.433s
ok      os/signal   2.771s
ok      os/user 0.010s
ok      path    0.007s
ok      path/filepath   0.030s
ok      reflect 0.074s
ok      regexp  0.161s
ok      regexp/syntax   0.566s
--- FAIL: TestCgoExternalThreadSIGPROF (0.39s)
    crash_cgo_test.go:76: expected "OK\n", but got "fatal error: cgo callback before cgo call\n"
FAIL
FAIL    runtime 7.580s
?       runtime/cgo [no test files]
ok      runtime/debug   0.012s
ok      runtime/pprof   6.392s
?       runtime/race    [no test files]
ok      sort    0.070s
ok      strconv 0.264s
ok      strings 0.097s
ok      sync    0.109s
ok      sync/atomic 0.226s

I have already try 12621 and 12569 but it doesn't work.

@ianlancetaylor
Copy link
Contributor Author

@idevz That is a different problem, and this issue is closed. Please open a new bug report.

@idevz
Copy link

idevz commented Oct 12, 2015

@ianlancetaylor thank you every much

@golang golang locked and limited conversation to collaborators Oct 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants