NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
PHPEd 4.5 (build 4520) - Debugger hangs with long strings


Joined: 13 Jul 2004
Posts: 10
Reply with quote
I use PhpEd 3.3.3 for a while now and considered an upgrade to 4.5.

Unfortunately, a big problem showed up with remote debugging:

PHP 4.3.7, DBG-Extension provided with PhpEd 4.5 (2.20), Apache 2 running on Windows 2000 Professional, Client running on Windows XP Pro SP2.

The following simple code will cause the IDE to hang:

<?
$fh=fopen("testfile","r");
$testvar=fread($fh,filesize("testfile"));
fclose($fh);
?>

The file "testfile" is a textfile with a total length of about 2MB. The snippet is used in this form in a larger project, where files get read completely and afterwards get parsed. It is not possible to change this - we have to read the whole file.

When setting a break point at the line with fread(), it stops there - but as soon as i try to step over to the next statement, PhpEd freezes and will not come back again.

With PhpEd 3.3.3 this code works fine - BUT: only if the "locals" is disabled! So i tried to disable it in PhpEd 4.5 as well - no change! Still hangs!

Is this a known issue? Any workaround possible? I really would like to upgrade to V4.5 - but debugging must be possible as well.
View user's profileFind all posts by AWelzelSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
thanks for the report. I'll take a look.
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
I was unable to find any significant slowdown in debugger 4.5 over 3.3. I played with 2M file read in a variable and when Locals are disabled, it did not slow down at all. With Locals enabled, I had to uncheck "View strings in PHP format" to let it run fast enough. Code sample I tried with is below:

Code:
<?php

function main() {
  $f = file_get_contents('C:\\a.xml');
  echo "nothing bad";
}

main();

?>
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 13 Jul 2004
Posts: 10
Reply with quote
Hmmm... i can reproduce the "hang" with PhpEd 3.3.3 and locals visible or PhpEd 4.5 all the time.

It "freezes" as soon as a line is passed, where 2MB or more of data get read into a string variable using fread(). But i will give it another try with file_get_contents().
View user's profileFind all posts by AWelzelSend private message


Joined: 13 Jul 2004
Posts: 10
Reply with quote
Where is this checkbox "View strings in PHP format"?
View user's profileFind all posts by AWelzelSend private message


Joined: 13 Jul 2004
Posts: 10
Reply with quote
Ok - found it. Now a different error occurs, about 2 or 3 seconds after the line with the 2MB file read is passed:

"Unrecoverable Error: Out of system resources. IDE will close"
View user's profileFind all posts by AWelzelSend private message


Joined: 13 Jul 2004
Posts: 10
Reply with quote
... this happens, when you move the mouse anywhere over the string variable - either in the code or within the locals debug window. It seems, PHPEd tries to display a tool tip for the variable and crashes.
View user's profileFind all posts by AWelzelSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
I'm not quite sure I understand you.

Quote:
Hmmm... i can reproduce the "hang" with PhpEd 3.3.3 .... all the time.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Hmmm, you said the 3.3.3 works fine:
Quote:
With PhpEd 3.3.3 this code works fine - BUT: only if the "locals" is disabled!

Please clarify if 3.3.3 works really fine or hangs.

Quote:
It "freezes" as soon as a line is passed, where 2MB or more of data get read into a string variable using fread(). But i will give it another try with file_get_contents()

Did you try my sample with disabled locals? To me it works fine in 4.5 as well as in 3.3.3


Quote:
Where is this checkbox "View strings in PHP format"?

It is in the Local's popup menu.


Quote:
this happens, when you move the mouse anywhere over the string variable - either in the code or within the locals debug window. It seems, PHPEd tries to display a tool tip for the variable

Yep. A 2MB string with no line ends means ~ 16'000'000 by 14 pixels window to show it. Probably you computer has no requested memory.

Looks like it would be a good approach if we trim such long lines by say 64k length. What do you think?
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 13 Jul 2004
Posts: 10
Reply with quote
To clarify the things a bit:

1. PhpEd 3.3.3 hangs, if the "locals" debug window is just visible. It doesn't matter, if it is disabled or not.

2. PhpEd 4.5 hangs all the time, if "View strings in PHP format" is active. It doesn't matter, if the locals windows is visible or not or if it is disabled or not.

3. PhpEd 4.5 hangs, if "View strings in PHP format" is disabled AND if the locals window is visible OR if you move the mouse above a variable OR if the variable is in the "watch" window as well

ddmitrie wrote:
Looks like it would be a good approach if we trim such long lines by say 64k length. What do you think?


Yes - definitely. It seems, that PhpEd tries to parse and/or display the whole variable.
View user's profileFind all posts by AWelzelSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
What makes me wonder is that 4.5 does not hang for me. Yes it takes long while debugger transmitts those 2MB over the poor network, but definitely it does not HANG forever. Everything depends on the network bandwidth. When I tried on over 30kb/s network (the poorest I could find there) it took approx 60sec for each step and this time corresponds well to the data amount transmitted. In case of local network, it worked without any freezing at all. Each steps took ~ 1second or so. Certainly I kept Locals DISABLED and VISIBLE.

Regarding mouse over the variable, yes it's known problem and I see no other solutions for this than I mentioned before. If your machine has no memory for allocating 16000000x14 bitmaps 32bpp, you can't see it on the screen.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 13 Jul 2004
Posts: 10
Reply with quote
ddmitrie wrote:
What makes me wonder is that 4.5 does not hang for me. Yes it takes long while debugger transmitts those 2MB over the poor network, but definitely it does not HANG forever. Everything depends on the network bandwidth. When I tried on over 30kb/s network (the poorest I could find there) it took approx 60sec for each step and this time corresponds well to the data amount transmitted. In case of local network, it worked without any freezing at all. Each steps took ~ 1second or so. Certainly I kept Locals DISABLED and VISIBLE.

Regarding mouse over the variable, yes it's known problem and I see no other solutions for this than I mentioned before. If your machine has no memory for allocating 16000000x14 bitmaps 32bpp, you can't see it on the screen.


Well allocating 1.6Mx14x32bpp this would result in more than 800 MB(!). The machine, on which i had this error has "only" 512 MB of RAM. I think, limiting the maximum length, which is displayed, would really make sense.

Concerning the "hang": The network transmission is not the problem - this is done very fast. It is defenitely the local parsing of the string.
View user's profileFind all posts by AWelzelSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
Well, it's clear with Mouse-Moving-Over-Huge-Var issue.

Now let's get back our attention to the "freezing" issue.
If network is not the problem, I do not understand why it works in my case and does not in yours.
I just noticed that in your code, you don't really use "local" variable but a global one. In this case you'd need to disable both Globals and Locals. Isn't it?
Just give a try to my code and let know Smile
View user's profileFind all posts by dmitriSend private messageVisit poster's website
PHPEd 4.5 (build 4520) - Debugger hangs with long strings
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic