Skip to content

CTRL+C signal causes go-oci8 program to crash on Linux and OS X #106

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
jusongchen opened this issue Jul 23, 2016 · 10 comments
Closed

CTRL+C signal causes go-oci8 program to crash on Linux and OS X #106

jusongchen opened this issue Jul 23, 2016 · 10 comments

Comments

@jusongchen
Copy link

Step to reproduce the issue:

1)build the test program (uploaded at https://github.com/jusongchen/oci8-test2)

  1. set env variable GO_OCI8_CONNECT_STRING,e.g: GO_OCI8_CONNECT_STRING=scott/tiger@//hostname/oracle_service

  2. run the programm and enter CTRL+C after the prompt

  3. CTRL+C signal won't cause any issue before a DB operation. However, after a DB operation, it will crash the programm with message

"llegal instruction: 4" -- on Mac OS X

or "Trace/breakpoint trap" --on Ubuntu Linux.

@mattn
Copy link
Owner

mattn commented Jul 28, 2016

could you please check the stacktrace with gdb?

@LamCiuLoeng
Copy link

I got the same problem too:

fatal: morestack on g0
SIGTRAP: trace trap
PC=0x4057742 m=0 sigcode=1

goroutine 0 [idle]:
runtime.morestack()
/usr/local/go/src/runtime/asm_amd64.s:385 +0x22

goroutine 1 [chan receive]:
main.main()
/Users/cl.lam/study/go/src/zhuzher-express/main.go:22 +0x2c3

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
/usr/local/go/src/runtime/sigqueue.go:131 +0xa7
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
/usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 6 [chan receive]:
database/sql.(*DB).connectionOpener(0xc4200868c0)
/usr/local/go/src/database/sql/sql.go:871 +0x53
created by database/sql.Open
/usr/local/go/src/database/sql/sql.go:609 +0x1ee

goroutine 7 [select, locked to thread]:
runtime.gopark(0x43286a8, 0x0, 0x43149b0, 0x6, 0x18, 0x1)
/usr/local/go/src/runtime/proc.go:287 +0x12c
runtime.selectgo(0xc420038f50, 0xc420074240)
/usr/local/go/src/runtime/select.go:395 +0x1149
runtime.ensureSigM.func1()
/usr/local/go/src/runtime/signal_unix.go:511 +0x1fe
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2337 +0x1

goroutine 8 [IO wait]:
internal/poll.runtime_pollWait(0x5594f98, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc420110098, 0x72, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xae
internal/poll.(*pollDesc).waitRead(0xc420110098, 0xffffffffffffff00, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc420110080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:335 +0x1e2
net.(*netFD).accept(0xc420110080, 0x5540000, 0x0, 0x4328748)
/usr/local/go/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc42000e050, 0xc42003de20, 0x40139c8, 0x30)
/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).AcceptTCP(0xc42000e050, 0xc420077200, 0xc420077200, 0x42b4f40)
/usr/local/go/src/net/tcpsock.go:234 +0x49
net/http.tcpKeepAliveListener.Accept(0xc42000e050, 0xc42001a090, 0x42b4f40, 0x449ecf0, 0x4307ce0)
/usr/local/go/src/net/http/server.go:3120 +0x2f
net/http.(*Server).Serve(0xc42007b110, 0x4475720, 0xc42000e050, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2695 +0x1b2
net/http.(*Server).ListenAndServe(0xc42007b110, 0x10, 0xc42002d798)
/usr/local/go/src/net/http/server.go:2636 +0xa9
zhuzher-express/web.AppSrv.Run(0xc42007b110, 0x4475820, 0xc4200dc360, 0x44755a0, 0xc42000e038)
/Users/cl.lam/study/go/src/zhuzher-express/web/server.go:67 +0xa6
created by main.main
/Users/cl.lam/study/go/src/zhuzher-express/main.go:21 +0x2ac

rax 0x17
rbx 0x44aa360
rcx 0x405b1a5
rdx 0x0
rdi 0x2
rsi 0x4319635
rbp 0xc4200099f0
rsp 0xc420009940
r8 0x5203870
r9 0xffffffff00000000
r10 0xc420009798
r11 0x202
r12 0x0
r13 0xff
r14 0xff
r15 0xf
rip 0x4057742
rflags 0x202
cs 0x2b
fs 0x0
gs 0x0
exit status 2

@mpierini
Copy link

I also get a similar stack trace. It would be nice to be able to gracefully exit on ctrl-c, but it looks like the processes are locked during db operations which doesn't allow the signal to be handled.

@AddyMehra
Copy link

Same issue on MacOSX:
The issue is produced after DB operations::
#################################

fatal: morestack on g0
SIGTRAP: trace trap
PC=0x4056df2 m=0 sigcode=1

goroutine 0 [idle]:
runtime.morestack()
/usr/local/go/src/runtime/asm_amd64.s:385 +0x22

goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x8c08e50, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201a0398, 0x72, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xae
internal/poll.(*pollDesc).waitRead(0xc4201a0398, 0xffffffffffffff00, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc4201a0380, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:335 +0x1e2
net.(*netFD).accept(0xc4201a0380, 0x449fb90, 0xc42004dd80, 0x4003d6b)
/usr/local/go/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc42000ecc0, 0x44074e0, 0xc42004ddb0, 0x4002b07)
/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).AcceptTCP(0xc42000ecc0, 0xc42004ddf8, 0xc42004de00, 0xc42004ddf0)
/usr/local/go/src/net/tcpsock.go:234 +0x49
net/http.tcpKeepAliveListener.Accept(0xc42000ecc0, 0x449f528, 0xc42018d680, 0x468e700, 0xc420186f90)
/usr/local/go/src/net/http/server.go:3120 +0x2f
net/http.(*Server).Serve(0xc420079520, 0x468e240, 0xc42000ecc0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2695 +0x1b2
net/http.(*Server).ListenAndServe(0xc420079520, 0x2, 0x2)
/usr/local/go/src/net/http/server.go:2636 +0xa9
main.main()
/Users/me/go/src/github.com/test/main.go:19 +0xe1

goroutine 5 [chan receive]:
database/sql.(*DB).connectionOpener(0xc42018c960)
/usr/local/go/src/database/sql/sql.go:871 +0x53
created by database/sql.Open
/usr/local/go/src/database/sql/sql.go:609 +0x1ee

goroutine 6 [chan receive]:
gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun(0xc42016b920)
/Users/me/go/src/gopkg.in/natefinch/lumberjack.v2/lumberjack.go:379 +0x58
created by gopkg.in/natefinch/lumberjack%2ev2.(*Logger).mill.func1
/Users/me/go/src/gopkg.in/natefinch/lumberjack.v2/lumberjack.go:390 +0x7e

goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x8c08d90, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201a0418, 0x72, 0xffffffffffffff00, 0x468ae80, 0x4686638)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xae
internal/poll.(*pollDesc).waitRead(0xc4201a0418, 0xc4201bb000, 0x1000, 0x1000)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc4201a0400, 0xc4201bb000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:126 +0x18a
net.(*netFD).Read(0xc4201a0400, 0xc4201bb000, 0x1000, 0x1000, 0xc42004fb00, 0x425f81a, 0xc420187088)
/usr/local/go/src/net/fd_unix.go:202 +0x52
net.(*conn).Read(0xc42000ecd0, 0xc4201bb000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:176 +0x6d
net/http.(*connReader).Read(0xc420187080, 0xc4201bb000, 0x1000, 0x1000, 0xc42004fbe8, 0x417990c, 0xc4201a0400)
/usr/local/go/src/net/http/server.go:753 +0x105
bufio.(*Reader).fill(0xc42016bf20)
/usr/local/go/src/bufio/bufio.go:97 +0x11a
bufio.(*Reader).Peek(0xc42016bf20, 0x4, 0x0, 0x0, 0x0, 0x0, 0x8c08d00)
/usr/local/go/src/bufio/bufio.go:129 +0x3a
net/http.(*conn).readRequest(0xc42018d680, 0x468e640, 0xc42019ab80, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:930 +0xc77
net/http.(*conn).serve(0xc42018d680, 0x468e640, 0xc42019ab80)
/usr/local/go/src/net/http/server.go:1739 +0x50e
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2720 +0x288

rax 0x17
rbx 0x46c70c0
rcx 0x405a855
rdx 0x0
rdi 0x2
rsi 0x448b921
rbp 0xc420009ab0
rsp 0xc420009aa0
r8 0xc420009f48
Crisps-MacBook-Pro:test crispanalytics$ go run main.go
DEVELOPMENT
Server starting at port 20440
^Cfatal: morestack on g0
SIGTRAP: trace trap
PC=0x4056ea2 m=0 sigcode=1

goroutine 0 [idle]:
runtime.morestack()
/usr/local/go/src/runtime/asm_amd64.s:385 +0x22

goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x8e0d2a0, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201b4318, 0x72, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xae
internal/poll.(*pollDesc).waitRead(0xc4201b4318, 0xffffffffffffff00, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc4201b4300, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:335 +0x1e2
net.(*netFD).accept(0xc4201b4300, 0x449fbb0, 0xc42004dd80, 0x4003e1b)
/usr/local/go/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc420086cb0, 0x4407500, 0xc42004ddb0, 0x4002bb7)
/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).AcceptTCP(0xc420086cb0, 0xc42004ddf8, 0xc42004de00, 0xc42004ddf0)
/usr/local/go/src/net/tcpsock.go:234 +0x49
net/http.tcpKeepAliveListener.Accept(0xc420086cb0, 0x449f548, 0xc4201a15e0, 0x468e700, 0xc42019af90)
/usr/local/go/src/net/http/server.go:3120 +0x2f
net/http.(*Server).Serve(0xc42007f6c0, 0x468e240, 0xc420086cb0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2695 +0x1b2
net/http.(*Server).ListenAndServe(0xc42007f6c0, 0x2, 0x2)
/usr/local/go/src/net/http/server.go:2636 +0xa9
main.main()
/Users/me/go/src/github.com/test/main.go:19 +0xe1

goroutine 19 [chan receive]:
database/sql.(*DB).connectionOpener(0xc4201a08c0)
/usr/local/go/src/database/sql/sql.go:871 +0x53
created by database/sql.Open
/usr/local/go/src/database/sql/sql.go:609 +0x1ee

goroutine 20 [chan receive]:
gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun(0xc42017d8c0)
/Users/me/go/src/gopkg.in/natefinch/lumberjack.v2/lumberjack.go:379 +0x58
created by gopkg.in/natefinch/lumberjack%2ev2.(*Logger).mill.func1
/Users/me/go/src/gopkg.in/natefinch/lumberjack.v2/lumberjack.go:390 +0x7e

goroutine 21 [IO wait]:
internal/poll.runtime_pollWait(0x8e0d1e0, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201b4398, 0x72, 0xffffffffffffff00, 0x468ae80, 0x4686638)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xae
internal/poll.(*pollDesc).waitRead(0xc4201b4398, 0xc4201cb000, 0x1000, 0x1000)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc4201b4380, 0xc4201cb000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:126 +0x18a
net.(*netFD).Read(0xc4201b4380, 0xc4201cb000, 0x1000, 0x1000, 0xc420049b00, 0x425f8ca, 0xc42019b088)
/usr/local/go/src/net/fd_unix.go:202 +0x52
net.(*conn).Read(0xc420086cc0, 0xc4201cb000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:176 +0x6d
net/http.(*connReader).Read(0xc42019b080, 0xc4201cb000, 0x1000, 0x1000, 0xc420049be8, 0x41799bc, 0xc4201b4380)
/usr/local/go/src/net/http/server.go:753 +0x105
bufio.(*Reader).fill(0xc42017dec0)
/usr/local/go/src/bufio/bufio.go:97 +0x11a
bufio.(*Reader).Peek(0xc42017dec0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x8e0d200)
/usr/local/go/src/bufio/bufio.go:129 +0x3a
net/http.(*conn).readRequest(0xc4201a15e0, 0x468e640, 0xc4201aeb00, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:930 +0xc77
net/http.(*conn).serve(0xc4201a15e0, 0x468e640, 0xc4201aeb00)
/usr/local/go/src/net/http/server.go:1739 +0x50e
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2720 +0x288

rax 0x17
rbx 0x46c70c0
rcx 0x405a905
rdx 0x0
rdi 0x2
rsi 0x448b941
rbp 0xc420009ab0
rsp 0xc420009aa0
r8 0xc420009f48
Crisps-MacBook-Pro:test crispanalytics$ go run main.go
DEVELOPMENT
Server starting at port 20440
^Csignal: interrupt
Crisps-MacBook-Pro:test crispanalytics$ go run main.go
DEVELOPMENT
Server starting at port 20440
^Cfatal: morestack on g0
SIGTRAP: trace trap
PC=0x4057072 m=0 sigcode=1

goroutine 0 [idle]:
runtime.morestack()
/usr/local/go/src/runtime/asm_amd64.s:385 +0x22

goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x8c08e50, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201a0318, 0x72, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xae
internal/poll.(*pollDesc).waitRead(0xc4201a0318, 0xffffffffffffff00, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc4201a0300, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:335 +0x1e2
net.(*netFD).accept(0xc4201a0300, 0x449fcb0, 0xc42004dd80, 0x4003feb)
/usr/local/go/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc42000ecc0, 0x4407600, 0xc42004ddb0, 0x4002d87)
/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).AcceptTCP(0xc42000ecc0, 0xc42004ddf8, 0xc42004de00, 0xc42004ddf0)
/usr/local/go/src/net/tcpsock.go:234 +0x49
net/http.tcpKeepAliveListener.Accept(0xc42000ecc0, 0x449f648, 0xc42018d680, 0x468e700, 0xc420186f90)
/usr/local/go/src/net/http/server.go:3120 +0x2f
net/http.(*Server).Serve(0xc4200792b0, 0x468e240, 0xc42000ecc0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2695 +0x1b2
net/http.(*Server).ListenAndServe(0xc4200792b0, 0x2, 0x2)
/usr/local/go/src/net/http/server.go:2636 +0xa9
main.main()
/Users/me/go/src/github.com/test/main.go:19 +0xe1

goroutine 5 [chan receive]:
database/sql.(*DB).connectionOpener(0xc42018c960)
/usr/local/go/src/database/sql/sql.go:871 +0x53
created by database/sql.Open
/usr/local/go/src/database/sql/sql.go:609 +0x1ee

goroutine 6 [chan receive]:
gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun(0xc420169920)
/Users/me/go/src/gopkg.in/natefinch/lumberjack.v2/lumberjack.go:379 +0x58
created by gopkg.in/natefinch/lumberjack%2ev2.(*Logger).mill.func1
/Users/me/go/src/gopkg.in/natefinch/lumberjack.v2/lumberjack.go:390 +0x7e

goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x8c08d90, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201a0398, 0x72, 0xffffffffffffff00, 0x468ae80, 0x4686638)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0xae
internal/poll.(*pollDesc).waitRead(0xc4201a0398, 0xc4201bb000, 0x1000, 0x1000)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc4201a0380, 0xc4201bb000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:126 +0x18a
net.(*netFD).Read(0xc4201a0380, 0xc4201bb000, 0x1000, 0x1000, 0xc42004fb00, 0x425fa9a, 0xc420187088)
/usr/local/go/src/net/fd_unix.go:202 +0x52
net.(*conn).Read(0xc42000ecd0, 0xc4201bb000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:176 +0x6d
net/http.(*connReader).Read(0xc420187080, 0xc4201bb000, 0x1000, 0x1000, 0xc42004fbe8, 0x4179b8c, 0xc4201a0380)
/usr/local/go/src/net/http/server.go:753 +0x105
bufio.(*Reader).fill(0xc420169f20)
/usr/local/go/src/bufio/bufio.go:97 +0x11a
bufio.(*Reader).Peek(0xc420169f20, 0x4, 0x0, 0x0, 0x0, 0x0, 0x8c08d00)
/usr/local/go/src/bufio/bufio.go:129 +0x3a
net/http.(*conn).readRequest(0xc42018d680, 0x468e640, 0xc42019ab40, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:930 +0xc77
net/http.(*conn).serve(0xc42018d680, 0x468e640, 0xc42019ab40)
/usr/local/go/src/net/http/server.go:1739 +0x50e
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2720 +0x288

rax 0x17
rbx 0x46c70c0
rcx 0x405aad5
rdx 0x0
rdi 0x2
rsi 0x448ba41
rbp 0xc420009ab0
rsp 0xc420009aa0
r8 0xc420009f48

@MichaelS11
Copy link
Contributor

Not seeing any oic8 path in the stack trace. Maybe the issue is elsewhere?

@AddyMehra
Copy link

Not seeing any oic8 path in the stack trace. Maybe the issue is elsewhere?

Hi,
The issue is only seen when I try to use make connection to oracle database and after response, CTRL+C is pressed. I made a test-connection api with gorilla-mux along with database/sql and go-oci8 package and driver.

Issue is not found when I try using pq (postgres) driver.

@mattn
Copy link
Owner

mattn commented Nov 16, 2018

As far as I can see, this is related on golang/go#23360 or golang/go#25229

@AddyMehra
Copy link

So if i upgrade to golang v1.11.2 (stable), this will solve the issue? �
*went through the issues as stated by mattn and users facing have suggeste upgrading to 1.10+

@MichaelS11
Copy link
Contributor

@mattn The issue owner has not commented since first opening this. Also does not seem like this is an issue with oci8. Close this?

@mattn
Copy link
Owner

mattn commented Nov 18, 2018

Please reopen this if you still have issue and it is related on go-oci8.

@mattn mattn closed this as completed Nov 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants