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
[SR-7743] JSONDecoder.decode<A>(_:from:) EXC_BAD_ACCESS #50283
Comments
This looks like a compiler or runtime bug. What compiler version are you using? Can you attach your project? Does the crash happen in optimized, unoptimized, or both builds? |
Comment by Garric Nahapetian (JIRA) Thank you so much for replying. Xcode 9.3, Swift 4.1, and optimized. Unfortunately, I cannot attach the project. Let me know if there is anything else I can provide. I am not able to repo locally. I am seeing this crash via crashlytics. I've attached the stack trace for one instance. |
Does it also reproduce if you disable optimization, like in a debug build? |
Comment by Garric Nahapetian (JIRA) I am not able to reproduce it locally. Also, I tried running it locally with optimization disabled was not able to reproduce. I will try to put an unoptimized build out into the wild and see if the crash still occurs. Thank you. |
cc aschwaighofer@apple.com (JIRA User) Thanks for checking! You might be able to narrow down the problem by selectively disabling optimization on the part of your program that's crashing, which might help you find a smaller test case that you would be able to share with us for debugging purposes. You can use the |
Comment by Sebastian Skuse (JIRA) Hi, We're seeing the same issue as above being reported in Crashlytics after compiling with Swift 4.1 / Xcode 9.3. I've been unable to reproduce with debug builds, playgrounds or with optimisation switched on. All the crashes seem to occur as above - JSONDecoder attempts to unbox a custom object conforming to Codable and eventually crashes inside swift_getEnumCaseSinglePayload / swift_storeEnumTagSinglePayload. A crashlog can be found here: https://gist.github.com/sebskuse/e3531fc49ef6b5162f6614b3e86f2708 |
Comment by Garric Nahapetian (JIRA) I was able to put out a beta build with optimization disabled SWIFT_OPTIMIZATION_LEVEL = "-Onone" for the entire project, and the crash manifested. I've attached the stack trace (stack-trace-2.txt). |
Here is a tiny project that allow you to reproduce the crash. https://github.com/stoyanmar/CodableTest You will have to be using Xcode 9.3 or 9.4; the issue is gone in Xcode 10 beta 1. Turning on Whole Module Optimization for Debug configuration avoids the crash. |
Thanks @mattneub! I was helping Garric in the WWDC labs last week, and IIRC he said the crash in his case was still manifesting in Xcode 10 beta 1, so your crash might be a different issue we've since fixed. |
@jckarter For the github project I pointed to, even "regressing" to the legacy build system does not elicit the crash on Xcode 10 beta 1, so it may be well and truly fixed — and, as you say, may be unrelated to the actual issue the original bug was about. The crash I'm talking about is still a real bug in Xcode 9.3 and 9.4 but I guess there's no point separating it out, as there will presumably never be a further update along that branch. |
Comment by Deepak (JIRA) We are seeing the same issue with Xcode 9.4 and Swift 4.1 |
This has been fixed in this PR: #17880 |
Comment by Garric Nahapetian (JIRA) Thank you, @mikeash! |
Glad to be of service! |
Comment by Amber Katyal (JIRA) Issue still reproducible. Temporarily fixed by enabling whoe module optimization. Changed data type from Int? to Float? |
Attachment: Download
Additional Detail from JIRA
md5: b32e244200b8433066d03e525109da3c
is duplicated by:
relates to:
Issue Description:
I'm seeing the following two crashes (portions redacated):
For each crash, the last line of my code that is being run is the same; its the following try:
Based on my crash reports, it appears the crash stems from inside the swift decoding process.
Is this a bug in Swift? If not, what is the crash trying to tell me? What hints can I get from "swift_storeEnumTagSinglePayload" and "swift_getEnumCaseSinglePayload"?
Any help would be greatly appreciated. Thank you!
Link to related Twitter thread: https://twitter.com/garricn/status/999053291689361409
The text was updated successfully, but these errors were encountered: