Open kostadin24 opened 1 year ago
Sadly I don't have time to work on this now, but just out of interest, is this Windows 11?
Windows 10
Hello! I'm not sure if it's the same problem, but I also experience crashes daily. About 14% of users encounter at least one crash every day. I don't have extensive details regarding the issue, but the Microsoft Partner Center has provided this stack trace:
Frame | Image | Function | Offset |
---|---|---|---|
0 | flutter_windows.dll | - | 0x0000000000001F5E |
1 | flutter_windows.dll | - | 0x0000000000000014 |
2 | nsd_windows_plugin.dll | - | 0x0000000000013ABD |
3 | nsd_windows_plugin.dll | - | 0x0000000000005F8A |
4 | nsd_windows_plugin.dll | - | 0x0000000000006761 |
5 | nsd_windows_plugin.dll | - | 0x00000000000056D6 |
6 | dnsapi.dll | BrowseContext::InvokeCallback | 0x0000000000020410 |
7 | dnsapi.dll | WnfParams::StaticCallback | 0x0000000000000141 |
8 | ntdll.dll | RtlpWnfWalkUserSubscriptionList | 0x000000000000024E |
9 | ntdll.dll | RtlpWnfProcessCurrentDescriptor | 0x000000000000010A |
10 | ntdll.dll | RtlpWnfNotificationThread | 0x0000000000000084 |
11 | ntdll.dll | TppExecuteWaitCallback | 0x00000000000000AE |
12 | ntdll.dll | TppWorkerThread | 0x000000000000072C |
13 | kernel32.dll | BaseThreadInitThunk | 0x000000000000001D |
14 | ntdll.dll | RtlUserThreadStart | 0x0000000000000028 |
I can also provide a minidump if necessary. Please let me know how I can assist further. :)
It's a shame the "Function" column is empty for the plugin stack frames, that would definitely help a lot. Does your minidump contain any information about that?
I've never used minidump before today, so I'm not sure if I'm using it correctly. I also generated a pdb file (though I'm uncertain if I did it correctly as well) and injected it into WinDbg. Here's the stack trace I obtained:
0:022> kb
# RetAddr : Args to Child : Call Site
00 00007ffc`137ffcc9 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!NtWaitForMultipleObjects+0x14
01 00007ffc`137ffbce : 00000000`00000628 00000000`00000096 00000000`d000022d 00000000`d000022d : KERNELBASE!WaitForMultipleObjectsEx+0xe9
02 00007ffc`157627f7 : 00000000`00000000 00000000`00000001 00000009`27dfda50 00000000`00000096 : KERNELBASE!WaitForMultipleObjects+0xe
03 00007ffc`15762236 : 00000000`00000000 00000000`00000000 00000000`00000003 00007ffc`156f0000 : kernel32!WerpReportFaultInternal+0x587
04 00007ffc`138fc90b : 00000000`00000000 00000009`27dff4c0 00000000`00000001 00000000`00000000 : kernel32!WerpReportFault+0xbe
05 00007ffc`1639625b : 00000000`00000000 00007ffc`138fc530 00000009`27dff4fc 00000000`00000000 : KERNELBASE!UnhandledExceptionFilter+0x3db
06 00007ffc`16396d72 : 00007ffc`163cff10 00000009`27dff4c0 00000000`0000072c 00000009`27dfdbe8 : ntdll!TppExceptionFilter+0x7f
07 00007ffc`16317780 : 00007ffc`163cff10 00000000`00000008 00000000`00000000 00000000`00000000 : ntdll!TppWorkerpInnerExceptionFilter+0x1a
08 00007ffc`162ff027 : 00007ffc`162a57ac 00007ffc`16290b4a 00007ffc`16270000 00007ffc`162a57ac : ntdll!TppWorkerThread$filt$2+0x19
09 00007ffc`1630ece6 : 00007ffc`163cfff0 00000009`27dfe730 00000009`27dff4c0 00007ffc`121b8000 : ntdll!_C_specific_handler+0x97
0a 00007ffc`1631426f : 00000000`00000000 00000009`27dfe050 00000009`27dfe730 00000000`00000000 : ntdll!_GSHandlerCheck_SEH+0x6a
0b 00007ffc`1628e456 : 00000009`27dfe730 00007ffc`16270000 00007ffc`162a57ac 00007ffc`163fca10 : ntdll!RtlpExecuteHandlerForException+0xf
0c 00007ffc`1631325e : 00000000`00000002 008000a0`000dee72 000001b2`df94a240 000001b2`e6fe6220 : ntdll!RtlDispatchException+0x286
0d 00007ffb`85f9261a : 000001b2`dcb8614f 00007ffb`ef0e4235 00000000`0000009a 00007ffc`00000000 : ntdll!KiUserExceptionDispatch+0x2e
0e 00007ffb`85f90512 : 00000009`27dfec18 00007ffb`ef0f1000 000001b2`00000003 00007ffb`ef0e9cb0 : flutter_windows!FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable+0x1f5e
0f 00007ffb`ef0e521d : 00000000`0000001f 00000000`0000000f 00000009`27dfed28 00007ffb`ef0d5184 : flutter_windows!FlutterDesktopMessengerSend+0x14
10 00000000`0000001f : 00000000`0000000f 00000009`27dfed28 00007ffb`ef0d5184 00000000`00000020 : nsd_windows_plugin!std::vector<flutter::EncodableValue,std::allocator<flutter::EncodableValue> >::_Emplace_one_at_back<flutter::EncodableValue>+0x5d
11 00000000`0000000f : 00000009`27dfed28 00007ffb`ef0d5184 00000000`00000020 00000000`00000005 : 0x1f
12 00000009`27dfed28 : 00007ffb`ef0d5184 00000000`00000020 00000000`00000005 000001b2`d98f8760 : 0xf
13 00007ffb`ef0d5184 : 00000000`00000020 00000000`00000005 000001b2`d98f8760 00000000`00000000 : 0x00000009`27dfed28
14 00000000`00000020 : 00000000`00000005 000001b2`d98f8760 00000000`00000000 000001b2`d7ff2e50 : nsd_windows_plugin!std::_Variant_raw_visit1<2>::_Visit<std::_Variant_construct_visitor<std::monostate,bool,int,__int64,double,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<unsigned char,std::allocator<unsigned char> >,std::vector<int,std::allocator<int> >,std::vector<__int64,std::allocator<__int64> >,std::vector<double,std::allocator<double> >,std::vector<flutter::EncodableValue,std::allocator<flutter::EncodableValue> >,std::map<flutter::EncodableValue,flutter::EncodableValue,std::less<flutter::EncodableValue>,std::allocator<std::pair<flutter::EncodableValue const ,flutter::EncodableValue> > >,flutter::CustomEncodableValue,std::vector<float,std::allocator<float> > >,std::_Variant_storage_<0,std::monostate,bool,int,__int64,double,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<unsigned char,std::allocator<unsigned char> >,std::vector<int,std::allocator<int> >,std::vector<__int64,std::allocator<__int64> >,std::vector<double,std::allocator<double> >,std::vector<flutter::EncodableValue,std::allocator<flutter::EncodableValue> >,std::map<flutter::EncodableValue,flutter::EncodableValue,std::less<flutter::EncodableValue>,std::allocator<std::pair<flutter::EncodableValue const ,flutter::EncodableValue> > >,flutter::CustomEncodableValue,std::vector<float,std::allocator<float> > > const & __ptr64>+0x1b4
15 00000000`00000005 : 000001b2`d98f8760 00000000`00000000 000001b2`d7ff2e50 00007ffb`ef0d76ea : 0x20
16 000001b2`d98f8760 : 00000000`00000000 000001b2`d7ff2e50 00007ffb`ef0d76ea 00000000`00000000 : 0x5
17 00000000`00000000 : 000001b2`d7ff2e50 00007ffb`ef0d76ea 00000000`00000000 00000009`27dfecd0 : 0x000001b2`d98f8760
Minidump attached 8dc6aa84-36e5-4d7d-9762-8308b0de8952.ext.zip
I got this when I run my app on Windows after importing nsd package Not sure it's useful
[ERROR:flutter/shell/common/shell.cc(1004)] The 'com.haberey/nsd' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
@gomaze0906 ok that might actually help, I'll at least have a glance over the Windows platform code this weekend, see if anything looks suspicious!
I've looked at the Windows code and it seems that it might indeed be necessary to invoke the method channel functions from the main thread. Currently it's done in the callback handler:
void NsdWindows::OnServiceDiscovered(const std::string handle, const DWORD status, PDNS_RECORD records)
{
// invoke this on the main thread instead
methodChannel->InvokeMethod("onServiceDiscovered", CreateMethodResult(...)
}
The bad news is, while there is an example of how to do this on Android and iOS in the Flutter documentation, there's nothing on how to do this on windows.
There's an issue by the flutter team about adding functionality to Flutter that would help developers do this on Windows (and an alternative solution here). Until then, the way to go would probably be the hidden message loop mentioned in the issue.
Since I don't have much time on my hands right now, I'm afraid we'd need someone with Windows / C++ experience to try their hands on a PR, or we'll have to wait until Flutter provides an API to do this.
Version of plugin: nsd: ^2.3.0 Same code works on iOs and Android without problem. Here is what Windows event viewer reporst:
Faulting application name: hn_app_flutter.exe, version: 1.0.0.0, time stamp: 0x649e81df Faulting module name: nsd_windows_plugin.dll, version: 0.0.0.0, time stamp: 0x64914406 Exception code: 0xc000041d Fault offset: 0x0000000000025069 Faulting process id: 0x41c0 Faulting application start time: 0x01d9ab2322902b48 Faulting application path: C:\Projects\hn-app-flutter\build\windows\runner\Debug\hn_app_flutter.exe Faulting module path: C:\Projects\hn-app-flutter\build\windows\runner\Debug\nsd_windows_plugin.dll Report Id: cf6b7327-95b1-4fff-9388-9634dc8d49e5 Faulting package full name: Faulting package-relative application ID: