-
Notifications
You must be signed in to change notification settings - Fork 258
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
std::thread crash on Android 4.x with overloaded new/delete operator #287
Comments
@DanAlbert : Any updates? |
No idea if this is the actual problem or not, but your example code is missing the overloaded operator delete[] taking std::nothrow_t as a parameter. If libc++'s implementation of std::thread is using that operator, then that would most definitely cause free() to crash. |
Its not an issue with missing operator delete[](void* ptr, const std::nothrow_t&). Crash logs from few 4.x devices (Full Logs Attached) ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// |
@DanAlbert : Do you require more info? |
No, I haven't had time to look at this and probably won't any time soon. |
@DanAlbert : Wondering if you can spare some time on this. |
I'll see if I can spare some time while waiting on tests/builds, but I have r14b and r15 beta 1 to worry about atm. I'll be taking a sweep through our open bugs between beta 1 and beta 2 (next month, unless I need to delay beta 1). (even if I did this right now, the fix wouldn't be in a stable release until June, which is the same if I were to look at it in April) |
@DanAlbert : Any updates? |
I'm looking at this now. |
Checked another couple versions to narrow down when this starts working. Fails on KitKat, passes on L MR1. |
This is looking like a platform bug in the linker. My current theory is that you're getting the replacement This sounds quite a bit like the bugs we were fixing in the linker for L, and the fact that switching to libc++_static makes the problem go away reinforces that hypothesis. I haven't been able to come up with a good test case to confirm this though. I'll dig around in the linker history later to see if I can find the bug describing this sort of problem. Unfortunately, if I'm right about the cause, there's not really anything we can do to fix this. You'll either have to switch to libc++_static or avoid replacing new/delete on pre-L. I don't know what your app is like, but the optimal model for native code in an Android app is to have a single shared library in your app (lets ld eliminate the most code and avoids most of the strange device issues like this one), so unless you have some third-party middleware that's only provided as a shared library, that might be worth looking in to. |
Thanks for the update. This does sound like a linker bug. |
https://android-review.googlesource.com/c/105825 The former, I believe. This isn't possible to fix or workaround as far as I know, so closing :( |
(no workaround that doesn't involve libc++_static, anyway) |
Description
App crashes with the usage of std::thread (libc++_shared.so) when used in conjunction with overloaded new/delete operator. Sample gradle project attached for reference.
Note that the crash is only observer on Android 4.x devices.
Environment Details
AndroidCrash.zip
The text was updated successfully, but these errors were encountered: