Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Debug Hanging

Quote Reply
Debug Hanging
Alex,
Anyway debug_level still causes Perl process hangups under Windows (I already reported to you).
You said it's likely a Perl bug and you already posted a bug report in that subject.
debug_level 1 sometimes works, but debug_level 3 really hangs the perl process.

Are there any news in that subject?

It really difficult to avoid using debug_level in my developments under Windows...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

Paul: Mar 20, 2003, 6:40 AM
Quote Reply
Re: [webmaster33] can't loop for over 16 times when debug_level set to 1 In reply to
Strange, seems to work for me on XP with Perl 5.6.1
Quote Reply
Re: [Paul] can't loop for over 16 times when debug_level set to 1 In reply to
My environment:
- perl, v5.6.1 build 633 - built for MSWin32-x86-multi-thread (Activestate)
- Win XP + SP1
- Links SQL v2.1.2

The last time I checked the debug_level bug with detailed tests, was with Links SQL v2.1.1.
I have no info about that there was the debug_level code touched in LSQL 2.1.2.

Paul,
Would you be open to do some tests together about the debug_level?
The test would only require a brand new LSQL install, and config change.
So?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 20, 2003, 4:59 AM
Quote Reply
Re: [webmaster33] can't loop for over 16 times when debug_level set to 1 In reply to
I've just done a test and it worked fine. What exactly are you doing to product the hang?
Quote Reply
Re: [Paul] can't loop for over 16 times when debug_level set to 1 In reply to
I quote here my bug report I sent to GT support:

Report 1st is about debug level 2 problem:
Quote:
Config: LSQL v2.1.1, ActivePerl v5.6.1 build 633, Apache v1.3.27, MySQL 3.23.49-nt, Windows XP + SP1.
LSQL was brand newly installed. Nothing modified, just Debug level.

When I set debug level 2, and call page.cgi?d=1, the perl.exe hangs.
Using Debug level 1, everything works fine, no perl hangups.
Later, when I kill the hanged perl.exe, error 500 is displayed in the browser.


Also into the Apache error.log following is added:
-------------------------------------
[Thu Dec 26 16:13:55 2002] [info] Invoking CGI Command '"F:\Perl\bin\perl.exe" "c:\work\cgi-bin\lsql\page.cgi" '
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] Premature end of script headers c:/work/cgi-bin/lsql/page.cgi
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL (340) Creating new table object for lsql_Category at c:/work/cgi-bin/lsql/admin/GT/SQL/Base.pm line 120.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Table (340) Loading state for lsql_Category at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 178.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Table (340) State loaded for lsql_Category at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 182.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL (340) Creating new table object for lsql_Links at c:/work/cgi-bin/lsql/admin/GT/SQL/Base.pm line 120.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Table (340) Loading state for lsql_Links at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 178.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Table (340) State loaded for lsql_Links at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 182.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL (340) Creating new table object for lsql_CatLinks at c:/work/cgi-bin/lsql/admin/GT/SQL/Base.pm line 120.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Table (340) Loading state for lsql_CatLinks at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 178.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Table (340) State loaded for lsql_CatLinks at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 182.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Driver/MYSQL (340) Connecting to database with 'DBI:mysql:links:localhost', 'links', '**********' at c:/work/cgi-bin/lsql/admin/GT/SQL/Driver.pm line 82.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Driver/MYSQL (340) Connected successfully to database. at c:/work/cgi-bin/lsql/admin/GT/SQL/Driver.pm line 87.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Table (340) Query SELECT COUNT(*) FROM lsql_CatLinks
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Driver/MYSQL (340) Preparing query SELECT COUNT(*) FROM lsql_CatLinks at c:/work/cgi-bin/lsql/admin/GT/SQL/Driver/MYSQL.pm line 35.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Driver/MYSQL/sth (340) Executing query SELECT COUNT(*) FROM lsql_CatLinks
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) GT/SQL/Driver/MYSQL/sth/execute called at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 949 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (GT/SQL/Driver/MYSQL/sth=HASH(0x21d9fb8)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) GT/SQL/Table/do_query called at c:/work/cgi-bin/lsql/admin/GT/SQL/Table.pm line 865 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (GT/SQL/Table=HASH(0x1a2a10c), SELECT COUNT(*) FROM lsql_CatLinks , ARRAY(0x1a06234)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) GT/SQL/Table/select called at c:/work/cgi-bin/lsql/admin/GT/SQL/Base.pm line 277 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (GT/SQL/Table=HASH(0x1a2a10c), ARRAY(0x225ec88)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) GT/SQL/Base/count called at GT/SQL/Base/total line 292 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (GT/SQL/Table=HASH(0x1a2a10c)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) GT/SQL/Base/total called at c:/work/cgi-bin/lsql/admin/Links/Build.pm line 985 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (GT/SQL/Table=HASH(0x1a2a10c)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) Links/Build/_grand_total called at Links/Build/build_home line 6 with no arguments.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) Links/Build/build_home called at c:/work/cgi-bin/lsql/admin/GT/Plugins.pm line 108 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (HASH(0x1a2e810)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) GT/Plugins/dispatch called at c:/work/cgi-bin/lsql/admin/Links/Build.pm line 30 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (GT/Plugins, c:/work/cgi-bin/lsql/admin/Plugins, build_home, *Links/Build/build_home, HASH(0x1a2e810)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) Links/Build/build called at c:/work/cgi-bin/lsql/admin/Links/User/Page.pm line 77 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (home, HASH(0x1a2e810)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) Links/User/Page/generate_home_page called at c:/work/cgi-bin/lsql/admin/Links/User/Page.pm line 53 with no arguments.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) Links/User/Page/handle called at c:/work/cgi-bin/lsql/admin/GT/Plugins.pm line 108 with no arguments.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/Base (340) GT/Plugins/dispatch called at c:\work\cgi-bin\lsql\page.cgi line 25 with arguments
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] (GT/Plugins, c:/work/cgi-bin/lsql/admin/Plugins, handle_page, CODE(0x1ae2394)).
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1]
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] GT/SQL/Driver/MYSQL (340) Using stored connection DBI:mysql:links:localhost at c:/work/cgi-bin/lsql/admin/GT/SQL/Driver.pm line 77.
[Thu Dec 26 16:14:51 2002] [error] [client 127.0.0.1] Links/Link (340) Query:
-------------------------------------
The text above is the full error result. Not truncated.
BTW: I had to replace all :: to /, and all :space to space, because it seems the : hangs the GT Forum, when I click to Preview Post button! GT should investigate this GForum bug...

Report 2nd is about debug level 1 problem:
Quote:
When I set debug level 1, and use the 'build_directory_field' option, and call page.cgi?d=1, the perl.exe hangs.
Using Debug level 0, everything works fine, no perl hangups.
Later, when I kill the hanged perl.exe, error 500 is displayed in the browser.
This bug is replicable for me.

Paul, let me know, if you do these 2 cases with brand new LSQL v2.1.2 install, what result do you get?
Could you try with an LSQL v2.1.1 install, too?

If you need more info, let me know.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] can't loop for over 16 times when debug_level set to 1 In reply to
Aha. Mmm I'm actually using 2.1.0 and had debug level set to 1 which works successfully, but I just raised that to 2 and I did experience the hang.

This is actually something I experienced whilst writing one of my own scripts but I never put two and two together....or perhaps I just forgot about this bug report.

The problem stems from printing to STDERR in GT::Base. When implementing my own debugging routine I found the same problem. Then printing to STDERR it would hang. You can see my thread here which I posted when having trouble:

http://gossamer-threads.com/...tring=STDERR;#218922

Now, I've just opened up GT::Base...if you comment out line 271 which is:

print STDERR "$pkg ($$): $msg";

...you will find the hang stops. I'm looking for a fix.
Quote Reply
Re: [webmaster33] can't loop for over 16 times when debug_level set to 1 In reply to
This is very strange.

