php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26771 register_tick_funtions crash under threaded webservers
Submitted: 2004-01-02 19:23 UTC Modified: 2009-04-21 01:00 UTC
Votes:52
Avg. Score:4.6 ± 0.7
Reproduced:44 of 46 (95.7%)
Same Version:22 (50.0%)
Same OS:29 (65.9%)
From: info at tphnet dot com Assigned: rasmus (profile)
Status: No Feedback Package: *General Issues
PHP Version: 6CVS, 5CVS, 4CVS OS: * (ZTS only!)
Private report: No CVE-ID: None
 [2004-01-02 19:23 UTC] info at tphnet dot com
Description:
------------
While searching the bug database I found some similar problems, but all were suspended. I wasn't sure if it was useful to reply to one of those (Most recent one: http://bugs.php.net/bug.php?id=26286). Well anyways, here goes:

The problem is very simple. I just copy and paste the 'tick' example from the php manual into a new php file an try to execute it on my apache2 server.
The apache child process crashes, restarts, crashes, restarts and eventually just stops restarting. When I comment out the line 'register_tick_function', everyting works just fine.
Also, when I start the file from the CLI version of PHP it is executed without any problems.

I'm using PHP 4.3.4 and Apache 2.0.48 (in conjunction with php4apache2.dll).

Reproduce code:
---------------
http://nl.php.net/manual/en/control-structures.declare.php

See Example 11-1

Actual result:
--------------
[Sat Jan 03 01:11:04 2004] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sat Jan 03 01:11:04 2004] [notice] Parent: Created child process 3036
[Sat Jan 03 01:11:04 2004] [notice] Child 3036: Child process is running
[Sat Jan 03 01:11:04 2004] [notice] Child 3036: Acquired the start mutex.
[Sat Jan 03 01:11:04 2004] [notice] Child 3036: Starting 250 worker threads.

Small snippit from my apache2 error.log. It's filled with the above lines, the status code is the same for every restart.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-10 20:02 UTC] rasmus@php.net
You are probably right that the tick stuff is broken in ZTS mode.  But I doubt anybody is all that interested in fixing it as it is a very fringe feature in a very fringe environment.  You can always hope, but chances are you will need to dig into the code yourself and send us a patch to get any movement on this.
 [2006-04-18 19:58 UTC] motin at demomusic dot nu
I do not have the skills to dig into the appropriate code, unfortunately. 

Possible workarounds:

1. Switch to Linux :) - If not wholly, do it by installing the free VMWare GSX Server and build up a server in there. Recommended because learning how to configure a Linux server is a great skill that all php-developers will gain on learning. 

2. PHP in cgi-mode is not affected, only php when running as an apache_module. I wanted to use ticks only for debugging purposes, and what I did while on windows was to configure httpd.conf so that accessing my site on port 85 would run php in cgi-mode instead of as a module. 

Here is a simplified section of my httpd.conf for this:

# Make sure no modules are loaded before VirtualHost-containers

Listen 80

<VirtualHost *:80>


 LoadFile "/Dev/Server/php5/php5apache2.dll"

 LoadModule php5_module "/Dev/Server/php5/php5apache2.dll"

 AddType application/x-httpd-php .php


 DocumentRoot /path

 ServerName localhost

<IfModule mod_php5.c>

 php_admin_value display_errors 0

 php_admin_value error_reporting 7

</IfModule>


</VirtualHost>



Listen 83


<VirtualHost *:83>

 RemoveType .php 

 Action     php5-script "/php/php-cgi.exe"

 AddHandler php5-script .php


 DocumentRoot /path

 ServerName localhost


 # php_admin_value and php_value is not possible in cgi-mode. These values has to be entered in php.ini

 # This section I found when trying to configure this myself back then. Do not know if it is needed
 # <Directory /path/to/php/>

 #  Options +ExecCGI +FollowSymLinks

 #  AllowOverride None

 #  Order allow,deny

 #  Allow from all

 # </Directory>



</VirtualHost>



Cheers!
 [2006-04-18 20:10 UTC] motin at demomusic dot nu
Noticed typo: Of course I meant 83 instead of 85. Also, too bad the post got screwed up, with doubled linebreaks in the example.
 [2006-07-04 16:10 UTC] astronouth7303 at gmail dot com
I've seen this bug on my set up as well.

PHP 5.0.5 (Apache2 handler)
Apache 2.0.55
Windows XP Pro v2002 SP2 (Windows NT 5.1 build 2600)

The way I've figured it out is that if the tick function (registered by register_tick_function()) is called (N ticks have gone by), PHP/Apache crash.

I'm not sure if this applies to everyone, but I also found that the Apache child process would not fully initialize after crashing. The new child process had to be killed manually, and the next child would finish initialization.
 [2007-01-24 13:07 UTC] sailormax at inbox dot lv
-- 3 years later --

PHP 5.2.0 (Apache2 handler)
Apache 2.2.3

problem still here...
and "broken" example (16-3) in help without any marks still here :)
http://lv.php.net/manual/en/control-structures.declare.php
 [2009-04-13 12:31 UTC] lbarnaud@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-04-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Nov 05 09:01:29 2024 UTC