Menu

#387 Not printing in console when a bot is force stopped

1.9.3.0
closed
console (1)
1
2017-10-17
2017-09-05
Julian Kent
No

There has been some discussion on the robowiki about missing printing from the console when turns are skipped. http://robowiki.net/wiki/Thread:Talk:RoboRumble/ThreadDeath_problem This has been traced to a lack of locks which results in these prints being cleaned up when the round is ended, but before it gets printed.

Here is a patch which fixes it:

diff --git a/robocode.battle/src/main/java/net/sf/robocode/battle/peer/RobotPeer.java b/robocode.battle/src/main/java/net/sf/robocode/battle/peer/RobotPeer.java
index 330e4f2..ff81d39 100644
--- a/robocode.battle/src/main/java/net/sf/robocode/battle/peer/RobotPeer.java
+++ b/robocode.battle/src/main/java/net/sf/robocode/battle/peer/RobotPeer.java
@@ -759,9 +759,10 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
                readoutEvents();
                readoutTeamMessages();
                readoutBullets();
-
-               battleText.setLength(0);
-               proxyText.setLength(0);
+               synchronized (proxyText) {
+                       battleText.setLength(0);
+                       proxyText.setLength(0);
+               }

                // Prepare new execution commands, but copy the colors from the last commands.
                // Bugfix [2628217] - Robot Colors don't stick between rounds.
@@ -1700,8 +1701,10 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
                events = null;
                teamMessages = null;
                bulletUpdates = null;
-               battleText.setLength(0);
-               proxyText.setLength(0);
+               synchronized (proxyText) {
+                       battleText.setLength(0);
+                       proxyText.setLength(0);
+               }
                statics = null;
                battleRules = null;
        }

We are still continuing our investigation into why these bots are being disabled to begin with, as it seems to be worse on certain systems. So please don't make a new release straight away, we may have more patches soon.

Thanks
Julian

Discussion

  • Flemming N. Larsen

    • Group: Future Release --> 1.9.2.7
     
  • Flemming N. Larsen

    Thanks for reporting this. I will have a look into this and verify the fix. I will also wait with making a release till the other issues have been resolved. I could make some Alpha versions, we could try out before the real release. :-)

     
  • Flemming N. Larsen

    • Group: 1.9.2.7 --> 1.9.3.0
     
  • Flemming N. Larsen

    • status: open --> pending
     
  • Flemming N. Larsen

    • status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB