-
Notifications
You must be signed in to change notification settings - Fork 588
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
Fatal Exception: std::__1::system_error mutex lock failed: Invalid argument #892
Comments
This is likely happening during the system teardown when application is closing, so I don't think crash is relevant. |
@zhfeng20108 Are you still having this problem? Can you reproduce this issue? |
Wait, this is an error in mutex locking? That is almost certainly a heap corruption. It's crashing at this line, but the reason it is crashing is that the mutex has been stomped by some other code. Historically, TextKit has had lots of hidden thread-safety issues despite being stated as thread safe. CK locks around all access to TextKit, but there are still issues that have cropped up in the recent past. We built the same text locking system in both CK and ASDK, and they both work this way. Are there any other users of CK that run into the same issue? If so, then it's possible that there's a stomper inside the TextKit wrappers in CK itself (though, I doubt that). If this is only happening in your app, then it's possible that your app is stomping the memory through an unprotected access. (disclaimer, I don't work on CK anymore, just an avid observer. I won't be able to help with any actual fixes) |
Oh god, wait, someone should check that the static mutex in the TextKit impl isn't susceptible to the static destructor fiasco. cc @adamjernst who will be able to check. That would probably manifest in this way if one thread is attempting to tear down while another thread tries to lock, right? |
Specifically this line: https://github.com/facebook/componentkit/blob/master/ComponentTextKit/TextKit/CKTextKitContext.mm#L33 I'd appreciate @adamjernst or @eczarny checking on me that that line is correct, and won't crash on exit(). |
OK, looks like std::mutex is not trivially destructible in Clang, so we should probably just leak that mutex. Anyway, I believe this crash is happening on exit() as @gkassabli said above, so it probably has no impact on user experience. |
…ructor fiasco I haven't tested this code, but this is what I would try to resolve facebook#892. Someone should run some smoke tests with something like the above
…ructor fiasco Summary: OSS CK is crashing on the exit. The probable cause is that it is static mutex is destroyed at the same time when another thread tries to lock it. This diff leaks the mutex in order to avoid that crash I haven't tested this code, but this is what I would try to resolve #892. Someone should run some smoke tests with something like the above Closes #906 Reviewed By: kfirapps Differential Revision: D7616427 Pulled By: gkassabli fbshipit-source-id: fe4d9fc1add8228d3bd672f853cca8d54a02bc58
The text was updated successfully, but these errors were encountered: