...

View Full Version : register_tick_function() on Windows



bauhsoj
01-04-2006, 06:46 AM
If I reconfigure PHP 5.1.1 to load as a CGI with Apache 2.2 would I be able to get register_tick_function() to work without crashing the server?

I am trying to track down some code that is overloading the server but does so seemingly at random.

mlse
01-04-2006, 11:48 AM
Hmmm ... this could be a possibilty:


register_tick_function() should not be used with threaded webserver modules. Ticks are not working in ZTS mode and may crash your webserver.
(Quote taken from: http://uk.php.net/manual/en/function.register-tick-function.php).

Sounds like it could be a race condition? My experience of multi-threaded real-time coding in C, C++ and assembly is that race errors manifest themselves as random crashes in seemingly good code.

bauhsoj
01-06-2006, 10:08 PM
Sounds like it could be a race condition? My experience of multi-threaded real-time coding in C, C++ and assembly is that race errors manifest themselves as random crashes in seemingly good code.

Race condition? :confused:

mlse
01-07-2006, 11:36 AM
A race condition occurs when two asynchronous threads or processes attempt to access the same resource at the same time, possibly leading to bus or memory contention and therefore a crash.

For example, if I was writing a multi-threaded program in C and I tried to alter the storage referenced by a pointer in two threads at the same time, I would most probably end up with a crash and a rude message, something like: "segmentation violation: core dumped".

Here's the wikipedia definition: http://en.wikipedia.org/wiki/Race_condition

Anyway, none of that specifically answers your original question! I appologise. Ok, I figure that *could* be a problem, but before you start trying to track down possible race hazards in someone else's code (not fun), you could check for the obvious things like perhaps you're not freeing up memory resources, or something like that! I usually find that when I have weird problems like you've described it's because I'm trying to do something dodgy/illegal/plain stupid with memory somewhere and I haven't noticed it! Anyway, that link I posted seems to suggest that register_tick_function is dodgy under certain conditions.

I hope that helps!

bauhsoj
02-17-2006, 07:07 PM
Thanks for all the help. Unfortunately I never quite figured out what the problem was. I am going to be attempting other avenues to track down the source of the problem.

Thanks again!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum