Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jason-simmons
Copy link
Member

No description provided.

@jason-simmons
Copy link
Member Author

@eseidelGoogle
Copy link
Contributor

As a crash mitigation this seems OK. Ideally we'd have tests. We might also want to consider throwing exceptions or queuing.

@collinjackson this was showing up in Posse's app as random crashers when the Firebase Datastore plugin would attempt to deliver messages to Dart while the FlutterView was detached (generally on an idle wake where java was faster than the FlutterView, etc.)

@mravn-google you should be aware of this hole in the plugin architecture. Messages can attempt to send messages to detached (backgrounded, screen off, etc.) FlutterView's and previously they would just crash with a null pointer SIGSEGV. This changes that behavior to log, but the message is still lost.

FYI @lukef

Copy link
Contributor

@eseidelGoogle eseidelGoogle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a mitigation for our immediate crasher seen in live apps, lgtm. I expect we'll need more work here.

@jason-simmons jason-simmons merged commit 232f463 into flutter:master Jul 27, 2017
@Hixie
Copy link
Contributor

Hixie commented Jul 27, 2017

Please add a test if possible.

Please file a bug to track replacing the log with an improvement to the protocol.

@mravn-google
Copy link
Contributor

Is this issue Android only, or do we have the same problem on iOS?

@eseidelGoogle
Copy link
Contributor

eseidelGoogle commented Jul 27, 2017

This was a quick workaround for a crash in production apps. @jason-simmons's analysis of the underlying issue in at least one of the production apps:

The Firebase plugin registers for notifications about data changes, but it doesn't unregister when the associated instance of Flutter is destroyed. When a notification arrives via a cloud message, the plugin will try to notify the app by calling send() on the defunct FlutterView. FlutterView didn't guard against this, resulting in a segfault.

The current workaround will log a warning and then ignore an attempt to send a message to a Flutter engine that is no longer running. Later we will need a way to close the Firebase subscriptions that are no longer needed.

Thanks again for the quick turnaround.

@eseidelGoogle
Copy link
Contributor

@mravn-google I suspect we may be leaking firebase registrations everywhere, but we've only seen the crash reported on iOS. Unclear why.

@mravn-google
Copy link
Contributor

iOS? This change is on the Android side.

@eseidelGoogle
Copy link
Contributor

Sorry, I meant "only reported on Android".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants