Welcome Guest Search | Active Topics | Sign In | Register

Deadlock in the webView Options
Sarath
Posted: Saturday, March 1, 2014 2:10:50 AM
Rank: Newbie
Groups: Member

Joined: 3/1/2014
Posts: 5
Hi



I am using the Web-browser version 3.0.38 and in the documentation there is a line about dead lock situation
So Can u explain little more by means of a example
(Inside the event handler of certain WebView events. Calling Eval Script is not allowed in these handlers because it can potentially causes deadlock in the browser engine)


Regards,
Sarath
eo_support
Posted: Saturday, March 1, 2014 11:10:08 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

The design goal is that whenever a deadlock can could potential occur, EO.WebBrowser will throw an exception or fail the call instead of allowing your code to proceed and fall into a deadlock. For example, say you handle WebView's BeforeNavigate event and you call EvalScript inside this event. If we were to allow this then this is what will happen:

1. The browser engine starts to load a page, but before it starts loading, it calls your BeforeNavigate event handler. The browser will not proceed to load the page unless you return from that handler because in your handler you can cancel the request. So the browser engine must hear from you first in order to decide whether it needs to continue load the page or not;
2. Now in your handler you call EvalScript. EvalScript must wait for the page starting loading (in order to have window and document object). However since you are inside BeforeNavigate event, your page sure will not start loading until you return. However your code will not return until EvalScript return. Now a deadlock occurs;

To avoid such deadlocks, EO.WebBrowser will automatically detect such situations and throw an exception or fail the call. In the above situation, if you try to call EvalScript inside BeforeNavigate, the call will fail, thus avoiding the deadlock.

We have just posted 3.0.39 which fixed a number of such issues. So if you were experiencing deadlock with 3.0.38, you can try to update to 3.0.39 and see if it resolves the issue for you.

Thanks!
Sarath
Posted: Monday, March 3, 2014 6:40:52 AM
Rank: Newbie
Groups: Member

Joined: 3/1/2014
Posts: 5
Well thanks for the new version

To my bad luck it does not fulfill my requirement now it fails with the exception

EvalScript failed because JavaScript code can not be executed at this moment. This may occur if you try to re-enter JavaScript engine. For example, if the call chain is JavaScript -> .NET -> JavaScript, then it's not allowed because it would cause re-entry on the JavaScript side. In this case please use QueueScriptCall instead of EvalScript to execute JavaScript code.
at EO.WebBrowser.WebView.a(String A_0, ba A_1, ak A_2, Boolean A_3)
at EO.WebBrowser.WebView.a(t A_0, Action`1 A_1, Boolean A_2, Boolean A_3, String A_4)
at EO.WebBrowser.WebView.a(String A_0, Boolean A_1, Boolean A_2)
at EO.WebBrowser.WebView.EvalScript(String code, Boolean throwOnError)

which use to come before also nothing much improvement for me

In documentation you have mentioned that for
[if the call chain is JavaScript -> .NET -> JavaScript, then it's not allowed because it would cause re-entry on the JavaScript side. In this case please use QueueScriptCall instead of EvalScript to execute JavaScript code.]

I am using the web browser in a form to display a web page and than i will add it to tab-pages

To tell u more if i have 5 tabs with web-browser in each and if one web browser hangs rest of all the tabs with web-browser fails and their i am using only QueueScriptCall
ex
webView.QueueScriptCall("My Call goes"); this line works fine until it is fine and fails suddenly with this line in my console

A first chance exception of type 'System.Exception' occurred in EO.WebBrowser.dll

after that i have to close the tab so that rest of the tabs can come back to normal form

Kindly tell me any alternative for QueueScriptCall because it hangs a lot

In my application i need to call JavaScript min of 20 times and with this QueueScriptCall it fails a lot with multiple tabs opened

I also tried using webView.GetDomWindow().Invokefunction() which also fails with this same Exception

can i have any exception class of EO. Webbrowser in order to catch those exceptions instead this message or else any location where these logs will be created by EO. Webbrowser

Regards,
Sarath
eo_support
Posted: Monday, March 3, 2014 8:51:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

QueueScriptCall should not hang. If you are trying to call any script code from a timer, check CanEvalScript property first (if that property is false, then don't try to call QueueScriptCall or EvalScript). If you still have problem, please try to isolate the problem into a test project and send the test project to us. We will PM you as to where to send the project.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.