現在,這適用于測試數據庫,但在有數百萬行的生產數據庫中,它在獲取 1,000 行后卡住并停止在屏幕上打印。我讓它運行了一夜。早上,我發送了QUIT信號并得到以下堆棧跟蹤SIGQUIT: quitPC=0x5fecb m=0goroutine 0 [idle]:runtime.mach_semaphore_wait(0xe03, 0x0, 0x0, 0x0, 0x0, 0x407520, 0x52db9, 0xffffffffffffffff, 0x0, 0x7fff5fbff0fc, ...) /usr/local/Cellar/go/1.5/libexec/src/runtime/sys_darwin_amd64.s:407 +0xbruntime.semasleep1(0xffffffffffffffff, 0x0) /usr/local/Cellar/go/1.5/libexec/src/runtime/os1_darwin.go:385 +0xe5runtime.semasleep.func1() /usr/local/Cellar/go/1.5/libexec/src/runtime/os1_darwin.go:401 +0x29runtime.systemstack(0x7fff5fbff100) /usr/local/Cellar/go/1.5/libexec/src/runtime/asm_amd64.s:278 +0xabruntime.semasleep(0xffffffffffffffff, 0x0) /usr/local/Cellar/go/1.5/libexec/src/runtime/os1_darwin.go:402 +0x36runtime.notesleep(0x407970) /usr/local/Cellar/go/1.5/libexec/src/runtime/lock_sema.go:169 +0x100runtime.stopm() /usr/local/Cellar/go/1.5/libexec/src/runtime/proc1.go:1128 +0x112runtime.findrunnable(0xc82001d500, 0x0) /usr/local/Cellar/go/1.5/libexec/src/runtime/proc1.go:1530 +0x69eruntime.schedule() /usr/local/Cellar/go/1.5/libexec/src/runtime/proc1.go:1639 +0x267runtime.park_m(0xc820000180) /usr/local/Cellar/go/1.5/libexec/src/runtime/proc1.go:1698 +0x18bruntime.mcall(0x7fff5fbff280) /usr/local/Cellar/go/1.5/libexec/src/runtime/asm_amd64.s:204 +0x5b問題:為什么它在獲取 1,000(appox) 行后立即卡?。孔⑨尩羧绾蝑efer rows.Close()立即停止卡住和恐慌?有沒有更好的方法來編寫這個程序?最后,如果以上這些是愚蠢的問題或問題太長,我很抱歉。我是 Go 的新手,正在努力學習。
- 1 回答
- 0 關注
- 327 瀏覽
添加回答
舉報
0/150
提交
取消