Closed ctwdtw closed 10 months ago
I also tested the example project with the following steps, and it crashed:
Release
Details
System Information
macOS Version 13.5 (Build 22G74) Xcode 14.3.1 (21815) (Build 14E300c) Timestamp: 2023-11-17T17:32:07+08:00
Hey,
Your code seems correct. Is the error detailed in https://github.com/Skyost/Bonsoir/issues/65#issuecomment-1816046858 the same you're describing in your first message ?
No, when using fvm flutter run -d <my_iPhone_device_id> --release
I did not get a crash stack trace. the app just crashed. I may need to install Crashlytic to dump the stack trace.
I guess the crash is because of the release build, that's why I tested the example project by changing EditScheme -> Run -> Build Configuration as Release
and to my surprise, it crashed right after I ran the example app.
I have pushed a repo so that you can reproduce the bug I described here https://github.com/Skyost/Bonsoir/issues/65#issue-1998247533
https://github.com/ctwdtw/bonsoir_report
please have a look, thanks.
Just tried to reproduce the bug thanks to your repo (https://github.com/ctwdtw/bonsoir_report), but the "push to background" - "pull into foreground" sequence doesn't seem to produce any crash, in debug mode at least.
Yes, it does not crash in debug mode. As I pointed out in step 3
of how to reproduce the bug:
fvm flutter run -d <my_iPhone_device_id> --release
, it did crash on release mode with the push to background
, and pull into foreground
sequence.
Just reproduced your bug, and I get the following message :
Unsupported value: -65569: Defunct connection of type __SwiftNativeNSerror
It seems that we're trying to send a __SwiftNativeNSerror
to the Dart side, which is causing a crash.
Hello, I encounter the following error when bringing my iOS application from the background to the foreground:
dnssd_clientstub write_all(22) DEFUNCT
dnssd_clientstub deliver_request ERROR: write_all(22, 88 bytes) failed
dnssd_clientstub write_all(22) DEFUNCT
After this, Bonsoir does not work properly. Is this a condition that needs to be managed, or is it a bug?
@olerhan I don't know about this one. Does it happen with the example app ?
Describe the bug Crash when pushing the app into the background and pulling it back into the foreground
To Reproduce Steps to reproduce the behavior:
final logger = Logger();
void main() { runApp(const BonsoirApp()); }
class BonsoirApp extends StatelessWidget { const BonsoirApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Simple Flutter App'), ), body: FutureBuilder( future: BonsoirDiscoverRepo.instance.init(), builder: (ctx, snapShot) { if (snapShot.connectionState == ConnectionState.done) { return const Text('discovering'); } else { return const Text('waiting'); } }, ), ), ); } }
class BonsoirDiscoverRepo { static BonsoirDiscoverRepo get instance { _instance ??= BonsoirDiscoverRepo._internal(); return _instance!; }
static BonsoirDiscoverRepo? _instance; BonsoirDiscovery? _discover;
BonsoirDiscoverRepo._internal();
Future init() async {
if (_discover == null) {
_discover = BonsoirDiscovery(type: '_http._tcp');
await _discover!.ready;
if (_discover!.eventStream == null) {
return;
}
_discover!.eventStream!
.where((event) => event.service?.name.contains('IGD-') ?? false)
.listen(
(event) async {
if (event.type == BonsoirDiscoveryEventType.discoveryServiceFound) {
event.service?.resolve(_discover!.serviceResolver);
} else if (event.type ==
BonsoirDiscoveryEventType.discoveryServiceResolved) {
logger.d('resolve: ${event.service?.toJson()}');
} else if (event.type ==
BonsoirDiscoveryEventType.discoveryServiceLost) {
logger.d('lost: ${event.service?.toJson()}');
}
},
);
await _discover!.start();
logger.d('start discover and put event to lower stream');
} else {
logger.d('already start discover');
}
}
}
Expected behavior Should not crash, when I comment out the code inside
Future<void> init() async {}
, it did not crashScreenshots N/A
Desktop (please complete the following information): Not Testing
Smartphone (please complete the following information):
Additional context I am not sure if I'm using Bonsoir in the correct way. My use case is the following:
MY_DEVICE_PREFIX
MY_DEVICE_PREFIX
(which could be none)If I understand Bonsoir's behavior correctly, I think the above requirements can be imp. as a singleton. However, even if I update Bonsoir to 4.0.0, the discovering behavior seems still not stable. I may open another issue to describe it. Thank you.