Re: Schroedinger's Bug - may require exorcism...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2005-11-29 at 19:22, Adam Atlas wrote:
> So... I have this script (being called in a perfectly typical way by  
> PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs  
> perfectly, and sometimes chooses, totally haphazardly, to seemingly  
> run itself twice, which of course causes it to die with a fatal error  
> after it tries to redefine some functions.
> 
> As mysterious as that is, it turns out it must be something  
> altogether more sinister. I tried putting die() at the end of the  
> script, on the assumption that it was for some reason executing  
> twice, yet behold: the problem is still present, and the PHP error  
> log still complains about constants and functions being redefined!  
> The problem, I therefore thought, cannot be that the script is being  
> run twice. (In retrospect, this was the most likely possibility,  
> because the page doesn't actually output anything if it dies with  
> this error.) So for debugging, I added a bit that logs one message to  
> a file immediately before the die() at the end of the file, and a  
> different message after the die(). The die() seems to be working  
> normally, in that it only logs the first message...
> 
> But wait a second! WTF? If the PHP error log is to be believed, then  
> the script should be dying with a fatal error before it even *gets*  
> to that point in the script, isn't it?
> 
> And the greater WTF is the fact that, as I mentioned above, every  
> time the page is requested, it unpredictably either does this or  
> works flawlessly. Oh my. How do I even *begin* to debug something  
> like this?

I think you mean heisenbug...

    http://en.wikipedia.org/wiki/Heisenbug
    http://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat

Do a grep for dynamic includes of the file script in question.
Alternatively do a grep for files that dynamically include the script in
question. Work your way to the root.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux