Closed Bug 1819161 Opened 1 year ago Closed 1 year ago

Glean iOS crash due to "unbalanced call to leave DispatchGroup"

Categories

(Data Platform and Tools :: Glean: SDK, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: travis_, Assigned: travis_)

References

Details

Attachments

(1 file)

The crash was brought to our attention here: https://github.com/mozilla-mobile/firefox-ios/issues/13374

I believe this may be the regressing commit: mozilla/glean@bc43f6f

I don't think we used DispatchGroup before this, and it would be the only thing I can think of that could fit in with the error message and the stacktrace.

After several attempts to reproduce this locally, I was finally able to do it. It seems there may be some race condition between force closing the app and relaunching it again.

I was only ever able to reproduce this a single time, on a fresh simulator where I hadn't run firefox before. After I was able to trigger it, I wasn't able to re-trigger it again for that simulator.

libdispatch.dylib`dispatch_group_leave.cold.1:
    0x115f4f5ab <+0>:  leaq   0x61be(%rip), %rcx        ; "BUG IN CLIENT OF LIBDISPATCH: Unbalanced call to dispatch_group_leave()"
    0x115f4f5b2 <+7>:  xorl   %eax, %eax
    0x115f4f5b4 <+9>:  movq   %rcx, 0x29c75(%rip)       ; gCRAnnotations + 8
    0x115f4f5bb <+16>: movq   %rax, 0x29c9e(%rip)       ; gCRAnnotations + 56
->  0x115f4f5c2 <+23>: ud2 

I have some suspicions as to why this might be happening, so I'm going to tinker around with a PR to try and address this even though it seems difficult to reproduce at the moment.

Assignee: nobody → tlong
Priority: -- → P1

The patch has landed that refactors the Glean HttpUploader to not use DispatchGroup, as well as attempting to simplify the overall uploading process.

I was able to test this locally in Firefox iOS and it seems to work quite well, so I'm going to call this resolved->Fixed and get a release out so that the fix can make its way downstream.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
See Also: → 1798576
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: