Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

creating tables causes script to hang

Quote Reply
creating tables causes script to hang
The table is created, but the def file isn't, and the script just hangs.

Code:
my $db_ping = $DB->creator('Blog_Ping');

$db_ping->cols(
ID => {
pos => 1,
type => "INT",
size => 10,
not_null => 1
},
url => {
pos => 2,
type => "CHAR",
not_null => 1
},
excerpt => {
pos => 3,
type => "CHAR"
},
blog_name => {
pos => 4,
type => "CHAR"
},
title => {
pos => 5,
type => "CHAR"
}
);

$db_ping->unique({ "id_url" => ['ID', 'url']});
$db_ping->create();

I've pinpointed the problem down to:

Code:
$db_ping->unique({ "id_url" => ['ID', 'url']});

If I comment that out, them the def file is created. I just don't see what's wrong with it, as the usage appears to be within spec with GT::SQL::Creator documentation.

any ideas?

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] creating tables causes script to hang In reply to
Hi,

If you turn debugging on, and then view your error log ... does it show anything useful? i.e the queries its running/where exactly its stopping?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] creating tables causes script to hang In reply to
I think I just had a borked Links installation (2.2.1). the code ran perfectly on my PC (running 2.99), so I did a fresh installation of Links with new tables and everything. when I ran the code again in that install, it worked fine.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] creating tables causes script to hang In reply to
Maybe it died part way through on the first attempt? I've had a whole table get corrupt before (messes up the field structure or something). We had to restore the whole database, to get it working again (it was just gobbling more and more CPU up each time a new process run, which eventually crashed the server). Oh the joys of servers Pirate

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] creating tables causes script to hang In reply to
ugh... well, now I have another issue...

I need want my templates in their own template set outside of the default, but I can only get it to work if I pass the t=template parameter. I don't want to do that.

I've tried using:

Code:
$IN->param({ t => 'template_set' });

and also:

Code:
my $output = Links::SiteHTML::display('template', $vars, { t => 'template_set'});

but neither seem to have any effect. I just keep getting errors telling me my templates don't exist in "default".

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] creating tables causes script to hang In reply to
Hi,

You have to use GT::Template to do that I believe :(

Can't remember the exact format at the moment I'm afraid. Hopefully that'll get you on the right tracks though :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [fuzzy logic] creating tables causes script to hang In reply to
BTW, you would need to use this;

Code:
$IN->param( t => 'template_set' );

i.e without the { } part.

Here is an example of something I use in one of my plugins;

Code:
$IN->param( PartOfSite => 'Ultranerds' );

Hopefully that'll allow you to use Links::SiteHTML Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [fuzzy logic] creating tables causes script to hang In reply to
You could use inheritance. Put your files in another template directory and inherit from it (you'll need to check if it's already inheriting from another directory/directories). The problem is that multiple inheritance is only supported in 3.x, but very few Links SQL 2.x users use inheritance (but still something to consider).

Adrian

Last edited by:

brewt: Mar 10, 2005, 10:41 AM
Quote Reply
Re: [fuzzy logic] creating tables causes script to hang In reply to
Note, if you use Windows, you can't use debugging value higher than 1, as the GT::SQL will cause Perl interpreter to hang, because LSQL tries to output a content bigger than the 4096 size buffer.

This is a known STDERR buffer related problem, which is still not fixed even in latest LSQL v2.21 stable GT library. I don't know if it was fixed in LSQL v2.99beta, but I afraid it wasn't.

Maybe it's also a Perl bug, but I believe GT could fix the bug by splitting the output content to proper size.

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 12, 2005, 9:52 AM
Quote Reply
Re: [webmaster33] creating tables causes script to hang In reply to
 
It is not a bug in the script - it is a bug in mod_cgi which has now been fixed. Compiling a new version of mod_cgi or upgrading Apache will fix it.

Quote:
I believe GT could fix the bug by splitting the output content to proper size.

4096 is a cumulative figure. The script isn't trying to write 4096 bytes all at once.

A quick hack is to use:

Code:
use IO::Handle;
STDERR->blocking(0);

...which isn't ideal as it drops any data over 4096 bytes, but it will prevent a nasty hang.

I believe this version of mod_cgi fixes the bug too...

http://www.apache.org/~jorton/mod_cgi.c

Last edited by:

PAYE: Mar 12, 2005, 10:28 AM
Quote Reply
Re: [PAYE] creating tables causes script to hang In reply to
Thanks Paye!

That was really helpful information!

Which Apache v2.0.x release is fixing this mod_cgi stderr bug?
I searched the answer myself:

I hope this will be the solution:
Quote:
Changes with Apache 2.0.50: *) mod_cgi: Handle output on stderr during script execution on Unix
platforms; preventing deadlock when stderr output fills pipe buffer.
Also fixes case where stderr from nph- scripts could be lost.
PR 22030, 18348. [Joe Orton, Jeff Trawick]

So the answer is: Apache v2.0.50 fixes this problem.
I hope at least... Because it says "on Unix platforms", and I have the bug in Windows...


GT may add a conditional fix for this bug, to make debugging still possible for those who can't upgrade their server for some reason. I will do the upgrade anyway, but I can imagine, that somebody can not do this in middle of a development job.


P.S.: Who are you?
You registered just today. Aren't you Paul behind the Paye name? I discussed with Paul a few years ago about this bug.

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] creating tables causes script to hang In reply to
I'm not sure of the exact version of Apache that fixes the bug, but it looks like you found the information in any case.

Hopefully a new version of mod_cgi.so has been created for the Windows version of Apache too.

>>
P.S.: Who are you?
You registered just today. Aren't you Paul behind the Paye name? I discussed with Paul a few years ago about this bug.
<<

Yeah, I registered today after seeing a link to this site from PerlGuru (well it was actually a Gossamer Host banner). The reason I know about this issue is because I've experienced it with my own scripts in the past and it was a real PITA the figure out what was going on, so any information I can share will hopefully help someone.
Quote Reply
Re: [PAYE] creating tables causes script to hang In reply to
Quote:
Yeah, I registered today after seeing a link to this site from PerlGuru (well it was actually a Gossamer Host banner). The reason I know about this issue is because I've experienced it with my own scripts in the past and it was a real PITA the figure out what was going on, so any information I can share will hopefully help someone.

At the time (a few years ago) I discovered this problem, I tried to find an Apache fix for it, but at around 2.0.2x and 2.0.3x release there was no fix for this.
I'm happy, that this finally got fixed by Apache team. I will see if this is really fix for my problem...


Anyway, thanks for your precious help!
We always welcome new Perl experts here, who can share their knowledge, similarly how some of us also do here.

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...