GithubHelp home page GithubHelp logo

Comments (8)

sebastianhaberey avatar sebastianhaberey commented on July 28, 2024 3

@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!

from nsd.

sebastianhaberey avatar sebastianhaberey commented on July 28, 2024 3

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. Until then, the way to go would probably be the hidden message loop mentioned in the issue. There's a link to code in the Flutter engine that could be used as a template, but it's not just copying two lines of code and wrapping some calls, as I had hoped.

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.

from nsd.

sebastianhaberey avatar sebastianhaberey commented on July 28, 2024

Sadly I don't have time to work on this now, but just out of interest, is this Windows 11?

from nsd.

kostadin24 avatar kostadin24 commented on July 28, 2024

Windows 10

from nsd.

JulienDev avatar JulienDev commented on July 28, 2024

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. :)

from nsd.

sebastianhaberey avatar sebastianhaberey commented on July 28, 2024

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?

from nsd.

JulienDev avatar JulienDev commented on July 28, 2024

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

from nsd.

gomaze0906 avatar gomaze0906 commented on July 28, 2024

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.

from nsd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.