Title: Segmentation faults with concurrent access? · Issue #104 · nodegit/nodegit · GitHub
Open Graph Title: Segmentation faults with concurrent access? · Issue #104 · nodegit/nodegit
X Title: Segmentation faults with concurrent access? · Issue #104 · nodegit/nodegit
Description: Hello again! While developing https://github.com/papandreou/node-gitfakefs I stumbled upon what seems to be a bug in nodegit caused by calling the library asynchronously without waiting for the previous operation to finish. The problem i...
Open Graph Description: Hello again! While developing https://github.com/papandreou/node-gitfakefs I stumbled upon what seems to be a bug in nodegit caused by calling the library asynchronously without waiting for the pre...
X Description: Hello again! While developing https://github.com/papandreou/node-gitfakefs I stumbled upon what seems to be a bug in nodegit caused by calling the library asynchronously without waiting for the pre...
Opengraph URL: https://github.com/nodegit/nodegit/issues/104
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Segmentation faults with concurrent access?","articleBody":"Hello again!\n\nWhile developing https://github.com/papandreou/node-gitfakefs I stumbled upon what seems to be a bug in nodegit caused by calling the library asynchronously without waiting for the previous operation to finish.\n\nThe problem is triggered by a specific test in my test suite, and I was able to get a backtrace with gdb:\n\n```\nandreas@andreas-ThinkPad-T500:~/work/node-gitfakefs$ gdb --args ./node_modules/mocha/bin/mocha\nGNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04\nCopyright (C) 2012 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later \u003chttp://gnu.org/licenses/gpl.html\u003e\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\nThis GDB was configured as \"i686-linux-gnu\".\nFor bug reporting instructions, please see:\n\u003chttp://bugs.launchpad.net/gdb-linaro/\u003e...\n\"/home/andreas/work/node-gitfakefs/node_modules/mocha/bin/mocha\": not in executable format: File format not recognized\n(gdb) run\nStarting program: /home/andreas/.local/bin/node ./node_modules/mocha/bin/mocha\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library \"/lib/i386-linux-gnu/libthread_db.so.1\".\n[New Thread 0xb7fdab40 (LWP 32315)]\n\n ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․\nProgram received signal SIGSEGV, Segmentation fault.\n0xb7fdd424 in __kernel_vsyscall ()\n(gdb) backtrace\n#0 0xb7fdd424 in __kernel_vsyscall ()\n#1 0xb7cf2526 in kill () from /lib/i386-linux-gnu/libc.so.6\n#2 0x08206efc in uv_kill (pid=32314, signum=11) at ../deps/uv/src/unix/process.c:434\n#3 0x081a1031 in node::Kill(v8::Arguments const\u0026) ()\n#4 0x083100d9 in v8::internal::Builtin_HandleApiCall(v8::internal::(anonymous namespace)::BuiltinArguments\u003c(v8::internal::BuiltinExtraArguments)1\u003e, v8::internal::Isolate*) ()\n#5 0x4360a336 in ?? ()\n#6 0x4362a97c in ?? ()\n#7 0x50f12c3c in ?? ()\n#8 0x4360db41 in ?? ()\n#9 0x4362d328 in ?? ()\n#10 0x4360db41 in ?? ()\n#11 0x43621c32 in ?? ()\n#12 0x43612c2a in ?? ()\n#13 0x0833021d in v8::internal::Invoke(bool, v8::internal::Handle\u003cv8::internal::JSFunction\u003e, v8::internal::Handle\u003cv8::internal::Object\u003e, int, v8::internal::Handle\u003cv8::internal::Object\u003e*, bool*) ()\n#14 0x08331962 in v8::internal::Execution::Call(v8::internal::Handle\u003cv8::internal::Object\u003e, v8::internal::Handle\u003cv8::internal::Object\u003e, int, v8::internal::Handle\u003cv8::internal::Object\u003e*, bool*, bool) ()\n#15 0x082f396e in v8::Function::Call(v8::Handle\u003cv8::Object\u003e, int, v8::Handle\u003cv8::Value\u003e*) ()\n#16 0x081a2d45 in node::EmitExit(v8::Handle\u003cv8::Object\u003e) ()\n#17 0x081a3fe2 in node::Start(int, char**) ()\n#18 0x081986bb in main ()\n```\n\nTo reproduce it, clone papandreou/node-gitfakefs@613d0f16, `npm link` it against nodegit master, then run: `mocha -g glob`. That causes the segmentation fault at least half of the time.\n\nThe test has a lot of moving parts. I tried to narrow it down further, but I've been unsuccessful so far. I wanted to raise the issue here before spending more time on it, as one of you guys might immediately go ah-hah! when seeing that stacktrace.\n\nThe reason why I know it's related to concurrent access is that I found a workaround in papandreou/node-gitfakefs@358eac4: It's wrapping accesses to nodegit in a mutex.\n\nWhile debugging the issue I've also seen these weird errors, which seem to bear witness to some kind of memory corruption:\n\n```\n 1) GitWrappedFs patching the built-in fs module \"in-place\" should make the glob work on the contents directory:\n Error: @��@��e 'refs/heads/d35056a9711a2497e8c6a957fa6f0d13cb94f8b1' not found\n\n 1) GitWrappedFs patching the built-in fs module \"in-place\" should make the glob work on the contents directory:\n Error: Failed to open '/home/andreas/work/node-gitfakefs/test/testrepo.git/packed-refs': No such file or directory\n```\n\nLet me know if there's anything else I can do at this point.\n","author":{"url":"https://github.com/papandreou","@type":"Person","name":"papandreou"},"datePublished":"2013-10-07T16:15:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/104/nodegit/issues/104"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4502d4dc-846a-d3f9-5dd3-8de1cf31bebd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2B0:246CE:78E2683:A18EBFB:6A5E1ABD |
| html-safe-nonce | 416d8e79e2da07ad0d79dde09d12935af07edb1be3c6fe1213546105dd215098 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkIwOjI0NkNFOjc4RTI2ODM6QTE4RUJGQjo2QTVFMUFCRCIsInZpc2l0b3JfaWQiOiI0MzczNzk3OTEzNTE0MzUxMjkzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dedf11c2ae88f089fa8199a8d7ebbb931992fdcd400434ec7976c15db4d7e658 |
| hovercard-subject-tag | issue:20621802 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodegit/nodegit/104/issue_layout |
| twitter:image | https://opengraph.githubassets.com/262a9693283d8c4045cd11f9a2c84f248fc407a59c804771c05a6c459b097947/nodegit/nodegit/issues/104 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/262a9693283d8c4045cd11f9a2c84f248fc407a59c804771c05a6c459b097947/nodegit/nodegit/issues/104 |
| og:image:alt | Hello again! While developing https://github.com/papandreou/node-gitfakefs I stumbled upon what seems to be a bug in nodegit caused by calling the library asynchronously without waiting for the pre... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | papandreou |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a60e060dad2c24f72179d36247204b454da37845d1728020cd42046a433f87f |
| turbo-cache-control | no-preview |
| go-import | github.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git |
| octolytics-dimension-user_id | 657068 |
| octolytics-dimension-user_login | nodegit |
| octolytics-dimension-repository_id | 1383170 |
| octolytics-dimension-repository_nwo | nodegit/nodegit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1383170 |
| octolytics-dimension-repository_network_root_nwo | nodegit/nodegit |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0ae7f3ea7b1bb2f1f4623bb093bbf54cee05d830 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width