Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts

    register_tick_function() on Windows

    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.

  • #2
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    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...-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.
    Die Welt ist ein Irrenhaus und hier ist die Zentrale!

  • #3
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlse
    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?

  • #4
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    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!
    Die Welt ist ein Irrenhaus und hier ist die Zentrale!

  • #5
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •