is there any way to abort a php script (automatically) if there's no more output within 10 seconds for example?
I'm working on a website where people can register their nicknames / chatrooms etc.
now, if 3 people would want to register their nick on the same time (or within 5 minutes) - the third one would be throttled.
this would cause the php script to run endless with a massive load (about 99%) - and within just a few minutes the whole server would crash - if I wouldn't kill the processes.
I've tried it with set_time_limit(10); - but this doesn't work.
this is the output I get, before it stops:
-----------------------------------------------
Oct 17 16:41:43 SmartIRC.php(757) benchmark started
Oct 17 16:41:43 SmartIRC.php(944) DEBUG_CONNECTION: connecting
Oct 17 16:41:43 SmartIRC.php(953) DEBUG_SOCKET: using fsockets
Oct 17 16:41:43 SmartIRC.php(978) DEBUG_CONNECTION: connected
Oct 17 16:41:43 SmartIRC.php(982) DEBUG_SOCKET: activating nonblocking fsocket mode
Oct 17 16:41:43 SmartIRC.php(1103) DEBUG_CONNECTION: logging in
Oct 17 16:41:43 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "NICK services"
Oct 17 16:41:43 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "USER TEST 0 * :Test User"
---> now, it hangs....
-----------------------------------------------
"Oct 17 16:41:43 SmartIRC.php(953) DEBUG_SOCKET: using fsockets"
you really should install the sockets extension for PHP, then SmartIRC runs _much_ better... (and doesn't suck 99% cpu)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
will it terminate an endless running script (as described in my last posting) when I install the php socket extensions? or does this only fix the high cpu load?
because if it won't terminate the bogus scripts, there would come up another problem after a while --- "too many open files" - and the system would crash again...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think this would maybe fix the problem at all.... I am not sure, if its doesn't fix all problems, please report them here with more detailed info (debug log, bot setup, etc...).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
but the script still hangs and does not terminate. here's the debug log:
Oct 22 10:49:54 SmartIRC.php(757) benchmark started
Oct 22 10:49:54 SmartIRC.php(944) DEBUG_CONNECTION: connecting
Oct 22 10:49:54 SmartIRC.php(949) DEBUG_SOCKET: using real sockets
Oct 22 10:49:54 SmartIRC.php(978) DEBUG_CONNECTION: connected
Oct 22 10:49:54 SmartIRC.php(1103) DEBUG_CONNECTION: logging in
Oct 22 10:49:54 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "NICK services"
Oct 22 10:49:54 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "USER NEKA 0 * :SHOE Service Bot: Stat "
Warning: socket_write() unable to write to socket [32]: Broken pipe in /data/www/chatserver/SmartIRC-1.76/SmartIRC.php on line 1745
Oct 22 10:49:54 SmartIRC.php(1360) DEBUG_ACTIONHANDLER: actionhandler(0) registered
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
eeeks, it should never create any problems like this on *nix, I expected you have a windows system, there those problems happen often because of broken TCP/IP or sockets implementation....
Could I get an account on that box for testing? I believe it's a deep problem... is it freebsd and you use PHP lower than 4.3.2 ? there was a problem with sockets... maybe its happening here again, if not please let me know if I can analyse that on your box...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need a shell account, because I want to debug SmartIRC in the environment where it makes troubles...
all I need is: bash, cvs client, your IRC script
send me the login info to meebey@php.net please...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi all :)
is there any way to abort a php script (automatically) if there's no more output within 10 seconds for example?
I'm working on a website where people can register their nicknames / chatrooms etc.
now, if 3 people would want to register their nick on the same time (or within 5 minutes) - the third one would be throttled.
this would cause the php script to run endless with a massive load (about 99%) - and within just a few minutes the whole server would crash - if I wouldn't kill the processes.
I've tried it with set_time_limit(10); - but this doesn't work.
this is the output I get, before it stops:
-----------------------------------------------
Oct 17 16:41:43 SmartIRC.php(757) benchmark started
Oct 17 16:41:43 SmartIRC.php(944) DEBUG_CONNECTION: connecting
Oct 17 16:41:43 SmartIRC.php(953) DEBUG_SOCKET: using fsockets
Oct 17 16:41:43 SmartIRC.php(978) DEBUG_CONNECTION: connected
Oct 17 16:41:43 SmartIRC.php(982) DEBUG_SOCKET: activating nonblocking fsocket mode
Oct 17 16:41:43 SmartIRC.php(1103) DEBUG_CONNECTION: logging in
Oct 17 16:41:43 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "NICK services"
Oct 17 16:41:43 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "USER TEST 0 * :Test User"
---> now, it hangs....
-----------------------------------------------
this is the code:
$irc = &new Net_SmartIRC();
$irc->startBenchmark();
$irc->setBenchmark(TRUE);
$irc->setUseSockets(FALSE);
$irc->setDebug(SMARTIRC_DEBUG_ALL);
$irc->connect('irc.some.net', 6667);
$irc->login('services', 'Test User', 0, 'TEST');
$irc->getUsers();
$get_info = $irc->listenFor(SMARTIRC_TYPE_INFO);
$irc->disconnect();
$irc->stopBenchmark();
-----------------------------------------------
my temorary solution is now to disable the connection-throttling code in our chatserver software. but there should be a better solution...
any suggestion?
"Oct 17 16:41:43 SmartIRC.php(953) DEBUG_SOCKET: using fsockets"
you really should install the sockets extension for PHP, then SmartIRC runs _much_ better... (and doesn't suck 99% cpu)
thanx for your reply! :o)
will it terminate an endless running script (as described in my last posting) when I install the php socket extensions? or does this only fix the high cpu load?
because if it won't terminate the bogus scripts, there would come up another problem after a while --- "too many open files" - and the system would crash again...
I think this would maybe fix the problem at all.... I am not sure, if its doesn't fix all problems, please report them here with more detailed info (debug log, bot setup, etc...).
ok, I've now compiled php with sockets and set
$irc->setUseSockets(TRUE);
but the problem is still not solved. the good thing is, the cpu load of the script is a bit lower than 99%
root 32520 75.1 0.8 9248 4228 pts/1 R 10:49 8:04 \_ /usr/local/bin/php -f /www/chatserver/shell_scripts/gener
-> it's 75.1%
but the script still hangs and does not terminate. here's the debug log:
Oct 22 10:49:54 SmartIRC.php(757) benchmark started
Oct 22 10:49:54 SmartIRC.php(944) DEBUG_CONNECTION: connecting
Oct 22 10:49:54 SmartIRC.php(949) DEBUG_SOCKET: using real sockets
Oct 22 10:49:54 SmartIRC.php(978) DEBUG_CONNECTION: connected
Oct 22 10:49:54 SmartIRC.php(1103) DEBUG_CONNECTION: logging in
Oct 22 10:49:54 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "NICK services"
Oct 22 10:49:54 SmartIRC.php(1742) DEBUG_IRCMESSAGES: sent: "USER NEKA 0 * :SHOE Service Bot: Stat "
Warning: socket_write() unable to write to socket [32]: Broken pipe in /data/www/chatserver/SmartIRC-1.76/SmartIRC.php on line 1745
Oct 22 10:49:54 SmartIRC.php(1360) DEBUG_ACTIONHANDLER: actionhandler(0) registered
eeeks, it should never create any problems like this on *nix, I expected you have a windows system, there those problems happen often because of broken TCP/IP or sockets implementation....
Could I get an account on that box for testing? I believe it's a deep problem... is it freebsd and you use PHP lower than 4.3.2 ? there was a problem with sockets... maybe its happening here again, if not please let me know if I can analyse that on your box...
;-) no, I'm not using any microsoft products *LOL*
I'm running this script on SuSE Linux 8.0 / PHP version 4.3.3
what kind of account do you need? is ftp ok? or do you need a shell account? please let me know.
I'll send these information to you later by email - need to eat something first ;-)
I need a shell account, because I want to debug SmartIRC in the environment where it makes troubles...
all I need is: bash, cvs client, your IRC script
send me the login info to meebey@php.net please...