-
-
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
CEFSharp freezes on call to Dispose method. #2105
Comments
I have exactly the same problem, same exceptions. I use version 55 from Nuget. |
Already reported, and seems to be still not solved. |
Duplicate of #1304 |
@merceyz I'm not sure is the issue is a duplicate. #1304 is related with WCF timeouts, but the issue can be reproduced even if CefSharpSettings.WcfEnabled is set to false. It looks more like a deadlock that occurs in MethodRunnerQueue.cs:58
|
Do you call RegisterJsObject? This sets WcfEnabled = true |
for me using But I still have the problem with CefSharp.BrowserSubProcess not closed. And if a youtube video was playing, the sound is still running after the dispose. |
@Clemani No, I don't call RegisterJsObject. I use SpawnBrowsersWindow.xaml from CefSharp.Wpf.Example. The code doesn't use any threads other than UI thread, all it does is creating and disposing browser objects. I had the issue with WCF timeout before, reducing the timeout solved it, so I think this is another issue. Could someone launch the sample (SpawnBrowsersWindow.xaml) to make sure it can be reproduced and reopen the issue if so? |
@merceyz Could you reopen this issue? It is not a duplicate, it is just a deadlock in MethodRunnerQueue. |
I'll re-open but your solution isn't valid |
@merceyz Could you explain why the solution is not valid? An alternative approach would be to create the 'stopped' event in signalled state and reset it in the beginning of try block in ConsumeTasks method. It would be more optimal as in some cases we can avoid scheduling of the task at all but I think the first solution would do its work too. |
Looked closer into it now and your first suggestion would fix the issue, but might be incomplete. Would you like to make a PR for this or should I take care of it? |
Start implementation looks like a correct implementation of double-check locking. I can see an issue with Stop - if a context switch occurs between Task.Factory.StartNew and running = true then Stop just exits without doing any cleanup. Removing the check outside the lock in Stop solves this problem. I'll prepare a PR for this if you don't mind. |
I don't mind at all, I would prefer it if the checks where removed from both functions though. There is no harm in removing them |
This would be the better solution to the problem, at the moment the |
What version of the product are you using?
CEFSharp v. 57.0.0 from Nuget.
What architecture x86 or x64?
x64
On what operating system?
Win10
Are you using
WinForms
,WPF
orOffScreen
?WPF
What steps will reproduce the problem?
I have several
ChromiumWebBrowser
instances in my application. Sometimes when I create new instances and dispose old ones the call toChromiumWebBrowser.Dispose()
hangs.After that other instances crash with the following exceptions:
Exception thrown: 'System.IO.PipeException' in System.ServiceModel.dll Exception thrown: 'System.IO.PipeException' in System.ServiceModel.dll Exception thrown: 'System.IO.PipeException' in System.ServiceModel.dll Exception thrown: 'System.IO.PipeException' in System.ServiceModel.dll Exception thrown: 'System.ServiceModel.CommunicationException' in System.ServiceModel.dll Exception thrown: 'System.ServiceModel.CommunicationException' in System.ServiceModel.dll Exception thrown: 'System.IO.PipeException' in System.ServiceModel.dll Exception thrown: 'System.ServiceModel.CommunicationException' in System.ServiceModel.dll
If I remove the Dispose call, everything works fine and this exceptions never happen.
This issue can be reproduced using SpawnBrowsersWindow.xaml view from CefSharp.Wpf.Example.
When I launch the sample with StartupUri set to this view and click Test button, it creates up to 10 windows and then freezes at MethodRunnerQueue:58.
I assume the PipeExceptions are a side effects of this freeze due to WCF timeout.
What is the expected output? What do you see instead?
The call to Dispose() should end up in reasonable amount of time of throw an exception if something went wrong. For now it looks like a deadlock.
Please provide any additional information below.
CEF log doesn't contain anything but a regular web browser console output.
I can reproduce this issue using latest master branch code, v. 57.0.0 from Nuget and v. 51.0.0 (I switched to v. 57 to check if the issue still exist).
cef_binary_3.2987.1601.
The text was updated successfully, but these errors were encountered: