Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.14

Bug #20974 reconnect is not indefinite
Submitted: 2015-10-27 02:19 UTC
From: glen Assigned: garrettw
Status: Closed Package: Net_SmartIRC (version 1.1.8)
PHP Version: 5.5.30 OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 38 + 28 = ?

 
 [2015-10-27 02:19 UTC] glen (Elan Ruusamäe)
Description: ------------ it's impossible to configure it to retry forever first, there's no way setting it such, i tried "0", but that disabled reconnect at all, so i set PHP_INT_MAX. but due the way reconnect is designed, php runs out of recursion limit: Oct 27 00:15:59 SmartIRC.php(1111) retry #48 PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /usr/share/pear/Net/SmartIRC.php on line 909 PHP Stack trace: PHP 1. {main}() /usr/share/eventum/bin/irc-bot.php:0 PHP 2. Eventum_Bot->run() /usr/share/eventum/bin/irc- bot.php:69 PHP 3. Net_SmartIRC->connect() /usr/share/eventum/lib/eventum/irc/Eventum_Bot.php:222 PHP 4. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 5. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 6. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 7. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 8. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 9. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 10. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 11. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 12. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 13. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 14. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 15. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 16. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 17. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 18. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 19. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 20. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 21. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 22. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 23. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 24. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 25. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 26. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 PHP 27. Net_SmartIRC->connect() /usr/share/pear/Net/SmartIRC.php:1208 PHP 28. Net_SmartIRC->reconnect() /usr/share/pear/Net/SmartIRC.php:1112 ....

Comments

 [2015-10-27 02:34 UTC] glen (Elan Ruusamäe)
i've workarounded in my bot to do "userspace" reconnecting. something like: // reconnect is poorly designed, do not use it // @see https://pear.php.net/bugs/bug.php?id=20974 $irc->setAutoRetry(false); $irc->setAutoRetryMax(PHP_INT_MAX); $irc->setReconnectDelay(1000); $irc->connect($config['hostname'], $config['port']); $irc->login($config['nickname'], $config['realname']); $this->joinChannels($irc); while (!$this->shutdown) { $irc->listen(); $irc->reconnect(); } $irc->disconnect();
 [2015-11-11 01:29 UTC] garrettw (Garrett Whitehorn)
-Status: Open +Status: Closed -Assigned To: +Assigned To: garrettw
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Setting autoRetryMax to 0 should indeed imply endless retries, so I've corrected that. You can use 0 now. Also I've changed the way reconnect() and connect() interact, so they won't keep calling each other endlessly. It just loops now. Let me know if it works for you.
 [2018-05-01 18:06 UTC] glen (Elan Ruusamäe)
seems to gain the needed functionality i need to reorder commands: $irc->setAutoRetryMax(0); $irc->setAutoRetry(true); setAutoRetryMax resets setAutoRetry to false somewhy