backgammony
                                
                                
                                
                                    backgammony copied to clipboard
                            
                            
                            
                        Backgammony crashes if game human against AI is started.
I have the current version from Flatpak (1.0.0, 02.07.2020). Tested with intermediate and 4-ply. It is the same with AI against AI games.
$ /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=backgammony uk.jnthn.backgammony
Attempting connection to /tmp/gnubg-20200705T185747.2408571.sock
NETSND: EVALUATION FIBSBOARD board:You:Opponent:1:0:0:0:-2:1:0:0:1:3:0:3:0:0:0:-5:5:0:0:0:-3:0:-5:0:0:0:0:2:0:1:4:1:4:1:1:0:0:0:1:-1:0:25:0:0:0:0:0:0:0 PLIES 0  CUBELESS NOISE 400
object.Exception@Erfolg(83): Socket Error: 
----------------
??:? immutable(char)[] networking.connection.Connection.readline(core.time.Duration) [0x5577585e979c]
??:? game.PipMovement[] ai.gnubg.gnubgGetTurn(game.GameState, ai.gnubg.GnubgEvalContext) [0x5577585905ff]
??:? void std.parallelism.Task!(ai.gnubg.gnubgGetTurn(game.GameState, ai.gnubg.GnubgEvalContext), game.GameState, ai.gnubg.GnubgEvalContext).Task.impl(void*) [0x557758611f27]
??:? void std.parallelism.AbstractTask.job() [0x557758887d66]
??:? void std.parallelism.TaskPool.doJob(std.parallelism.AbstractTask*) [0x557758887eb7]
??:? void std.parallelism.TaskPool.doSingleTask() [0x557758887f8c]
??:? void core.thread.osthread.Thread.run() [0x5577588765c1]
??:? thread_entryPoint [0x5577588acf0d]
??:? [0x7f17dc2645e1]
                                    
                                    
                                    
                                
Hi, could you tell me a bit more about your system. At the moment backgammony naively waits for a short time before attempting to make a connection instead of checking periodically until there is one. If your computer is older or slower it may not give enough time for gnubg to start up.
CPU: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz OS: Manjaro Linux hardinfo benchmark CPU Blowfish: 4.58 hardinfo benchmark CPU Fibonacci: 0.81 hardinfo benchmark CPU Crypto-Hash: 318.14
Thank you, I will attempt to write a fix this evening. Would you be able to compile the project and test the fix?
I just tested it and I am able to compile the project (With dub build && ./backgammon). Sadly, now there is another error: Backgammony tries to load the config file in ~/.config/backgammony/backgammony.json, but because it is not there, it throws a std.file.FileException@std/file.d(4689) exception. This is strange because I would expect that a program creates a config file and/or directory if it does not exist, like the most other programs, too. I will open another issue with more details.
The FileException bug (#4) should now be fixed so I will take a look at the AI bug now. Backgammony is under heavy development for a 2.0 release and the master branch has a lot of rough edges at the moment.
I will take a look at the AI bug this afternoon. I appreciate your patience.
I have increased the maximum wait time to 5 seconds - On my machine it takes only about 150ms. Backgammony should also catch AI errors and display them to the user in a friendly way.
Could you please rebuild and try again. If the software continues not to work - could you please try starting gnubg manually with gnubg --tty and then entering the command external /tmp/gnubgtest.sock. And describe the results. Do you get feedback quickly, does it crash etc.
If I compile and start backgammony now and choose the AI as an opponent, a window with the text
Socket Error:
[OK]
get opened. Yes, after the : there is nothing but the OK button. This is no copy and paste error.
I have installed the current version of gnubg from arch repository (GNU Backgammon 1.06.002  Nov  4 2019).
In the terminal of Backgammony, the following message occurs:
Attempting connection to /tmp/gnubg-20200714T151117.3558937.sock
and using a "taskmanager", it shows that
/usr/bin/gnubg --tty -c /tmp/gnubg-20200714T151117.3558937
was started and is still running, even if I close Backgammony.
Now to the direct test with gnubg --tty:
bnubg --tty
[...]
(No game) external /tmp/gnubgtest.sock
Waiting for a connection from /tmp/gnubgtest.sock...
The last line appears very fast and after that, nothing happens.
In the -c option of gnubg there is no .sock file extension, in the Attempting connection to message, it is there.
Maybe that's the error?
In the /tmp folder, there are two files:
gnubg-20200714T151117.3558937
gnubg-20200714T151117.3558937.sock
                                    
                                    
                                    
                                
Alright, it would seem that the error is being produced in the socket connection code however I am not sure why.
I will be away for the next few days but I will investigate soon. Thank you for your patience.