r8883 -- kore coredumps when dcOnMaxReconnections value met

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderators: Moderators, Developers

Message
Author
User avatar
ChrstphrR
Testers Team
Testers Team
Posts: 42
Joined: 09 May 2010, 17:30
Noob?: No
Location: Northern Alberta, Canada

r8883 -- kore coredumps when dcOnMaxReconnections value met

#1 Post by ChrstphrR »

Using revision 8883, the following situation occurs:


From my config.txt, this disconnect-on-value was set:

Code: Select all

dcOnMaxReconnections 3
What should happen:
... while running a bot, and the connection between the server and bot is lost, kore will attempt to reconnect, based on this setting, up to 3 times unsuccessfully, and then *gracefully* exit.

What does happen:
... the graceful part was tossed out the window as of r8883.

Tail end of my console log:

Code: Select all

Connecting to Character Server...
Connecting (xxx.xx.xx.xxx:4500)... 
[Aug 9 10:08:00 2014.12] couldn't connect: Connection refused (error code 111)
[Aug 9 10:08:12 2014.16] Timeout on Character Server, reconnecting. Wait 30 seconds...
[Aug 9 10:08:42 2014.26] Connecting to Account Server...
[Aug 9 10:08:42 2014.26] Connecting (xxx.xx.xx.xxx:6800)... 
[Aug 9 10:08:42 2014.36] connected
[Aug 9 10:08:54 2014.40] Auto disconnecting on MaxReconnections!
From the errors.txt

Code: Select all

OpenKore version what-will-become-2.1
Network state = 1
Network handler = Network::DirectConnection
SVN revision: 8883M
Loaded plugins:
  plugins/ignore.pl (Ignore Spammers!; description: Version 0.1 r2)
  plugins/xconf.pl (xConf; description: commands for change items_control, mon_control, pickupitems, priority)
  plugins/breakTime.pl (breakTime; description: config.autoBreakTime)
  plugins/macro.pl (macro; description: allows usage of macros)
  plugins/cmdOnLogin/CR_Util.pl (CR Utilities; description: Ver: 0.0.0.1)
  plugins/cmdOnLogin/automapchange.pl (autoMapChange; description: autoMapChange - rotate lockMap fields)
  plugins/Examples/busCommands.pl (busCommands; description: receive and send commands (and messages too) via BUS system)

Error message:
Undefined subroutine &Network::DirectConnection::quit called at src/Network/DirectConnection.pm line 468.

Stack trace:
Undefined subroutine &Network::DirectConnection::quit called at src/Network/DirectConnection.pm line 468.
 at src/Network/DirectConnection.pm line 468
	Network::DirectConnection::checkConnection('Network::DirectConnection=HASH(0x54de978)') called at src/functions.pl line 716
	main::mainLoop_initialized() called at src/functions.pl line 70
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Unix=HASH(0x344d7c0)') called at ./openkore.pl line 97
	main::__start() called at ./openkore.pl line 202

Died at this line:
  				chatLog("k", T("*** Exceeded the maximum number attempts to reconnect, auto disconnect! ***\n"));
* 				quit();
  				return;
This behaviour did not happen with revision 8882 or prior.

This appears to have been an *untested* change, since altering this code causes a crash mentioning an undeclared routine. Even static testing would have sleuthed this out.

Being more helpful than ranting: This same call to "quit" that doesn't exist, occurs in this file, at lines 468 (found above), 519, 619, and 634.

Related code/diff snippet, as per "svn diff -r 8882:8883 src/Network/DirectConnection.pm":

Code: Select all

Modified: openkore/trunk/src/Network/DirectConnection.pm
===================================================================
--- openkore/trunk/src/Network/DirectConnection.pm      2014-07-25 21:26:47 UTC (rev 8882)
+++ openkore/trunk/src/Network/DirectConnection.pm      2014-08-08 23:58:54 UTC (rev 8883)
@@ -153,7 +153,7 @@
                        Proto           => 'tcp',
                        Timeout         => 4);
        ($self->{remote_socket} && inet_aton($self->{remote_socket}->peerhost()) eq inet_aton($host)) ?
-               message T("connected\n") :
+               message T("connected\n"), "connection" :
                error(TF("couldn't connect: %s (error code %d)\n", "$!", int($!)), "connection");
        if ($self->getState() != Network::NOT_CONNECTED) {
                $incomingMessages->nextMessageMightBeAccountID();
@@ -463,7 +463,9 @@

                } elsif (timeOut($timeout{'master'}) && timeOut($timeout_ex{'master'})) {
                        if ($config{dcOnMaxReconnections} && $config{dcOnMaxReconnections} <= $reconnectCount) {
-                               $quit = 1;
+                               message T("Auto disconnecting on MaxReconnections!\n");
+                               chatLog("k", T("*** Exceeded the maximum number attempts to reconnect, auto disconnect! ***\n"));
+                               quit();
                                return;
                        }
                        error T("Timeout on Account Server, reconnecting...\n"), "connection";
This same sort of change was altered in other modules changed in the commit, so there are quite likely many more spots that are crashing in the same manner.

User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: r8883 -- kore coredumps when dcOnMaxReconnections value met

#2 Post by 4epT »

fixed r8884
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

Locked