gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] Bug report


From: Gunnar Farneback
Subject: Re: [gnugo-devel] Bug report
Date: Thu, 22 Jan 2004 23:07:39 +0100
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Olof Fridh wrote:
> Hi I am running a gnugo 3.5.3 bot on kgs. I have now managed to crash it 
> two times in the same way (It mostly doesn't crash then I try it but with 
> two similar crashes I thought I should report it).

It shouldn't crash at all so we're happy to have a report.

> Tried to start a 9x9 game with me as white and 0,5 komi.
> 
> Here is the error message
> 
> **assertion failure:
> move_reasons.c:871 - ON_BOARD1(dr) near [110]***
> 
>   (variation 96665)
>     A B C D E F G H J
>   9 . . . . . . . . . 9
>   8 . . . . . . . . . 8
>   7 . . + . . . + . . 7
>   6 . . . . . . . . . 6
>   5 . . . . + . . . . 5
>   4 . . . . . . . . . 4
>   3 . . + . . . + . . 3
>   2 . . . . . . . . . 2     WHITE (O) has captured 0 stones
>   1 . . . . . . . . . 1     BLACK (X) has captured 0 stones
>     A B C D E F G H J
> gnugo 3.5.3 (seed 2041500030): You stepped on a bug.

This looks kind of weird. I have no idea what could cause it. To get
further it could help with a backtrace (if you know how to produce
one) but even better would be a GTP command sequence to reproduce the
crash. In order to do that you need to take the following steps:

1. Apply the appended patch, alternatively wait for GNU Go 3.5.4
   (might take a while).
2. Add the option "--gtp-dump-commands kgs_commands.gtp" when starting
   GNU Go. For maximum reproducability it would also be good to use
   the option "-r 1" to set the initial random seed. The number can be
   chosen arbitrarily of course as long as you report what it is.
3. Wait for a crash, then send us the kgs_commands.gtp file. However,
   unless it's quite small (it probably isn't) it's better to either
   make it available over www or ftp (if you have the resources) or
   send it separately to me.

> The bug might be in kgs of course in that case please let me know so I can 
> report it to William Shubert.

In this case that should be highly unlikely.

/Gunnar

Index: interface/gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/gtp.c,v
retrieving revision 1.16
diff -u -r1.16 gtp.c
--- interface/gtp.c     13 Nov 2003 22:48:42 -0000      1.16
+++ interface/gtp.c     22 Jan 2004 21:16:20 -0000
@@ -70,7 +70,8 @@
 
 /* Read filehandle gtp_input linewise and interpret as GTP commands. */
 void
-gtp_main_loop(struct gtp_command commands[], FILE *gtp_input)
+gtp_main_loop(struct gtp_command commands[], FILE *gtp_input,
+             FILE *gtp_dump_commands)
 {
   char line[GTP_BUFSIZE];
   char command[GTP_BUFSIZE];
@@ -84,6 +85,9 @@
     if (!fgets(line, GTP_BUFSIZE, gtp_input))
       break; /* EOF or some error */
 
+    if (gtp_dump_commands)
+      fputs(line, gtp_dump_commands);
+    
     /* Preprocess the line. */
     for (i = 0, p = line; line[i]; i++) {
       char c = line[i];
Index: interface/gtp.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/gtp.h,v
retrieving revision 1.13
diff -u -r1.13 gtp.h
--- interface/gtp.h     18 Jul 2003 18:59:21 -0000      1.13
+++ interface/gtp.h     22 Jan 2004 21:16:20 -0000
@@ -64,7 +64,8 @@
   gtp_fn_ptr function;
 };
 
-void gtp_main_loop(struct gtp_command commands[], FILE *gtp_input);
+void gtp_main_loop(struct gtp_command commands[], FILE *gtp_input,
+                  FILE *gtp_dump_commands);
 void gtp_internal_set_boardsize(int size);
 void gtp_set_vertex_transform_hooks(gtp_transform_ptr in,
                                    gtp_transform_ptr out);
Index: interface/interface.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/interface.h,v
retrieving revision 1.13
diff -u -r1.13 interface.h
--- interface/interface.h       22 Jul 2003 19:50:29 -0000      1.13
+++ interface/interface.h       22 Jan 2004 21:16:20 -0000
@@ -35,7 +35,8 @@
                char *filename, char *until);
 void play_ascii_emacs(SGFTree *tree, Gameinfo *gameinfo, 
                      char *filename, char *until);
-void play_gtp(FILE *gtp_input, int gtp_initial_orientation);
+void play_gtp(FILE *gtp_input, FILE *gtp_dump_commands,
+             int gtp_initial_orientation);
 void play_gmp(Gameinfo *gameinfo, int simplified);
 void play_solo(Gameinfo *gameinfo, int benchmark);
 void play_replay(Gameinfo *gameinfo, int color_to_test);
Index: interface/main.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v
retrieving revision 1.88
diff -u -r1.88 main.c
--- interface/main.c    21 Jan 2004 18:20:45 -0000      1.88
+++ interface/main.c    22 Jan 2004 21:16:20 -0000
@@ -74,6 +74,7 @@
       OPT_OUTFILE, 
       OPT_QUIET,
       OPT_GTP_INPUT,
+      OPT_GTP_DUMP_COMMANDS,
       OPT_GTP_INITIAL_ORIENTATION,
       OPT_GTP_VERSION,
       OPT_SHOWCOPYRIGHT,
@@ -186,6 +187,7 @@
   {"quiet",          no_argument,       0, OPT_QUIET},
   {"silent",         no_argument,       0, OPT_QUIET},
   {"gtp-input",      required_argument, 0, OPT_GTP_INPUT},
+  {"gtp-dump-commands", required_argument, 0, OPT_GTP_DUMP_COMMANDS},
   {"orientation",    required_argument, 0, OPT_GTP_INITIAL_ORIENTATION},
   {"gtp-initial-orientation",
                     required_argument, 0, OPT_GTP_INITIAL_ORIENTATION},
@@ -304,6 +306,7 @@
   char *outfile = NULL;
   char *outflags = NULL;
   char *gtpfile = NULL;
+  char *gtp_dump_commands_file = NULL;
   
   char *printsgffile = NULL;
   
@@ -312,7 +315,9 @@
   char debuginfluence_move[4] = "\0";
   
   int benchmark = 0;  /* benchmarking mode (-b) */
-  FILE *gtp_input_FILE, *output_check;
+  FILE *gtp_input_FILE;
+  FILE *gtp_dump_commands_FILE = NULL;
+  FILE *output_check;
   int orientation = 0;
 
   float memory = (float) DEFAULT_MEMORY; /* Megabytes used for hash table. */
@@ -439,6 +444,10 @@
        gtpfile = gg_optarg;
        break;
        
+      case OPT_GTP_DUMP_COMMANDS:
+       gtp_dump_commands_file = gg_optarg;
+       break;
+       
       case OPT_GTP_INITIAL_ORIENTATION:
        orientation = atoi(gg_optarg);
        if (orientation < 0 || orientation > 7) {
@@ -1333,7 +1342,16 @@
     else
       gtp_input_FILE = stdin;
 
-    play_gtp(gtp_input_FILE, orientation);
+    if (gtp_dump_commands_file != NULL) {
+      gtp_dump_commands_FILE = fopen(gtp_dump_commands_file, "w");
+      if (gtp_dump_commands_FILE == NULL) {
+       fprintf(stderr, "gnugo: Cannot open file %s\n",
+               gtp_dump_commands_file);
+       return EXIT_FAILURE;
+      } 
+    }
+
+    play_gtp(gtp_input_FILE, gtp_dump_commands_FILE, orientation);
     break;
 
   case MODE_ASCII_EMACS:  
@@ -1507,6 +1525,7 @@
    --replay <color>              replay game. Use with -o.\n\
    --showscore                   print estimated score\n\
    -r, --seed number             set random number seed\n\
+   --gtp-dump-commands <file>    dump commands received in GTP mode\n\
 "
 #define USAGE_DEBUG2 "\
        --decide-string <string>  can this string live? (try with -o)\n\
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.140
diff -u -r1.140 play_gtp.c
--- interface/play_gtp.c        21 Jan 2004 17:55:14 -0000      1.140
+++ interface/play_gtp.c        22 Jan 2004 21:16:20 -0000
@@ -332,7 +332,7 @@
 
 /* Start playing using the Go Text Protocol. */
 void
-play_gtp(FILE *gtp_input, int gtp_initial_orientation)
+play_gtp(FILE *gtp_input, FILE *gtp_dump_commands, int gtp_initial_orientation)
 {
   /* Make sure stdout is unbuffered. (Line buffering is also okay but
    * not necessary. Block buffering breaks GTP mode.)
@@ -349,7 +349,7 @@
   
   /* Prepare pattern matcher and reading code. */
   reset_engine();
-  gtp_main_loop(commands, gtp_input);
+  gtp_main_loop(commands, gtp_input, gtp_dump_commands);
 }
 
 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]