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
[iOS] App crash on websocket close if app was in background for long-term #84499
Comments
The minimal workaround is adding import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
signal(SIGPIPE, SIG_IGN);
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
} |
/cc @aam - we should make sure that we suppress |
I was unable to replicate after keeping app in background for around ~3 to 5 and ~8 to 10 mins. Labeling it based on above comment. |
@darshankawar did you see the next line in
Also, I found how to speed up the crash reproduction - lock the screen of the iPhone (sometimes several times). Here is how it looks like: |
We already do that on a server side of a socket https://github.com/dart-lang/sdk/blob/master/runtime/bin/socket_macos.cc#L149, but not on a client side. |
Two things needs clarification:
Of course, ios might be special(than mac/linux), but that is puzzling. |
@aam I'd guess that |
ah, true @mraleph , it only seems to be invoked from standalone embedder/tester/gen_snapshotter. Second question remains - it would be nice to understand how to repro this on mac/linux. |
@aam as for removing code that ignores SIGPIPE and absent crashed, maybe it is because of |
sorry @ycherniavskyi on macos for my tests I removed that code too. On linux we don't do this |
@aam to be precise I want to mention that in my case the app crashed on () async {
print('>>> wscrash add');
ws.add('test');
print('>>> wscrash delayed');
await Future<void>.delayed(Duration(seconds: 3));
print('>>> wscrash closing');
await ws.close();
print('>>> wscrash closed');
} App output |
Yes @ycherniavskyi , similar to |
…nnect code. Fixes flutter/flutter#84499 TEST=socket_sigpipe_test.dart Change-Id: I220558e74b41c1969efa422254867c11dd17ee91 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203660 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
The fix rolled into flutter master in e57d97a |
…nnect code. Fixes flutter/flutter#84499 TEST=socket_sigpipe_test.dart Change-Id: I220558e74b41c1969efa422254867c11dd17ee91 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203660 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
flutter create wscrash
main.dart
with next code:flutter run --release
Connect to WebSocket
buttonExpected results: the app is open then timer handler triggered and close WebSocket without error
Actual results: the app is open then timer handler triggered but on close WebSocket it crashed
Logs
Some lines from app Console log
As a temporary solution works suggestion from #47203 (comment) (which based on section
Handle or disable SIGPIPE
from Apple Avoiding Common Networking Mistakes).Also this #71979 seems related.
The text was updated successfully, but these errors were encountered: