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

Added speculative fix for invalid memory access when app is in background #3

Merged
merged 1 commit into from
Mar 23, 2021

Conversation

wemstad
Copy link
Contributor

@wemstad wemstad commented Mar 18, 2021

This is a speculative fix for solving the issue regarding the invalid memory in #2

Theory

When the App is in the background at least 2 events get logged with the completionBlock in PeachCollectorQueue.m:

        dispatch_async(dispatch_get_main_queue(), ^{
            if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive
                && [addedEvent shouldBeFlushedWhenReceivedInBackgroundState]) {
                [self flush];
            }
        
            [self checkPublishers];
        });

this codeblock then gets added to the queue multiple times, same as the number of events.
When the first queue later gets to the first event everything works. However, somewhere in the flush or checkPublishers call the second event get processed and deleted.
When the queue then gets to processing the second event the addedEvent object is nil, causing the shouldBeFlushedWhenReceivedInBackgroundState to crash.

Haven't been able to replicate this, therefore its purely speculative but I think it's worth trying to see if this solves our crashes

@RayanArnaout RayanArnaout merged commit 7da3750 into ebu:develop Mar 23, 2021
@wemstad wemstad deleted the develop branch March 23, 2021 07:50
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.

2 participants