PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Infinite PHP function stack crashes Apache in Vista - Fixable?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Infinite PHP function stack crashes Apache in Vista - Fixable?

Réponse
 
LinkBack Outils de la discussion
Vieux 09/02/2008, 16h05   #1
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Infinite PHP function stack crashes Apache in Vista - Fixable?


The following PHP code causes Apache to crash and PHP to suspend:

a() ; function a(){return a();}

This is running EasyPHP under Vista.

How to fix?

Thanks,

P.
  Réponse avec citation
Vieux 09/02/2008, 18h21   #2
ZeldorBlat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:
> The following PHP code causes Apache to crash and PHP to suspend:
>
> a() ; function a(){return a();}
>
> This is running EasyPHP under Vista.
>
> How to fix?
>
> Thanks,
>
> P.


Ummm, don't try to run an infinite loop?
  Réponse avec citation
Vieux 09/02/2008, 22h04   #3
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 9, 1:21pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
> On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:
>
> > The following PHP code causes Apache to crash and PHP to suspend:

>
> > a() ; function a(){return a();}

>
> > This is running EasyPHP under Vista.

>
> > How to fix?

>
> > Thanks,

>
> > P.

>
> Ummm, don't try to run an infinite loop?


Solve Turing's Unsolvability of the Halting Problem!

Would it be easier to fix Apache?

P.




  Réponse avec citation
Vieux 10/02/2008, 10h08   #4
GarethAtFlignet
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:
> On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
>
> > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > The following PHP code causes Apache to crash and PHP to suspend:

>
> > > a() ; function a(){return a();}

>
> > > This is running EasyPHP under Vista.

>
> > > How to fix?

>
> > > Thanks,

>
> > > P.

>
> > Ummm, don't try to run an infinite loop?

>
> Solve Turing's Unsolvability of the Halting Problem!
>
> Would it be easier to fix Apache?
>
> P.


couple of things:

1) add a usleep(1) or something to give the CPU a rest within the
infinite loop.
2) increase the max execution time

3... choose a more appropriate language for what you are trying to do
lol
  Réponse avec citation
Vieux 10/02/2008, 14h45   #5
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 10, 5:08am, GarethAtFlignet <garethinwa...@googlemail.com>
wrote:
> On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:
>
>
>
>
>
> > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:

>
> > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > The following PHP code causes Apache to crash and PHP to suspend:

>
> > > > a() ; function a(){return a();}

>
> > > > This is running EasyPHP under Vista.

>
> > > > How to fix?

>
> > > > Thanks,

>
> > > > P.

>
> > > Ummm, don't try to run an infinite loop?

>
> > Solve Turing's Unsolvability of the Halting Problem!

>
> > Would it be easier to fix Apache?

>
> > P.

>
> couple of things:
>
> 1) add a usleep(1) or something to give the CPU a rest within the
> infinite loop.
> 2) increase the max execution time
>
> 3... choose a more appropriate language for what you are trying to do
> lol- Hide quoted text -


4) Get a stack error (instead of crashing Apache)?

> - Show quoted text -


  Réponse avec citation
Vieux 10/02/2008, 18h46   #6
GarethAtFlignet
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote:
> On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com>
> wrote:
>
>
>
> > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:

>
> > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > The following PHP code causes Apache to crash and PHP to suspend:

>
> > > > > a() ; function a(){return a();}

>
> > > > > This is running EasyPHP under Vista.

>
> > > > > How to fix?

>
> > > > > Thanks,

>
> > > > > P.

>
> > > > Ummm, don't try to run an infinite loop?

>
> > > Solve Turing's Unsolvability of the Halting Problem!

>
> > > Would it be easier to fix Apache?

>
> > > P.

>
> > couple of things:

>
> > 1) add a usleep(1) or something to give the CPU a rest within the
> > infinite loop.
> > 2) increase the max execution time

>
> > 3... choose a more appropriate language for what you are trying to do
> > lol- Hide quoted text -

>
> 4) Get a stack error (instead of crashing Apache)?
>
> > - Show quoted text -


Don't have a windows based PHP system to test on sorry, but at least
you now know why Apache is barfing

Try this...

<?php
set_time_limit ( 0 );
ignore_user_abort ( );

a();
function a(){
echo memory_get_usage()."\n";
return a();
}

?>

shows memory getting eaten up each loop (but not that much).. probably
a question for someone who knows the internals of PHP and how it
reacts to recursive calls. Seems to barf after around 32k recursive
calls...

You don't get this problem with an infinite loop.
  Réponse avec citation
Vieux 10/02/2008, 18h51   #7
GarethAtFlignet
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com>
wrote:
> On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote:
>
>
>
> > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com>
> > wrote:

>
> > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:

>
> > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > > The following PHP code causes Apache to crash and PHP to suspend:

>
> > > > > > a() ; function a(){return a();}

>
> > > > > > This is running EasyPHP under Vista.

>
> > > > > > How to fix?

>
> > > > > > Thanks,

>
> > > > > > P.

>
> > > > > Ummm, don't try to run an infinite loop?

>
> > > > Solve Turing's Unsolvability of the Halting Problem!

>
> > > > Would it be easier to fix Apache?

>
> > > > P.

>
> > > couple of things:

>
> > > 1) add a usleep(1) or something to give the CPU a rest within the
> > > infinite loop.
> > > 2) increase the max execution time

>
> > > 3... choose a more appropriate language for what you are trying to do
> > > lol- Hide quoted text -

>
> > 4) Get a stack error (instead of crashing Apache)?

>
> > > - Show quoted text -

>
> Don't have a windows based PHP system to test on sorry, but at least
> you now know why Apache is barfing
>
> Try this...
>
> <?php
> set_time_limit ( 0 );
> ignore_user_abort ( );
>
> a();
> function a(){
> echo memory_get_usage()."\n";
> return a();
>
> }
>
> ?>
>
> shows memory getting eaten up each loop (but not that much).. probably
> a question for someone who knows the internals of PHP and how it
> reacts to recursive calls. Seems to barf after around 32k recursive
> calls...
>
> You don't get this problem with an infinite loop.


Oops sorry, quite easy to see whats the problem really. return a()
calls the function a() and attempts to return the results which in
turn creates another call to a() and so on. Therefore this will eat up
resources each recursion and therefore fail. Maybe this would work
better in a language that doesn't perform runtime interpretation.
  Réponse avec citation
Vieux 10/02/2008, 23h49   #8
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 10, 1:51pm, GarethAtFlignet <garethinwa...@googlemail.com>
wrote:
> On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com>
> wrote:
>
>
>
>
>
> > On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com>
> > > wrote:

>
> > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:

>
> > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > > > The following PHP code causes Apache to crash and PHP to suspend:

>
> > > > > > > a() ; function a(){return a();}

>
> > > > > > > This is running EasyPHP under Vista.

>
> > > > > > > How to fix?

>
> > > > > > > Thanks,

>
> > > > > > > P.

>
> > > > > > Ummm, don't try to run an infinite loop?

>
> > > > > Solve Turing's Unsolvability of the Halting Problem!

>
> > > > > Would it be easier to fix Apache?

>
> > > > > P.

>
> > > > couple of things:

>
> > > > 1) add a usleep(1) or something to give the CPU a rest within the
> > > > infinite loop.
> > > > 2) increase the max execution time

>
> > > > 3... choose a more appropriate language for what you are trying to do
> > > > lol- Hide quoted text -

>
> > > 4) Get a stack error (instead of crashing Apache)?

>
> > > > - Show quoted text -

>
> > Don't have a windows based PHP system to test on sorry, but at least
> > you now know why Apache is barfing

>
> > Try this...

>
> > <?php
> > set_time_limit ( 0 );
> > ignore_user_abort ( );

>
> > a();
> > function a(){
> > echo memory_get_usage()."\n";
> > return a();

>
> > }

>
> > ?>

>
> > shows memory getting eaten up each loop (but not that much).. probably
> > a question for someone who knows the internals of PHP and how it
> > reacts to recursive calls. Seems to barf after around 32k recursive
> > calls...

>
> > You don't get this problem with an infinite loop.

>
> Oops sorry, quite easy to see whats the problem really. return a()
> calls the function a() and attempts to return the results which in
> turn creates another call to a() and so on. Therefore this will eat up
> resources each recursion and therefore fail.


Silly, the program should bomb, not Apache.

> Maybe this would work
> better in a language that doesn't perform runtime interpretation.- Hide quoted text -
>
> - Show quoted text -


  Réponse avec citation
Vieux 11/02/2008, 09h38   #9
GarethAtFlignet
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 10, 11:49 pm, PHPBABY3 <shymath...@gmail.com> wrote:
> On Feb 10, 1:51 pm, GarethAtFlignet <garethinwa...@googlemail.com>
> wrote:
>
>
>
> > On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com>
> > wrote:

>
> > > On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com>
> > > > wrote:

>
> > > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:

>
> > > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > > > > The following PHP code causes Apache to crash and PHP to suspend:

>
> > > > > > > > a() ; function a(){return a();}

>
> > > > > > > > This is running EasyPHP under Vista.

>
> > > > > > > > How to fix?

>
> > > > > > > > Thanks,

>
> > > > > > > > P.

>
> > > > > > > Ummm, don't try to run an infinite loop?

>
> > > > > > Solve Turing's Unsolvability of the Halting Problem!

>
> > > > > > Would it be easier to fix Apache?

>
> > > > > > P.

>
> > > > > couple of things:

>
> > > > > 1) add a usleep(1) or something to give the CPU a rest within the
> > > > > infinite loop.
> > > > > 2) increase the max execution time

>
> > > > > 3... choose a more appropriate language for what you are trying to do
> > > > > lol- Hide quoted text -

>
> > > > 4) Get a stack error (instead of crashing Apache)?

>
> > > > > - Show quoted text -

>
> > > Don't have a windows based PHP system to test on sorry, but at least
> > > you now know why Apache is barfing

>
> > > Try this...

>
> > > <?php
> > > set_time_limit ( 0 );
> > > ignore_user_abort ( );

>
> > > a();
> > > function a(){
> > > echo memory_get_usage()."\n";
> > > return a();

>
> > > }

>
> > > ?>

>
> > > shows memory getting eaten up each loop (but not that much).. probably
> > > a question for someone who knows the internals of PHP and how it
> > > reacts to recursive calls. Seems to barf after around 32k recursive
> > > calls...

>
> > > You don't get this problem with an infinite loop.

>
> > Oops sorry, quite easy to see whats the problem really. return a()
> > calls the function a() and attempts to return the results which in
> > turn creates another call to a() and so on. Therefore this will eat up
> > resources each recursion and therefore fail.

>
> Silly, the program should bomb, not Apache.
>
> > Maybe this would work
> > better in a language that doesn't perform runtime interpretation.- Hide quoted text -

>
> > - Show quoted text -


The program does bomb (run it from the command prompt). Under linux
apache itself doesnt fail. Maybe something to do with the Windows
version/distro of PHP/Apache you are using.
  Réponse avec citation
Vieux 12/02/2008, 01h56   #10
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 11, 4:38am, GarethAtFlignet <garethinwa...@googlemail.com>
wrote:
> On Feb 10, 11:49 pm, PHPBABY3 <shymath...@gmail.com> wrote:
>
>
>
>
>
> > On Feb 10, 1:51 pm, GarethAtFlignet <garethinwa...@googlemail.com>
> > wrote:

>
> > > On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com>
> > > wrote:

>
> > > > On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com>
> > > > > wrote:

>
> > > > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:

>
> > > > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:

>
> > > > > > > > > The following PHP code causes Apache to crash and PHP to suspend:

>
> > > > > > > > > a() ; function a(){return a();}

>
> > > > > > > > > This is running EasyPHP under Vista.

>
> > > > > > > > > How to fix?

>
> > > > > > > > > Thanks,

>
> > > > > > > > > P.

>
> > > > > > > > Ummm, don't try to run an infinite loop?

>
> > > > > > > Solve Turing's Unsolvability of the Halting Problem!

>
> > > > > > > Would it be easier to fix Apache?

>
> > > > > > > P.

>
> > > > > > couple of things:

>
> > > > > > 1) add a usleep(1) or something to give the CPU a rest within the
> > > > > > infinite loop.
> > > > > > 2) increase the max execution time

>
> > > > > > 3... choose a more appropriate language for what you are trying to do
> > > > > > lol- Hide quoted text -

>
> > > > > 4) Get a stack error (instead of crashing Apache)?

>
> > > > > > - Show quoted text -

>
> > > > Don't have a windows based PHP system to test on sorry, but at least
> > > > you now know why Apache is barfing

>
> > > > Try this...

>
> > > > <?php
> > > > set_time_limit ( 0 );
> > > > ignore_user_abort ( );

>
> > > > a();
> > > > function a(){
> > > > echo memory_get_usage()."\n";
> > > > return a();

>
> > > > }

>
> > > > ?>

>
> > > > shows memory getting eaten up each loop (but not that much).. probably
> > > > a question for someone who knows the internals of PHP and how it
> > > > reacts to recursive calls. Seems to barf after around 32k recursive
> > > > calls...

>
> > > > You don't get this problem with an infinite loop.

>
> > > Oops sorry, quite easy to see whats the problem really. return a()
> > > calls the function a() and attempts to return the results which in
> > > turn creates another call to a() and so on. Therefore this will eat up
> > > resources each recursion and therefore fail.

>
> > Silly, the program should bomb, not Apache.

>
> > > Maybe this would work
> > > better in a language that doesn't perform runtime interpretation.- Hide quoted text -

>
> > > - Show quoted text -

>
> The program does bomb (run it from the command prompt). Under linux
> apache itself doesnt fail. Maybe something to do with the Windows
> version/distro of PHP/Apache you are using.


Oh! I read that this bug in PHP has existed for years, and the
developers always refused to fix it. I didn' read where it has been
fixed under Linux. (I'm surprised the OS makes a difference - not
real good.) I wonder if they'll get to Windows? I can see where
their heart is! : )

P.

> Hide quoted text -
>
> - Show quoted text -


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 04h56.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,31718 seconds with 18 queries