Closed monzim closed 6 months ago
@monzim, thanks for raising ๐๐ผ . It looks like this is a duplicate of https://github.com/appwrite/sdk-for-flutter/issues/200 so I'm going to close it as so.
@monzim, thanks for raising ๐๐ผ . It looks like this is a duplicate of #200 so I'm going to close it as so.
After making some changes to the _createSocket
and the _cleanup
methods in the /realtime_mixin.dart
file, the error has been resolved. This worked for me.
Can I make a pull request to incorporate these changes? I guess this repo is readonly. If so, how can I proceed?
๐ Reproduction steps
Create a Flutter project and integrate the Appwrite SDK. Set up real-time subscriptions using RealtimeMixin.subscribeTo. The error occurs intermittently, particularly when subscriptions are being closed or created while the _createSocket method is running.
๐ Expected behavior
I'm encountering a "Concurrent modification during iteration: _Map len:0" error when using the Appwrite Flutter SDK for real-time subscriptions. This error seems to be originating within the RealtimeMixin._createSocket method (line 91).
The error appears to be related to concurrent access to the _subscriptions map within the RealtimeMixin. This issue causes the app to crash unexpectedly, disrupting the real-time functionality.
๐ Actual Behavior
The app crashes: The "Unhandled Exception: Concurrent modification during iteration" is a critical error. In most cases, this would lead to an immediate crash of the Flutter application.
Disrupted real-time updates: The error originates from the RealtimeMixin, which is responsible for managing real-time data updates. So, even before the potential crash, the functionality related to receiving and handling real-time events would likely be disrupted.
Difficulty pinpointing the issue: The stack trace points to the Appwrite SDK's internal code. This makes it challenging for developers to directly diagnose and fix the issue, as it might require modifications to the SDK itself.
๐ฒ Appwrite version
Version 1.0.x
๐ป Operating system
MacOS
๐งฑ Your Environment
๐ Have you spent some time to check if this issue has been raised before?
๐ข Have you read the Code of Conduct?