Page 1 of 2

Stack overflow

Posted: Mon Aug 16, 2010 3:07 am
by John Fairbairn
For, I think, the last three days (today is 16 August 2010) I have been getting a message on this site only, using Windows and Internet Explorer, that a script is running on this page and may cause Explorer to run slowly. If I stop it, nothing seems to happen. If I let it run there is an instant "stack overflow at line 1161".

It does not appear on every page I look at. My impression is that it only appears on pages with the Eidogo viewer (which I very rarely use and have not used for some time).

Re: Stack overflow

Posted: Mon Aug 16, 2010 3:15 am
by kirkmc
That happens when you try to pile up the stones too high. With yunzi stones you can make taller stacks.

Re: Stack overflow

Posted: Mon Aug 16, 2010 5:36 am
by bobmcg
John Fairbairn wrote:For, I think, the last three days (today is 16 August 2010) I have been getting a message on this site only, using Windows and Internet Explorer, that a script is running on this page and may cause Explorer to run slowly. If I stop it, nothing seems to happen. If I let it run there is an instant "stack overflow at line 1161".

It does not appear on every page I look at. My impression is that it only appears on pages with the Eidogo viewer (which I very rarely use and have not used for some time).


I have been getting the same message but I've always clicked "yes" regarding stopping the script so I haven't seen the "stack overflow". I tried stopping the script and using the eidogo player after that and it worked OK.

Re: Stack overflow

Posted: Mon Aug 16, 2010 6:34 am
by fwiffo
What version of IE?

Re: Stack overflow

Posted: Mon Aug 16, 2010 6:59 am
by bobmcg
fwiffo wrote:What version of IE?


I'm using IE 8. I do get the stack overflow immediately after clicking not to turn off the script, though, as I said above, the eidogo player works all right if I do turn off the script. What is that script anyhow?

Re: Stack overflow

Posted: Mon Aug 16, 2010 7:28 am
by fwiffo
It may be completely unrelated to eidogo. The site runs javascript for other things too. No idea which is causing the error. Is it a particular screen or thread that produces the error?

I'll try to look into it sometime this week.

Re: Stack overflow

Posted: Mon Aug 16, 2010 7:38 am
by bobmcg
fwiffo wrote:It may be completely unrelated to eidogo. The site runs javascript for other things too. No idea which is causing the error. Is it a particular screen or thread that produces the error?

I'll try to look into it sometime this week.


It happened again just now on page three of the thread "Comparison of Interest in Pro Go by Country": viewtopic.php?f=13&t=1365&start=40

It doesn't happen on the first two pages of the thread which don't have Eidogo players, only the third when the post including an eidogo player is on the page.

Re: Stack overflow

Posted: Mon Aug 16, 2010 7:42 am
by bobmcg
bobmcg wrote:
fwiffo wrote:It may be completely unrelated to eidogo. The site runs javascript for other things too. No idea which is causing the error. Is it a particular screen or thread that produces the error?

I'll try to look into it sometime this week.


It happened again just now on page three of the thread "Comparison of Interest in Pro Go by Country": viewtopic.php?f=13&t=1365&start=40

It doesn't happen on the first two pages of the thread which don't have Eidogo players, only the third when the post including an eidogo player is on the page.


I just tried this thread viewtopic.php?f=15&t=1097 which has an Eidogo player in it's first post and I did not get the script error.

Re: Stack overflow

Posted: Mon Aug 16, 2010 8:55 am
by hyperpape
On IE7, I get the stack overflow, but without the message that a script may cause the site to run slowly. It doesn't appear in every page involving the eidogo viewer: I just looked at the congress photos thread in the AGA forum, and had no problem. The one thread it always happened on was "Comparison of Pro Interest By Country".

Re: Stack overflow

Posted: Mon Aug 16, 2010 9:30 am
by deja
Yep, happening to me as well. I clicked the links that bobmcg posted and exact same thing happens. Using IE8, although I've recently thrown in the towel and started using Firefox. :cry:

Re: Stack overflow

Posted: Mon Aug 16, 2010 9:55 am
by apetresc
I just reproduced it under Chrome in Linux (!!). There was no script error, but it took a good 30+ seconds for Javascript to run. Since I'm on Chrome I can probably figure out exactly what script is causing it. I'll post back in here.

Re: Stack overflow

Posted: Mon Aug 16, 2010 10:21 am
by John Fairbairn
I'm on IE8.

Not sure which threads give me the message but it's definitely NOT any Malkovich forums as I zap those.

Re: Stack overflow

Posted: Mon Aug 16, 2010 11:00 am
by apetresc
So the problem is a bug in the all.compressed.js script. The findCaptures() method has an infinite recursion somewhere around line 1167. This bug actually exists on all platforms and all browsers; the reason the Firefox users never noticed it is that the stack depth on Firefox is much lower, so it just errors out before the time lag becomes noticeable. If you look at your Javascript Error Console in Firefox you will see:

Code: Select all

Error: too much recursion
Source File: http://www.lifein19x19.com/eidogo-phpbb3/eidogo/player/js/all.compressed.js
Line: 1161

Other browsers, like IE, Chrome, and Safari, will happily recurse for a long time (or forever, in IE/Safari's case) leading to the timeout.

Whoever wants to help fix this (Kirby, Joaz, fwiffo?) I recommend investigating by setting a breakpoint on line 1167, and step through a bunch of times. Notice how pendingCaptures.length just keeps going up forever, with the call on line 1172. The call stack will contain hundreds of copies of findCaptures().

I'm not sure what it is about this SGF that causes the problem; it seems well-formed to me, and CGoban has no problems parsing it. I'll keep looking.

Re: Stack overflow

Posted: Mon Aug 16, 2010 11:25 am
by apetresc
Okay, I've figured out the problem. The problem is that the SGF in that thread uses an "incorrect" SGF property -- it used "KO[6.5]" instead of "KM[6.5]" to represent the komi. The KO property actually is meant to indicate a ko square, so the EidoGo parser was getting very confused about where the ko was when there were, in fact, 0 stones on the board at the time :)

I've fixed the offending SGF for the meantime, but we should go and toughen up the EidoGo parser to fail more gracefully on incorrect SGF tags.

Re: Stack overflow

Posted: Mon Aug 16, 2010 11:47 am
by fwiffo
Wow, that's weird. What app made the offending SGF? I know the eidogo code fairly well and have my own fork on github, so I'll fix the bug when I have time.