If you change that line to the following (removing $msg)::

print STDERR $pkg . " (" . $$ . "): ";

...it begins to work properly.

Before that line if you add:

die $msg;

....it also hangs.

However if you add:

die $msg;

...before:

# Remove windows linefeeds (breaks unix terminals).
$msg =~ s/\r//g unless ($^O eq 'MSWin32');

...then it works.

This must be something to do with the contents of $msg.
Quote Reply
Re: [webmaster33] can't loop for over 16 times when debug_level set to 1 In reply to
Ok here's a fix that works for me...don't ask me why it works as I have no idea....this definitely looks like a perl bug.

Change:

Code:
print STDERR "$pkg ($$): $msg";

to...

Code:
print STDERR "$pkg ($$):" . chomp($msg);
Quote Reply
Re: [Paul] Debug Hanging In reply to
I'm glad that the bug was reproducible for you, too.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 20, 2003, 7:00 AM
Quote Reply
Re: [Paul] Debug Hanging In reply to
Hmmm, interesting solution. I'm not applying this fix yet, maybe later.
But I'm glad that you worked out! Good job, Paul!

I would be curious what Alex says about the bug itself, and if he accepts the fix.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 20, 2003, 7:00 AM
Quote Reply
Re: [webmaster33] can't loop for over 16 times when debug_level set to 1 In reply to
I don't think Alex will use my fix...this was something I just found to work....I'm certainly interested to find the reason behind this.
Quote Reply
Re: [Paul] Debug Hanging In reply to
Just noted that in Apache error.log after turning debug level 1, every 2nd line is empty:
[Thu Mar 20 19:14:56 2003] [error] [client 127.0.0.1] GT::Plugins (3228): Plugin: pre auth_init running => Plugins::Auth_Community::auth_init at c:/work/cgi-bin/lsql212/admin/GT/Plugins.pm line 94.

[Thu Mar 20 19:14:56 2003] [error] [client 127.0.0.1] GT::Plugins (3228): Plugin: pre auth_valid_session running => Plugins::Auth_Community::auth_valid_session at c:/work/cgi-bin/lsql212/admin/GT/Plugins.pm line 94.

[Thu Mar 20 19:14:56 2003] [error] [client 127.0.0.1] GT::Plugins (3228): Plugin pre auth_valid_session stopped further plugins. at c:/work/cgi-bin/lsql212/admin/GT/Plugins.pm line 99.

So there is an unnecessary \n newline or \r printed to STDERR.
Likely this is the reason why chomp($msg) makes it working.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Debug Hanging In reply to
The weird thing is though, if you substitute chomp() for:

$msg =~ s/\r?\n//sg;

...and then use:

print STDERR "$pkg ($$): $msg";

.....it hangs again.
Quote Reply
Re: [Paul] Debug Hanging In reply to
I tried your fix, and solves the hang problem.

But the debug result is unfortunately unuseful:
[Sun Mar 23 20:49:32 2003] [error] [client 127.0.0.1] GT::Plugins (3508):1GT::Plugins (3508):1GT::Plugins (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1GT::SQL::Driver::MYSQL::sth (3508):1

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 23, 2003, 2:11 PM
Quote Reply
Re: [Paul] Debug Hanging In reply to
Finally found (at least one) reason of perl.exe hang under Windows.

Try out following tests separately:
1) print STDERR "aaa"; # Works
2) print STDERR "a"x10000; # Hangs Perl.exe
3) print STDERR "a"x4096; # Works
4) print STDERR "a"x4097; # Hangs Perl.exe

This means that there was some buffering problem.

In ActiveState Perl v5.6.1 build 633, this causes perl.exe hang.
I asked somebody to try these tests under build 635 and reported it works.
So if the info is correct, installing latest perl version is the solution.

Paul, what's your exact perl version (build)?
Could you try out a newer one?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 23, 2003, 4:45 PM