-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
WinForms Example CloseChannel Exception #872
Comments
Can you provide a detailed list of steps to reproduce? I've built in |
FYI I marked up your stack trace slightly differently, makes it easier to read. (If you click edit you can see the change I made). |
@rcha86 Any more info you can provide? |
Sorry for the delayed response. Here are the steps I take to reproduce the issue in Visual Studio.
When I see the issue, the application hangs for a few seconds and then there is an exception in BrowserProcessServiceHost.CloseChannel(). The try-catch takes cares of this, but I'm wondering if this is something to worry about. It seems to cause problems for my ActiveX control. I have since then tried a few things. If I use CefSharp 37.0.0 with CEF 2086.1898, I do NOT see this issue. If I use CefSharp 39.0.0-pre03 with CEF 2086.1898, then I also do NOT see this issue. In both cases, the ActiveX control I have built shuts down without issue. I think there might be some issue with CEF 2171.1979 and CefSharp combination. |
Have you triple checked what thread you create the ActiveX control on? You don't mention what kinds of problems it causes for your ActiveX control. That might help diagnose the problem. Some of CEF's threads should NEVER have COM objects created on them since they don't pump COM messages. For example, I needed to play MP3 files with CefSharp. So I hooked up a SchemeHandler that would create Windows Core Audio COM objects via help from the NAudio project's C# code. However, if I created the COM object on CEF's IO thread then the program would hang during shutdown because the finalizer of the COM object's RCW (.Net's COM helper object) would block forever on sending a COM message to CEF's IO thread. (Which, unsurprisingly doesn't pump COM messages.) So, instead I now deal with audio on .Net's thread pool by utilizing the Task class. Bill |
Thanks a bunch for sharing this fascinating detail, Bill! 👍 I'm currently experiencing a shutdown hang, but only after ~50 minutes of functional tests in my process, so it's hard to debug. Did you find your error on a hunch, or did you find a way to get the debugger to break during shutdown? VS2012 freezes if I break or 'step over' the last line of my C#'s |
I used the WinDbg extension sosex from https://www.stevestechspot.com/. One of it's commands is (!rcw if I recall correctly) tells you what RCWs exist, and what their owning .Net object is. Another WinDbg extension command lets you dump the details about the owning object and it was obviously one of the NAudio wrapping objects. What would happen went something like this:
So, if you app is hanging at shutdown, see what the callstack of the finalizer thread looks like, it might be blocked on releasing that RCW's COM object. Bill |
Worth creating item |
Anything further before closing this? |
I'm using CefSharp.39.0.0-pre03. When I run the WinForms Example in Release mode from Visual Studio, more than half the time when I close a tab or even the entire application, I see an exception in BrowserProcessServiceHost.CloseChannel. If launch the EXE from the command line, it shuts down just fine.
The stack trace is as follows:
Should I worry about this? It is surrounded with a try-catch block, but is there a better solution?
I am using CefSharp in an ActiveX control (I know. Shoot me, right?). With the ActiveX control, on shutdown, I see a similar communication error when the ActiveX control tries to Dispose itself. The ActiveX process does not close and the BrowserSubprocess for the GPU does not shutdown. I have included a try-catch block as well, but it does not seem to fix the issue. Any thoughts? I'm guessing that it has to do with how the ActiveX shuts down and Internet Explorer closes.
Thanks for the help!
The text was updated successfully, but these errors were encountered: