{"action":"created","issue":{"url":"https://api.github.com/repos/boltdb/bolt/issues/596","repository_url":"https://api.github.com/repos/boltdb/bolt","labels_url":"https://api.github.com/repos/boltdb/bolt/issues/596/labels{/name}","comments_url":"https://api.github.com/repos/boltdb/bolt/issues/596/comments","events_url":"https://api.github.com/repos/boltdb/bolt/issues/596/events","html_url":"https://github.com/boltdb/bolt/issues/596","id":177811494,"number":596,"title":"SEGFAULT in Tx.Commit()","user":{"login":"AaronO","id":949223,"avatar_url":"https://avatars.githubusercontent.com/u/949223?v=3","gravatar_id":"","url":"https://api.github.com/users/AaronO","html_url":"https://github.com/AaronO","followers_url":"https://api.github.com/users/AaronO/followers","following_url":"https://api.github.com/users/AaronO/following{/other_user}","gists_url":"https://api.github.com/users/AaronO/gists{/gist_id}","starred_url":"https://api.github.com/users/AaronO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AaronO/subscriptions","organizations_url":"https://api.github.com/users/AaronO/orgs","repos_url":"https://api.github.com/users/AaronO/repos","events_url":"https://api.github.com/users/AaronO/events{/privacy}","received_events_url":"https://api.github.com/users/AaronO/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-19T15:08:42Z","updated_at":"2016-09-19T17:03:51Z","closed_at":null,"body":"We use BoltDB as an index and metadata store for a file cache, used as part of GitBook's hosting system.\r\n\r\nOne of the `edge` nodes crashed with a `SEGFAULT` after a few million requests. I've attached stacktraces below.\r\n\r\nIt fails with a `SEGFAULT` in `Tx.Commit()` -> [Bucket.spill()](https://github.com/boltdb/bolt/blob/05e441d7b3ded9164c5b912521504e7711dd0ba2/bucket.go#L598) -> [Node.write()](https://github.com/boltdb/bolt/blob/05e441d7b3ded9164c5b912521504e7711dd0ba2/node.go#L205)\r\n\r\n### Environment\r\n\r\n* Go: `1.7rc2`\r\n* BoltDB: `v1.2.1-5-g05e441d` - 05e441d7b3ded9164c5b912521504e7711dd0ba2\r\n* Storm: `97b157d5b760af7ddc878aca8b833de6fec335e8`\r\n\r\n### Screenshot\r\n\r\n<img width=\"1185\" alt=\"screen shot 2016-09-19 at 4 53 15 pm\" src=\"https://cloud.githubusercontent.com/assets/949223/18636564/9964b700-7e89-11e6-9dcf-cbfaf33b29aa.png\">\r\n\r\n### Pretty stacktrace\r\n\r\n```\r\n1: running [Created by edge.(*Refresher).loop @ .:0]\r\n    runtime    panic.go:566        throw(0xe94a1f, 0x5)\r\n    runtime    sigpanic_unix.go:27 sigpanic()\r\n    bolt       node.go:205         (*node).write(0xc427ed4c40, 0xc42c5ffff0)\r\n    bolt       bucket.go:598       (*Bucket).write(0xc427c3a700, 0xc425f01101, 0xc428b43158, 0x80)\r\n    bolt       bucket.go:506       (*Bucket).spill(0xc427c3a640, 0xc425f01000, 0xc428b433c8)\r\n    bolt       bucket.go:508       (*Bucket).spill(0xc427c3a600, 0xc425f00f00, 0xc428b43638)\r\n    bolt       bucket.go:508       (*Bucket).spill(0xc42a6dba58, 0x99a82de, 0x147ce80)\r\n    bolt       tx.go:163           (*Tx).Commit(0xc42a6dba40, 0, 0)\r\n    bolt       db.go:602           (*DB).Update(0xc4200de3c0, 0xc428b438e0, 0, 0)\r\n    storm      save.go:51          (*Node).Save(0xc4201a3620, 0xcda920, #9, 0x1, #9)\r\n    storm      save.go:113         (*DB).Save(#4, 0xcda920, #9, 0x3, #8)\r\n    macrophage index.go:108        thunderbolt.Set(0x134e4e0, #4, #8, 0x71, 0, 0, 0x60f, #2, #2, 0, ...)\r\n    macrophage macro.go:132        (*Macrophage).MetaSet(#3, #7, 0x1f, #10, 0x51, 0x60f, #2, #2, #6, 0x24, ...)\r\n    cache      write.go:67         CacheWriter.WriteMeta(#7, 0x1f, #10, 0x51, 0x134d760, #3, 0xc42c5ffd80, 0x60f, #1, #1, ...)\r\n    edge       refresher.go:109    (*Refresher).refresh(#5, #7, 0x1f, #10, 0x51, 0x60f, #1, #1, #6, 0x24, ...)\r\n    edge       refresher.go:179    (*Refresher).loop.func1(0xc4205fafc0, 0xc4205fafd0, 0xc42840e880, 0x71, #5, 0xc420054320)\r\n    runtime    asm_amd64.s:2086    goexit()\r\n```\r\n\r\n### Raw stacktrace\r\n\r\n```\r\nunexpected fault address 0xc42c600000\r\nfatal error: fault\r\n[signal SIGSEGV: segmentation violation code=0x1 addr=0xc42c600000 pc=0x877d46]\r\n\r\ngoroutine 57198547 [running]:\r\nruntime.throw(0xe94a1f, 0x5)\r\n\t/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0xc428b42d60 sp=0xc428b42d40\r\nruntime.sigpanic()\r\n\t/usr/local/go/src/runtime/sigpanic_unix.go:27 +0x288 fp=0xc428b42db8 sp=0xc428b42d60\r\ngithub.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt.(*node).write(0xc427ed4c40, 0xc42c5ffff0)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt/node.go:205 +0x86 fp=0xc428b42ef8 sp=0xc428b42db8\r\ngithub.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt.(*Bucket).write(0xc427c3a700, 0xc425f01101, 0xc428b43158, 0x80)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt/bucket.go:598 +0xb1 fp=0xc428b42f58 sp=0xc428b42ef8\r\ngithub.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt.(*Bucket).spill(0xc427c3a640, 0xc425f01000, 0xc428b433c8)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt/bucket.go:506 +0x101 fp=0xc428b431c8 sp=0xc428b42f58\r\ngithub.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt.(*Bucket).spill(0xc427c3a600, 0xc425f00f00, 0xc428b43638)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt/bucket.go:508 +0x937 fp=0xc428b43438 sp=0xc428b431c8\r\ngithub.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt.(*Bucket).spill(0xc42a6dba58, 0x99a82de, 0x147ce80)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt/bucket.go:508 +0x937 fp=0xc428b436a8 sp=0xc428b43438\r\ngithub.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt.(*Tx).Commit(0xc42a6dba40, 0x0, 0x0)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt/tx.go:163 +0x125 fp=0xc428b437f8 sp=0xc428b436a8\r\ngithub.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt.(*DB).Update(0xc4200de3c0, 0xc428b438e0, 0x0, 0x0)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/boltdb/bolt/db.go:602 +0x10d fp=0xc428b43848 sp=0xc428b437f8\r\ngithub.com/GitbookIO/cdn/vendor/github.com/asdine/storm.(*Node).Save(0xc4201a3620, 0xcda920, 0xc42a17a190, 0x1, 0xc42a17a190)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/asdine/storm/save.go:51 +0x271 fp=0xc428b43938 sp=0xc428b43848\r\ngithub.com/GitbookIO/cdn/vendor/github.com/asdine/storm.(*DB).Save(0xc420375560, 0xcda920, 0xc42a17a190, 0x3, 0xc428a4aa00)\r\n\t/go/src/github.com/GitbookIO/cdn/vendor/github.com/asdine/storm/save.go:113 +0x43 fp=0xc428b43970 sp=0xc428b43938\r\ngithub.com/GitbookIO/cdn/cache/macrophage.thunderbolt.Set(0x134e4e0, 0xc420375560, 0xc428a4aa00, 0x71, 0x0, 0x0, 0x60f, 0x57defcd8, 0x57defcd8, 0x0, ...)\r\n\t/go/src/github.com/GitbookIO/cdn/cache/macrophage/index.go:108 +0xaf fp=0xc428b439b0 sp=0xc428b43970\r\ngithub.com/GitbookIO/cdn/cache/macrophage.(*Macrophage).MetaSet(0xc4201a4940, 0xc42805d820, 0x1f, 0xc42a53f9e0, 0x51, 0x60f, 0x57defcd8, 0x57defcd8, 0xc42558b440, 0x24, ...)\r\n\t/go/src/github.com/GitbookIO/cdn/cache/macrophage/macro.go:132 +0x15b fp=0xc428b43a80 sp=0xc428b439b0\r\ngithub.com/GitbookIO/cdn/cache.CacheWriter.WriteMeta(0xc42805d820, 0x1f, 0xc42a53f9e0, 0x51, 0x134d760, 0xc4201a4940, 0xc42c5ffd80, 0x60f, 0x57def749, 0x57def749, ...)\r\n\t/go/src/github.com/GitbookIO/cdn/cache/write.go:67 +0x17c fp=0xc428b43b20 sp=0xc428b43a80\r\ngithub.com/GitbookIO/cdn/edge.(*Refresher).refresh(0xc4203815c0, 0xc42805d820, 0x1f, 0xc42a53f9e0, 0x51, 0x60f, 0x57def749, 0x57def749, 0xc42558b440, 0x24, ...)\r\n\t/go/src/github.com/GitbookIO/cdn/edge/refresher.go:109 +0x7ff fp=0xc428b43ec0 sp=0xc428b43b20\r\ngithub.com/GitbookIO/cdn/edge.(*Refresher).loop.func1(0xc4205fafc0, 0xc4205fafd0, 0xc42840e880, 0x71, 0xc4203815c0, 0xc420054320)\r\n\t/go/src/github.com/GitbookIO/cdn/edge/refresher.go:179 +0x12d fp=0xc428b43f70 sp=0xc428b43ec0\r\nruntime.goexit()\r\n\t/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc428b43f78 sp=0xc428b43f70\r\ncreated by github.com/GitbookIO/cdn/edge.(*Refresher).loop\r\n\t/go/src/github.com/GitbookIO/cdn/edge/refresher.go:182 +0x2dd\r\n```"},"comment":{"url":"https://api.github.com/repos/boltdb/bolt/issues/comments/248054125","html_url":"https://github.com/boltdb/bolt/issues/596#issuecomment-248054125","issue_url":"https://api.github.com/repos/boltdb/bolt/issues/596","id":248054125,"user":{"login":"benbjohnson","id":118015,"avatar_url":"https://avatars.githubusercontent.com/u/118015?v=3","gravatar_id":"","url":"https://api.github.com/users/benbjohnson","html_url":"https://github.com/benbjohnson","followers_url":"https://api.github.com/users/benbjohnson/followers","following_url":"https://api.github.com/users/benbjohnson/following{/other_user}","gists_url":"https://api.github.com/users/benbjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/benbjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbjohnson/subscriptions","organizations_url":"https://api.github.com/users/benbjohnson/orgs","repos_url":"https://api.github.com/users/benbjohnson/repos","events_url":"https://api.github.com/users/benbjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/benbjohnson/received_events","type":"User","site_admin":false},"created_at":"2016-09-19T17:03:51Z","updated_at":"2016-09-19T17:03:51Z","body":"@AaronO I wonder if it's related to https://github.com/golang/go/issues/16772 (which you mentioned in the asdine/store issue). The odd thing about it is that it sets `p.count` in `node.go` two lines above where it crashes when accessing `p.count`.\r\n\r\nCan you try this branch: https://github.com/benbjohnson/bolt/tree/596-node-count\r\n\r\nThe `p.count` read isn't necessary since it also has a reference to `len(n.inodes)`."}}
{"actor":{"display_login":"benbjohnson"}}