Page MenuHomePhabricator

[native] FIXED: Overlay navigator crashes when we open too many overlays at the same time.
ClosedPublic

Authored by przemek on Oct 20 2022, 9:15 AM.
Tags
None
Referenced Files
F3274882: D5442.diff
Sat, Nov 16, 6:49 AM
Unknown Object (File)
Sat, Nov 9, 11:04 PM
Unknown Object (File)
Sat, Nov 2, 8:58 PM
Unknown Object (File)
Sat, Nov 2, 8:58 PM
Unknown Object (File)
Sat, Nov 2, 8:58 PM
Unknown Object (File)
Sat, Nov 2, 8:58 PM
Unknown Object (File)
Sat, Nov 2, 8:58 PM
Unknown Object (File)
Sat, Nov 2, 8:58 PM

Details

Summary

Fixed this issue: https://linear.app/comm/issue/ENG-2090/overlay-navigator-crashes-when-we-open-too-many-overlays-at-the-same
Talked with Ashoat and added if statement to prevent cleaning scene data few times.
Left invariant inside if statement just for sanity checks. If should be deleted let me know.

Test Plan

Build app.
Tried to reproduce crash, but unsuccessfully.

Diff Detail

Repository
rCOMM Comm
Branch
fix/app_crash
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

przemek added 1 blocking reviewer(s): ashoat.
przemek edited the summary of this revision. (Show Details)
Harbormaster returned this revision to the author for changes because remote builds failed.Oct 20 2022, 9:19 AM
Harbormaster failed remote builds in B12937: Diff 17737!
ashoat requested changes to this revision.Oct 20 2022, 11:25 AM
ashoat added inline comments.
native/navigation/overlay-navigator.react.js
289 ↗(On Diff #17737)

Early exit please!! We don't need to increase indentation

290–293 ↗(On Diff #17737)

This doesn't need to exist anymore

This revision now requires changes to proceed.Oct 20 2022, 11:25 AM

Return early. Removed unneccessary invariant.

tomek requested changes to this revision.Oct 21 2022, 2:35 AM
tomek added inline comments.
native/navigation/overlay-navigator.react.js
289–291 ↗(On Diff #17797)

This doesn't seem to be correct. We were making sure that newVisibleOverlays.length < curVisibleOverlays.length - if that was the case, we were continuing. Otherwise, we were crashing the app.
In this new approach, we continue to execute the code when we were previously crashing, and we return when we were continuing.

This revision now requires changes to proceed.Oct 21 2022, 2:35 AM

It seems like the initial revision got this right and then updated revision inverted the logic. It is always a good idea to test the code after every change.

Abolutely right, sorry for that. I missed the logic inversion in that case.

Another one, realised, I should have used >= instead of >

tomek added inline comments.
native/navigation/overlay-navigator.react.js
289 ↗(On Diff #17799)

It doesn't seem possible that filtering an array would result in array longer than the original one, so it should be enough to test for equality.

@przemek, strongly suggest reviewing your diff via git diff before putting it on Phabricator in the future. All 4 of these issues (all of them except my first feedback) could probably have been spotted by you if you just closely looked at the code you are submitting.

One inline comment left... please address before landing

native/ios/Podfile.lock
1325 ↗(On Diff #17801)

Please revert this change and upgrade your version of Cocoapods

This revision is now accepted and ready to land.Oct 21 2022, 5:36 AM
przemek marked an inline comment as done.

Updated cocoapods