bobheadxi / timelines

🏷 Historical analysis of Git repositories and Git host activity as a service
https://bobheadxi.dev/timelines-recap
Apache License 2.0
3 stars 0 forks source link

db: `res.RowsAffected() != itemCount` causes havok #22

Closed bobheadxi closed 5 years ago

bobheadxi commented 5 years ago

https://github.com/bobheadxi/projector/blob/3138160/db/repos.go#L143

this:

bobheadxi commented 5 years ago
{"level":"error","ts":1552350639.591381,"logger":"worker.github_sync","caller":"worker/worker.go:302","msg":"failed to insert github items","job.id":"0d49bc00-445e-11e9-a55b-9a00fc91b201","db.id":1,"error":"expected 30 rows to change, only changed 1 rows","stacktrace":"github.com/bobheadxi/projector/worker.(*worker).githubSync.func1\n\t/Users/robertlin/go/src/github.com/bobheadxi/projector/worker/worker.go:302"}
{"level":"error","ts":1552350639.591438,"logger":"worker","caller":"worker/worker.go:78","msg":"critical error encountered - stopping worker","error":"expected 30 rows to change, only changed 1 rows","stacktrace":"github.com/bobheadxi/projector/worker.Run\n\t/Users/robertlin/go/src/github.com/bobheadxi/projector/worker/worker.go:78\ngithub.com/bobheadxi/projector/cmd.newWorkerCmd.func1\n\t/Users/robertlin/go/src/github.com/bobheadxi/projector/cmd/worker.go:27\ngithub.com/bobheadxi/projector/vendor/github.com/spf13/cobra.(*Command).execute\n\t/Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/spf13/cobra/command.go:762\ngithub.com/bobheadxi/projector/vendor/github.com/spf13/cobra.(*Command).ExecuteC\n\t/Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/spf13/cobra/command.go:852\ngithub.com/bobheadxi/projector/vendor/github.com/spf13/cobra.(*Command).Execute\n\t/Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/spf13/cobra/command.go:800\nmain.main\n\t/Users/robertlin/go/src/github.com/bobheadxi/projector/main.go:20\nruntime.main\n\t/usr/local/Cellar/go/1.12/libexec/src/runtime/proc.go:200"}
^C^CSIGABRT: abort # could not cmd-C the process
PC=0x7fff62fee716 m=0 sigcode=0

goroutine 0 [idle]:
runtime.kevent(0x7ffe00000004, 0x0, 0x7fff00000000, 0x7ffeefbfee18, 0x40, 0x0, 0xc000000000)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/sys_darwin.go:322 +0x3b
runtime.netpoll(0xc000052501, 0xc000048f01)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/netpoll_kqueue.go:73 +0x148
runtime.findrunnable(0xc00004d900, 0x0)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/proc.go:2380 +0x505
runtime.schedule()
        /usr/local/Cellar/go/1.12/libexec/src/runtime/proc.go:2525 +0x20e
runtime.park_m(0xc000478900)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/proc.go:2605 +0xa1
runtime.mcall(0x405825b)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/asm_amd64.s:299 +0x5b

goroutine 1 [chan send]:
github.com/bobheadxi/projector/worker.Run(0xc0000be500, 0xc000ca8060, 0x1, 0x4d50925, 0xe, 0x0, 0x0, 0x0, 0x4d0a239, 0x9, ...)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/worker/worker.go:80 +0x6d6
github.com/bobheadxi/projector/cmd.newWorkerCmd.func1(0xc000b06780, 0x5c91a60, 0x0, 0x0, 0x0, 0x0)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/cmd/worker.go:27 +0x1a7
github.com/bobheadxi/projector/vendor/github.com/spf13/cobra.(*Command).execute(0xc000b06780, 0x5c91a60, 0x0, 0x0, 0xc000b06780, 0x5c91a60)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/spf13/cobra/command.go:762 +0x465
github.com/bobheadxi/projector/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc000b06000, 0xc000b06280, 0x4a256be, 0xc000b93f88)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/spf13/cobra/command.go:852 +0x2c0
github.com/bobheadxi/projector/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/spf13/cobra/command.go:800
main.main()
        /Users/robertlin/go/src/github.com/bobheadxi/projector/main.go:20 +0xbf

goroutine 50 [syscall]:
os/signal.signal_recv(0x4fe9fa0)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/sigqueue.go:139 +0x9f
os/signal.loop()
        /usr/local/Cellar/go/1.12/libexec/src/os/signal/signal_unix.go:23 +0x22
created by os/signal.init.0
        /usr/local/Cellar/go/1.12/libexec/src/os/signal/signal_unix.go:29 +0x41

goroutine 52 [chan send]:
github.com/bobheadxi/projector/cmd.newStopper.func1(0xc000ca80c0, 0xc000ca8060)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/cmd/util.go:18 +0x4e
created by github.com/bobheadxi/projector/cmd.newStopper
        /Users/robertlin/go/src/github.com/bobheadxi/projector/cmd/util.go:16 +0x10b

goroutine 66 [chan receive]:
github.com/bobheadxi/projector/vendor/github.com/go-redis/redis/internal/pool.(*ConnPool).reaper(0xc000cbe000, 0xdf8475800)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/go-redis/redis/internal/pool/pool.go:449 +0x96
created by github.com/bobheadxi/projector/vendor/github.com/go-redis/redis/internal/pool.NewConnPool
        /Users/robertlin/go/src/github.com/bobheadxi/projector/vendor/github.com/go-redis/redis/internal/pool/pool.go:99 +0x1af

goroutine 9 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc000038708)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc000038700)
        /usr/local/Cellar/go/1.12/libexec/src/sync/waitgroup.go:130 +0x65
github.com/bobheadxi/projector/worker.(*worker).processJobs(0xc000ccc2d0, 0xc000ca8060, 0xc0000bc840)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/worker/worker.go:153 +0x50f
created by github.com/bobheadxi/projector/worker.Run
        /Users/robertlin/go/src/github.com/bobheadxi/projector/worker/worker.go:73 +0x52a

goroutine 11 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc000b6a608)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc000b6a600)
        /usr/local/Cellar/go/1.12/libexec/src/sync/waitgroup.go:130 +0x65
github.com/bobheadxi/projector/worker.(*worker).githubSync(0xc000ccc2d0, 0x4ff8620, 0xc0000d2000, 0xc000041540, 0xc000038700)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/worker/worker.go:334 +0xc92
created by github.com/bobheadxi/projector/worker.(*worker).processJobs
        /Users/robertlin/go/src/github.com/bobheadxi/projector/worker/worker.go:151 +0x4a6

goroutine 67 [chan send]:
github.com/bobheadxi/projector/github.(*Syncer).fetchDetails(0xc00046c280, 0x4ff8620, 0xc0000d2000, 0xc000b6a600)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:172 +0x8fe
created by github.com/bobheadxi/projector/github.(*Syncer).sync
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:88 +0x81

goroutine 68 [chan send]:
github.com/bobheadxi/projector/github.(*Syncer).fetchDetails(0xc00046c280, 0x4ff8620, 0xc0000d2000, 0xc000b6a600)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:172 +0x8fe
created by github.com/bobheadxi/projector/github.(*Syncer).sync
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:88 +0x81

goroutine 69 [chan send]:
github.com/bobheadxi/projector/github.(*Syncer).fetchDetails(0xc00046c280, 0x4ff8620, 0xc0000d2000, 0xc000b6a600)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:172 +0x8fe
created by github.com/bobheadxi/projector/github.(*Syncer).sync
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:88 +0x81

goroutine 70 [chan receive]:
github.com/bobheadxi/projector/github.(*Syncer).handleIssues(0xc00046c280, 0x4ff8620, 0xc0000d2000, 0xc000b6a600)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:117 +0xc5
created by github.com/bobheadxi/projector/github.(*Syncer).sync
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:91 +0xeb

goroutine 71 [chan send]:
github.com/bobheadxi/projector/github.(*Client).GetIssues(0xc000f4a440, 0x4ff8620, 0xc0000d2000, 0xc000cc8440, 0x9, 0xc000cc8450, 0x8, 0x0, 0x4ccde30, 0x3, ...)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/github.go:153 +0x27f
github.com/bobheadxi/projector/github.(*Syncer).sync.func1(0xc00046c280, 0x4ff8620, 0xc0000d2000, 0xc000b6a600, 0xc000ca82a0)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:97 +0xc4
created by github.com/bobheadxi/projector/github.(*Syncer).sync
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:96 +0x16f

goroutine 72 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc000b6a608)
        /usr/local/Cellar/go/1.12/libexec/src/runtime/sema.go:56 +0x39
sync.(*WaitGroup).Wait(0xc000b6a600)
        /usr/local/Cellar/go/1.12/libexec/src/sync/waitgroup.go:130 +0x65
github.com/bobheadxi/projector/github.(*Syncer).Sync.func1(0xc000b6a600, 0xc00046c280)
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:77 +0x2f
created by github.com/bobheadxi/projector/github.(*Syncer).Sync
        /Users/robertlin/go/src/github.com/bobheadxi/projector/github/sync.go:76 +0x1dd

rax    0x4
rbx    0x7ffeefbfedb0
rcx    0x7ffeefbfecf8
rdx    0x0
rdi    0x4
rsi    0x0
rbp    0x7ffeefbfed00
rsp    0x7ffeefbfecf8
r8     0x40
r9     0x0
r10    0x7ffeefbfee18
r11    0x202
r12    0x0
r13    0xff
r14    0x4fa6992
r15    0x0
rip    0x7fff62fee716
rflags 0x203
cs     0x7
fs     0x0
gs     0x0
bobheadxi commented 5 years ago

this no longer seems to be an issue after i refactored things to use CopyFrom instead of batches of prepared statement executions (8842246d3d0521fa7bbecf1db4ec4a577658b074, 4bcfede1b5ff3e74fc461838c007b96538acd117, 40e6c0965d673635745f25a76e958e03e9b0091a, etc.)