Gossamer Forum
Quote Reply
AdCycle -> Server Crash
Hi everyone,



I've a problem with my LinksSQL-Adcycle-Plugin (maybe mysql-Server too).

From time to time the whole server crashes. It is always when adcycle serves about 1000 Banners an hour.

Then I can read in my error.log:






DBI->connect(linkssql:localhost) failed: Too many connections at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 26

DBI->connect(linkssql:localhost) failed: Too many connections at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 26

DBI->connect(linkssql:localhost) failed: Too many connections at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 26

DBI->connect(linkssql:localhost) failed: Too many connections at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 26

DBI->connect(linkssql:localhost) failed: Too many connections at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 26

[Mon Jun 23 23:31:01 2003] [error] Can't call method "prepare" on an undefined value at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 57.

[Mon Jun 23 23:31:01 2003] [error] Can't call method "prepare" on an undefined value at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 57.

[Mon Jun 23 23:31:01 2003] [error] Can't call method "prepare" on an undefined value at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 57.

[Mon Jun 23 23:31:01 2003] [error] Can't call method "prepare" on an undefined value at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 57.

[Mon Jun 23 23:31:01 2003] [error] Can't call method "prepare" on an undefined value at /var/www/cgi-bin/shop/adcycle/AdDb.pm line 57

.....






... and the www-server (Port 80) doesn't work anymore until I do a reboot.

My server is an apache 1.3.23 with RedHat-Linux 7.3, 850MHz and 512MB RAM.

My question now is, could it be (for it always starts with adcycle) that adcycle has some bugs and doesn't close the opened db-connections?

Or does anyone has a trick to prevent this server-breakdowns (Mysql has nearly standard-configuration)??

Or any other idea??

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] AdCycle -> Server Crash In reply to
Most Perl/PHP scripts have a few places where the odd MySQL connection is not closed. Your best bet is to simply have a cut off time that a MySQL command is allowed to run (i.e 30seconds), that way all commands that are not finished within that time period, get stopped anyway.

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] AdCycle -> Server Crash In reply to
In Reply To:
Most Perl/PHP scripts have a few places where the odd MySQL connection is not closed. Your best bet is to simply have a cut off time that a MySQL command is allowed to run (i.e 30seconds), that way all commands that are not finished within that time period, get stopped anyway.

Cheers


Hi Andy,



thanks for your reply.

How do/should I define this cut off time and where?

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] AdCycle -> Server Crash In reply to
I'm not too sure. I stink its in mysql.conf, but I could be wrong. Your best bet is to goto: http://www.tek-tips.com/...d=436&newpid=436, and ask someone if they know how to do it. I'm pretty sure someone will know how to 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: [Andy] AdCycle -> Server Crash In reply to
OK thanks!

I've found something like this:

connect_timeout: 5

But I don't know what the "5" means (seconds, minutes..whatever ???)

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] AdCycle -> Server Crash In reply to
Is this any use?

http://chronos.cs.msu.su/...nfo2www?(mysql)mysql

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] AdCycle -> Server Crash In reply to
Thanks,



so it means connection_timeout=5 SECONDS!

I had a feeling the seconds were the right answer.

I think I'm going to try to set it to 2 seconds.

But it would be really good if I'll find out the reason instead of working at symptoms.

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] AdCycle -> Server Crash In reply to
The problem is, that we didn't write AdCycle. Its hard to work out the coding structure, and edit the whole script so that it closes MySQL connections no matter what Unsure Your best bet is this config option.

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] AdCycle -> Server Crash In reply to
yeah,

I think this too.

shell> safe_mysqld -O connect_timeout=2

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] AdCycle -> Server Crash In reply to
It may be best asking the adcycle developers for a fix, or alternatively, in AdDB.pm try this (no guarantee):

Code:
sub DESTROY {
(ref $_[0] and $_[0]->can('disconnect')) and $_[0]->disconnect;
}

Last edited by:

Paul: Jun 24, 2003, 1:47 AM
Quote Reply
Re: [Paul] AdCycle -> Server Crash In reply to
hmm, thanks Paul,



but there is no SUB DESTROY {} in AdDB.pm

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] AdCycle -> Server Crash In reply to
I know, you add it in :)
Quote Reply
Re: [Paul] AdCycle -> Server Crash In reply to
oK.

but if I'm right, the sub has to be called somewhere

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] AdCycle -> Server Crash In reply to
Nope =) ....it's magic.
Quote Reply
Re: [Paul] AdCycle -> Server Crash In reply to
CrazySlyLaughSly

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [Paul] AdCycle -> Server Crash In reply to
Hey Paul,



it seems that I just can say W O W!!!!

I haven't checked, if the adcycle banner-counting works right yet,

BUT I've recognized that my server and it's applications are now running two times FASTER (minimum) than before inserting the code in AdDB.pm!!!!

The code seems to be really MAGIC ! Wink

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.