Skip to content
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

[Bugfix] Crashes when reading the body in Release configurations #97

Merged
merged 2 commits into from
Jan 3, 2022
Merged

[Bugfix] Crashes when reading the body in Release configurations #97

merged 2 commits into from
Jan 3, 2022

Conversation

ArnaudWurmel
Copy link
Contributor

@ArnaudWurmel ArnaudWurmel commented Apr 23, 2021

Fixes #96

Explanation

When the _value is set to a new value, the closure's parameter value is freed from memory. When this freed value was returned to the SelectorEventLoop, the app crashed.

To avoid this, I suggest to keep a strong reference to the value object, that way it won't be deleted.

@Goos
Copy link
Contributor

Goos commented May 17, 2021

Hey @ArnaudWurmel – thanks for looking into this, and sorry for not responding sooner.

Have you verified that this solves the crash you're seeing? I would have assumed that the value would live until the end of the closure as it being passed in as an argument should increment its retain count.

@ArnaudWurmel
Copy link
Contributor Author

Hey @Goos,

We were using this branch temporally and it allowed us to read the body without having crashes. However, we shortly faced another crash when we launches multiple uitests on iOS 14 (the crash occurs after ~15 tests).

We didn't explore much the second issue because it could come from our end since all Embassy tests passes.

I would have assumed that the value would live until the end of the closure as it being passed in as an argument should increment its retain count

I thought the same, when I was trying to debug this, I displayed the value at each step and after the assignment of the _value property, we couldn't access to the closure's parameter value anymore. So I come with this fix but the issue could be deeper than that.

@Goos
Copy link
Contributor

Goos commented May 18, 2021

@ArnaudWurmel I just merged another fix related causing a BAD_ACCESS of the body, would you mind testing the latest master and seeing if it fixed your crash?

@ArnaudWurmel
Copy link
Contributor Author

ArnaudWurmel commented May 18, 2021

I still do have the same issue, try to run the unit tests of Embassy (on xcode 12) in Release mode (Edit scheme > Embassy-iOS > Test > Info > Build Configuration = Release) and enable testability in release (Target Embassy-iOS > Build Settings > Enabled Testability > Release = Yes)

@dubadub
Copy link

dubadub commented Jan 3, 2022

@Goos are there any code issues we need to fix to merge this PR?

Re: cooklang/cookcli#33.

@geofstro
Copy link

geofstro commented Jan 3, 2022 via email

@Goos
Copy link
Contributor

Goos commented Jan 3, 2022

Sorry for the silence on this one folks. I haven't had time to dig any deeper into this issue since last time, but given that it's a small change and seems to work for the people trying it out, I'm going to go ahead and merge this.

@Goos Goos merged commit 287c134 into envoy:master Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crashes when reading the body in Release configurations
5 participants