On-line engine blitz tourney February

Discussion of chess software programming and technical issues.

Moderator: Ras

Joost Buijs
Posts: 1681
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: On-line engine blitz tourney February

Post by Joost Buijs »

mar wrote: Sun Feb 15, 2026 10:34 am
Joost Buijs wrote: Sat Feb 14, 2026 9:01 pm The 'Lasker' chess server software is very poorly written, uninitialized varables and dangling pointers everywhere, since I don't want to spend a lot of time to find out what the culprit is, it's probably wise to quit with this tradition completely.
It was fun for as long as it lasted.

Joost
please don't quit Joost, I think this tradition is awesome!

a chess server is only software. so I guess it can be replaced, if not, assuming
it's open source, then it can be fixed.

I guess there are no logs so it's impossible to track what exact input caused the crash?

I only found lasker chess server source on josh shriver's github, I guess that's not it? https://github.com/jshriver/lasker
The server itself didn't save any logs, but in syslog I can see that mamer got the command "listtourneygames" and a fraction of a second later chessd caused an exeption.

The version of the server I originally used is this one: https://github.com/ddugovic/capablanca
Which is not very different from the HGM version that is on Joshua's github.

I had to make some patches in the past because the server crashed due to uninitialized local variables, after this it worked seven years without problems (I remember one crash many years back). Now it suddenly does not seem to work anymore, my feeling is that it happened after the upgrade to Linux Mint 22.3, and that it is a problem in the server software that now comes to light.

Yesterday I was a little depressed because the server crashed for the second time in a row, when I have some time to spare I will take another look at it.
User avatar
jshriver
Posts: 1387
Joined: Wed Mar 08, 2006 9:41 pm
Location: Morgantown, WV, USA

Re: On-line engine blitz tourney February

Post by jshriver »

mar wrote: Sun Feb 15, 2026 10:34 am I only found lasker chess server source on josh shriver's github, I guess that's not it? https://github.com/jshriver/lasker
That source was a fairly early version of the codebase that HGM was running, haven't checked to see if it's been updated. I believe HGM had done some changes, namely adding variant support if memory serves. It worked for a year maybe two, back when I was running the OICS 24/7 computer server. Basically I had a couple machines running all the time and wrote a perl script to connect and control mamer to auto add any (C) account who was online. Was fun and had some activity. But it, like the torrent site, I unfortunately had to shutdown.

From my understanding the code was originally an older version of FICS pre-ICC split, hense mamer bugs that FICS had fixed but not released.

Sorry to see this go but understand. Recently connected to FICS for nostalgia reasons and the times have changed. There is always lichess as we move forward.

Joost if you would be willing to make a tar of the server and give me a copy I'd very much like to see the codebase and layout. Who knows.
User avatar
chrjly2
Posts: 24
Joined: Sat Aug 31, 2024 7:15 pm
Full name: Christophe Jolly

Re: On-line engine blitz tourney February

Post by chrjly2 »

Joost Buijs wrote: Sun Feb 15, 2026 12:10 pm
mar wrote: Sun Feb 15, 2026 10:34 am
Joost Buijs wrote: Sat Feb 14, 2026 9:01 pm The 'Lasker' chess server software is very poorly written, uninitialized varables and dangling pointers everywhere, since I don't want to spend a lot of time to find out what the culprit is, it's probably wise to quit with this tradition completely.
It was fun for as long as it lasted.

Joost
please don't quit Joost, I think this tradition is awesome!

a chess server is only software. so I guess it can be replaced, if not, assuming
it's open source, then it can be fixed.

I guess there are no logs so it's impossible to track what exact input caused the crash?

I only found lasker chess server source on josh shriver's github, I guess that's not it? https://github.com/jshriver/lasker
The server itself didn't save any logs, but in syslog I can see that mamer got the command "listtourneygames" and a fraction of a second later chessd caused an exeption.

The version of the server I originally used is this one: https://github.com/ddugovic/capablanca
Which is not very different from the HGM version that is on Joshua's github.

I had to make some patches in the past because the server crashed due to uninitialized local variables, after this it worked seven years without problems (I remember one crash many years back). Now it suddenly does not seem to work anymore, my feeling is that it happened after the upgrade to Linux Mint 22.3, and that it is a problem in the server software that now comes to light.

Yesterday I was a little depressed because the server crashed for the second time in a row, when I have some time to spare I will take another look at it.
You can generate a core dump file when the crash occurs and see where it occurs in the code with gdb.
Compile the server with the gcc option -ggdb.
Edit the script that runs the server and add the line: export DAEMON_COREFILE_LIMIT='unlimited'
Or type 'ulimit -c unlimited' in a shell and start the server directly.
After the crash, run the command gdb -c corefile and watch the call stack with the command backtrace full.
The place of the core files is variable and depends on your Linux.

Christophe
Joost Buijs
Posts: 1681
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: On-line engine blitz tourney February

Post by Joost Buijs »

jshriver wrote: Mon Feb 16, 2026 10:45 am
mar wrote: Sun Feb 15, 2026 10:34 am I only found lasker chess server source on josh shriver's github, I guess that's not it? https://github.com/jshriver/lasker
Joost if you would be willing to make a tar of the server and give me a copy I'd very much like to see the codebase and layout. Who knows.
No problem, I can send you a copy. I have to take a look at how large the database is, if it's small enough I can send it by email, otherwise I can put it on FTP.

I will take a look at it later this week.

Joost
Joost Buijs
Posts: 1681
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: On-line engine blitz tourney February

Post by Joost Buijs »

chrjly2 wrote: Tue Feb 17, 2026 7:12 am
You can generate a core dump file when the crash occurs and see where it occurs in the code with gdb.
Compile the server with the gcc option -ggdb.
Edit the script that runs the server and add the line: export DAEMON_COREFILE_LIMIT='unlimited'
Or type 'ulimit -c unlimited' in a shell and start the server directly.
After the crash, run the command gdb -c corefile and watch the call stack with the command backtrace full.
The place of the core files is variable and depends on your Linux.

Christophe
The server itself seems to run stable, the problem only occurs when running tournaments. Last month it was timeseal that crashed, and what happened last saturday is not clear.

I could be that timeseal or the server is susceptible to malformed input, than it depends upon who is using it. It could also be that something in the interaction between mamer and the server is broken since the upgrade from Linux Mint to v22.3

If I want to determine what the cause for these crashes is, I have to setup and run test tournaments locally because I don't want to use the other users as Guinea pigs. This means that I have to setup a number of engines to run these test tournaments.

To be honest, I feel a bit reluctant to spend a lot of time on it because I have enough other things to do. When I have some time to spare I will take another look at it.

Joost
Joost Buijs
Posts: 1681
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: On-line engine blitz tourney February

Post by Joost Buijs »

Ras wrote: Sun Feb 15, 2026 11:09 am I suggest giving the source code a check with compiler warnings cranked up, and also with CppCheck (free / open source), maybe it finds something?
I ran CppCheck on it, like I already expected it found several errors: uninitialized variables, several memory leaks, null-pointers, buffer-overflows, and even a sizeof(pointer) instead sizeof(*pointer). Some of the errors are probably bogus, but it's good to look at these in more detail.

The lasker source has been hacked upon by many people, when I have some time to spare I will try to address all the errors CppCheck found.
Joost Buijs
Posts: 1681
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: On-line engine blitz tourney February

Post by Joost Buijs »

There are very weird constructions in the source, for instance things this:

if (onColor >= 0 && onPiece >= 0) // allow placement in holdings
gs->holding[onColor == BLACK][onPiece-1]++;

The index goes very likely out of bounds if onPiece == 0, to fix this I first have to find out what onPiece exactly does. And there are many things like this in the source.

I don't know if it's worthwhile to fix this mess.
tttony
Posts: 277
Joined: Sun Apr 24, 2011 12:33 am

Re: On-line engine blitz tourney February

Post by tttony »

It will be cool to read the source code to see if it's worth to fix the bugs, many people have hacked it, that's why it has a lot of bugs

If you upload it to github I bet there will people that will take a look and contribute to fix those nasty bugs

I will see if I can contribute
Joost Buijs
Posts: 1681
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: On-line engine blitz tourney February

Post by Joost Buijs »

tttony wrote: Sun Feb 22, 2026 9:12 pm It will be cool to read the source code to see if it's worth to fix the bugs, many people have hacked it, that's why it has a lot of bugs

If you upload it to github I bet there will people that will take a look and contribute to fix those nasty bugs

I will see if I can contribute
I'm 'old skool' and not on github, but the source I originally used is: https://github.com/ddugovic/capablanca
Less hacked versions are on: https://download.samba.org/pub/lasker/

In the past I already fixed some bugs that made it crash, it ran 'more or less' stable for 7 years, but there were some strange glitches now and then.

I will try to fix most bugs, the problem is that the program could rely on some of these bugs, and that fixing them will break something else.
mar
Posts: 2676
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: On-line engine blitz tourney February

Post by mar »

Joost Buijs wrote: Sun Feb 22, 2026 4:59 pm There are very weird constructions in the source, for instance things this:

if (onColor >= 0 && onPiece >= 0) // allow placement in holdings
gs->holding[onColor == BLACK][onPiece-1]++;

The index goes very likely out of bounds if onPiece == 0, to fix this I first have to find out what onPiece exactly does. And there are many things like this in the source.

I don't know if it's worthwhile to fix this mess.
oof, maybe onPiece was supposed to be > 0? this looks like some code for a variant, hard to say

in general - maybe worth giving it a shot with address/thread sanitizer enabled to see if it finds something,
unlike static analyzers they are reliable