You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MessagingService._delete() method in the Firebase Messaging SDK has a memory leak issue where resources are not properly cleaned up when the service is deleted.
Root Cause
The current implementation of MessagingService._delete() only returns Promise.resolve() without cleaning up:
Timer leak: The logging service starts a recursive setTimeout loop via _processQueue() that continues indefinitely
Event listener leak: Event listeners added in factory functions are never removed
Missing cleanup: No cleanup of message handlers, log events, or service worker references
Impact
Memory leaks when Firebase messaging service is deleted
Bug Description
The
MessagingService._delete()
method in the Firebase Messaging SDK has a memory leak issue where resources are not properly cleaned up when the service is deleted.Root Cause
The current implementation of
MessagingService._delete()
only returnsPromise.resolve()
without cleaning up:setTimeout
loop via_processQueue()
that continues indefinitelyImpact
Affected Code
packages/messaging/src/messaging-service.ts
-_delete()
methodpackages/messaging/src/helpers/logToFirelog.ts
-_processQueue()
timer managementpackages/messaging/src/helpers/register.ts
- Event listener registrationComparison with Other Services
Other Firebase services like
AppCheckService
properly clean up their resources in_delete()
methods by removing listeners and clearing state.Proposed Solution
Implement proper resource cleanup in
MessagingService._delete()
including:Environment
The text was updated successfully, but these errors were encountered: