473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

preventing system crashes

Hi,

I made a mistake in a script that completely froze my linux-based server:

I passed an array instead of a number to a function like:

function plg_ratingimg($rating)
{
global $plug_picrank;
for ($i=0;$i<$rating;$i++)
{
$out.=$plug_picrank;
}
return $out;
}

where $plug_picrank is a simple HTML string.

Where is the weakness in the apache or php setup that something like this
can freeze the server?

thanks

Oliver

Jul 17 '05 #1
4 1434
Oliver Spiesshofer wrote:
Hi,

I made a mistake in a script that completely froze my linux-based server:

I passed an array instead of a number to a function like:

function plg_ratingimg($rating)
{
global $plug_picrank;
for ($i=0;$i<$rating;$i++)
{
$out.=$plug_picrank;
}
return $out;
}

where $plug_picrank is a simple HTML string.

Where is the weakness in the apache or php setup that something like this
can freeze the server?

thanks

Oliver


Hi Oliver,

Are you sure it is a systemcrash?
I think only PHP stops responding untill the scripttimeout time has elapsed.

When I had a similar situation (a very long calculation) ONLY scripts on
that site stopped responding.
Apache just neatly continued to serve other sites.

Solution? I don't know. Write better scripts? :P

Regards,
Erwin Moller
Jul 17 '05 #2
Erwin Moller
<si******************************************@spam yourself.com> wrote in
news:42***********************@news.xs4all.nl:

Hi Oliver,

Are you sure it is a systemcrash?
I think only PHP stops responding untill the scripttimeout time has
elapsed.


No it doesnt, strange enough.
FTP and SSH to the machine dont work anymore either "Connection refused"...

Oliver

Jul 17 '05 #3
Oliver Spiesshofer <ol****@email.com> writes:
I made a mistake in a script that completely froze my linux-based server:
I passed an array instead of a number to a function like:

function plg_ratingimg($rating)
{
global $plug_picrank;
for ($i=0;$i<$rating;$i++)
$out.=$plug_picrank;


Assuming this thing iterated a bazillion times, at least during the
PHP configured max script execution time, it busied the CPU to 100%
and also consumed a huge amount of memory.

Not sure if your PHP might be configured to have large amount of
memory available but a runaway loop like this can certainly cause a
server to THRASH, though probably not crash (as you have suggested).

Suspect the memory use put you over the acceptable paging limit for
this box.

Why don't you log into the machine interactively with telnet, SSH or
similar, run the defective PHP script and see what happens. Does your
Linux panic and halt? Or does the machine just go catatonic for a
while.

Can you see the machine physically and check for excessibe disk
activity which would indicate rapid paging.

If the interactive session does continue to respond, top, vmstat and
various other diagnostic tools can help you learn what's really
happening.

HTH

--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile http://www.JerrySievers.com/
Jul 17 '05 #4
Oliver Spiesshofer wrote:
Erwin Moller
<si******************************************@spam yourself.com> wrote in
news:42***********************@news.xs4all.nl:

Hi Oliver,

Are you sure it is a systemcrash?
I think only PHP stops responding untill the scripttimeout time has
elapsed.


No it doesnt, strange enough.
FTP and SSH to the machine dont work anymore either "Connection
refused"...

Oliver


Oops... That IS bad, Oliver.

I suggest you try Jerry Sievers suggestions in the other thread.

Login and see what the machine is doing.
'top' is a quick way to see what takes up the CPU time.

As far as I know, this shouldn't be possible...
Did you configure the machine yourself?
If it is at some provider (shared), ask them. :P

Regards,
Erwin Moller
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joris Gillis | last post by:
Hi everyone, I have this stylesheet: <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/>...
18
by: Elroyskimms | last post by:
I have a table using an identity column as its Primary Key and two columns (table reduced for simplicity) EmployeeNumber and ArrivalTime. CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (10)...
5
by: Bill Henning | last post by:
Does anyone know a good method of preventing keyboard and mouse events from interrupting processing? My situation is: 1) I need to track and handle all key and mouse events 2) I need to perform...
1
by: Tim Mulholland | last post by:
I have an application that uses an external C(?) Dll and it seems like after I make a specific call to that dll the application will crash at a random call to the dll in the future. It sometimes...
5
by: Wong_wj | last post by:
Hi all, I have created a VB.net application using: Microsoft Development Environment 2002 Version 7.0.9466 Microsoft .NET Framework 1.0 Version 1.0.3705 The application was working fine in...
1
by: jonefer | last post by:
What is the best mechanism/ convention for preventing stacked datagrids from overlapping each other? I'd like to do something similar to a "can shrink/can grow" in an Access report for an aspx...
22
by: walterbyrd | last post by:
I like to develop on my desktop, then when I get stuff working, I copy to my web-site. I set up a new version Xampp on my windows-2k desktop. And downloaded the stuff from the website to edit....
9
by: SharpCoderMP | last post by:
i've been experiencing random crashes on some machines running my app. the app never crashed in such way on my dev machine so i'm totally unable to debug this. the error page users get says...
8
by: mark_aok | last post by:
Hi all, I have a split database. Both the forms, and the tables are stored on a shared network drive (this is Access 2003). The users use the forms, and the tables on the network drive, there...
0
by: moltendorf | last post by:
I've been trying to find a suitable method for preventing race conditions in my own code. Currently I'm using a file and the flock function to prevent code in other threads from executing at the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.