Welcome Guest Search | Active Topics | Sign In | Register

Freezing after unsuccessful javascript run Options
ozheek
Posted: Thursday, August 13, 2020 5:08:16 AM
Rank: Advanced Member
Groups: Member

Joined: 8/29/2016
Posts: 64
Hello,

Sometimes, for some pages I receive strange issue.

It happens sometimes, so I can't normally trace why it happened, so maybe you can give me advice what to do and to catch the exception.
I have huge Javascript code setup in webView.JSInitCode, not sure if it influences the issue, I can't remove it to check without it.

QueueScriptCall return ScriptCall, I wait for the executing scriptCall.WaitOne with timeout 1 minute.
ScriptCall has no Exception, isAborted = false, isDone = false.

Please check the screenshot: http://prntscr.com/tyuug3

I try after this unsuccessful JavaScript call to do anything with WebView and it stucks in executing inside the function.

For example, never received return from this:

Code: C#
var pageSize = SelectedBrowserView.GetContentAreaSize();


I understand that not much information to help with this issue. But hope you can give some advice how to catch the issue or fix it.
eo_support
Posted: Thursday, August 13, 2020 9:52:25 AM
Rank: Administration
Groups: Administration

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

It appears that the render process somehow hangs in this case. Based on your description the most suspicious place would be your JavaScript somehow falls into an infinite loop and never returns. This in turn would block everything else.

There are two things you can try:

1. Use task manager to identify the renderer process first. Look for the command line of all rundll32.exe (or eowp.exe if you have enabled EO worker process) and find the one with --type=renderer. Check the CPU usage of that process. If you see it consistently high when this occurs, then it's almost certain that it runs into a JavaScript loop;

2. If step 1 confirms this is the problem, you can then try to comment out your JavaScript code block by block and see if you can isolate the block that triggers the problem. Unfortunately you won't be able to use the browser engine's built-in debugger to debug the code in this case. So you would have to rely on trial and error to find out the root cause;

If that's not the problem, then we will have to debug it on our end. In that case we would need a repro project:

https://www.essentialobjects.com/forum/test_project.aspx

Once we have the repro project, we will be happy to investigate further.

Thanks!
ozheek
Posted: Thursday, August 13, 2020 10:09:14 AM
Rank: Advanced Member
Groups: Member

Joined: 8/29/2016
Posts: 64
Hello,

Thank you for the answer. It's really a good idea to check if the is JavaScript loop. I will check your advice and come back later.

Te script code I want to call is pretty simple. The code is "document.URL". It's on the screenshot, I sent in the first message.

Can it be the problem that there is an issue with JavaScript on the page or in webView.JSInitCode?

eo_support
Posted: Thursday, August 13, 2020 12:52:33 PM
Rank: Administration
Groups: Administration

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

The problem is not your test script --- it can be WebView.JSInitCode or JavaScript in the page. Those code causes the renderers to hang thus unable to run your test script.

Thanks!
ozheek
Posted: Friday, August 14, 2020 9:28:04 AM
Rank: Advanced Member
Groups: Member

Joined: 8/29/2016
Posts: 64
Hello,

Thank you for the help! I didn't believe that this issue possible to track and solve.

You gave great advice and I found that there is an issue with JavaScript code in WebView.JSInitCode on some pages with specific conditions.
I used CPU usage advice and you were right.

I am trying to fix the bug, it's hard to find exact place in JavaScript code. but at least I found the source of the issue, you can't believe how much time I spent finding it and how much time you saved more :)

Thank you one more time!
eo_support
Posted: Friday, August 14, 2020 10:23:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Great. Glad that we were able to help!


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.