On-line engine blitz tourney July
Moderators: hgm, Rebel, chrisw
-
- Posts: 27817
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: On-line engine blitz tourney July
Just to avoid any confusion: I have decided that in any case there will not be a tourney today.
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: On-line engine blitz tourney July
Some time ago I setup a test server with the latest Capablanca source but I never used it, this weekend I tried to revive it and I had difficulties getting mamer to recognize commands.
After some debugging I found the culprit in Mamer::HandleTell() at line 807
The following code fails with GCC (assuming i == 0):
However the following code works:
I don't know what the C++ standard has to say about this, but to me it looks like a compiler bug. Of course this is very ugly code, if you look at the whole source you may call it a wonder that it actually works, but still.
BTW is there any news with regard to the latest crashes of the server?, or did the tourney die a slow death?
After some debugging I found the culprit in Mamer::HandleTell() at line 807
The following code fails with GCC (assuming i == 0):
Code: Select all
while((command[i] != '\0') && (command[i] != ' ')) tmpCom[i] = command[i++];
tmpCom[i] = '\0';
Code: Select all
while((command[i] != '\0') && (command[i] != ' '))
{
tmpCom[i] = command[i];
i++;
}
tmpCom[i] = '\0';
BTW is there any news with regard to the latest crashes of the server?, or did the tourney die a slow death?
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: On-line engine blitz tourney July
before c++17, the right hand side of such an operator was undetermined I guess.
I think another famous example is
See https://en.cppreference.com/w/cpp/language/eval_order for more details.
I think another famous example is
Code: Select all
void f(int k, int j){
std::cout << k << std::endl;
std::cout << j << std::endl;
}
int i = 0;
f(i,i++); // undefined behaviour
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: On-line engine blitz tourney July
Probably not a bug than. I'm used to ICC and MSVC, these compilers already do for ages what you expect of such a statement, maybe it is different with GCC, with older versions of GCC this code didn't give any problems. The point is that the whole server code is literally filled with stuff like this, there is a big change that there will be other hidden bugs.
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: On-line engine blitz tourney July
That should be undefined behaviour, and it has always been. Especially the GCC team is well-known to have taken an ever more aggressive stance towards undefined behaviour. If the code is broken, then each GCC update will increase the odds of actually manifesting the code issues.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: On-line engine blitz tourney July
Most compilers I know have no problem with:
I guess the original author(s) of the server software thought this too. Personally I never use constructs like this because it decreases readability.
Code: Select all
while ((s1[i] = s2[i++]) != 0);
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: On-line engine blitz tourney July
I tried to make my local server crash by throwing very long PV strings with a lot of garbage at it, but the only thing that crashed (or aborted) was polyglot because it has an input buffer size of 4096 bytes. It is possible that polyglot filters a lot of unwanted crap, when the engine is connected via icsdrone things could be different, unfortunately I'm not able to try that because I run under Windows.
I noticed that the server crashes when I add a new player without setting a password (the 'addplayer' command does not seem to set a default password), when the new player logs in the server immediately crashes.
The server is reachable at 'nightmare-chess.nl' port 5000, I setup sendmail as well, so 'mailoldmoves' and 'mailstored' should work. It is running on a tiny computer, I have no idea about how many concurrent users it can handle.
I noticed that the server crashes when I add a new player without setting a password (the 'addplayer' command does not seem to set a default password), when the new player logs in the server immediately crashes.
The server is reachable at 'nightmare-chess.nl' port 5000, I setup sendmail as well, so 'mailoldmoves' and 'mailstored' should work. It is running on a tiny computer, I have no idea about how many concurrent users it can handle.
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: On-line engine blitz tourney July
When I look at the source I see that 'addplayer' at default adds a 4 character password, so I is not very clear to me what went wrong, it only happened once, but it is still something to look at.
Something else that puzzles me is how to add computer players (with a (C) after their handle), according to the manual it should be possible, but I can't find anywhere how to do it. Maybe HGM knows?
Something else that puzzles me is how to add computer players (with a (C) after their handle), according to the manual it should be possible, but I can't find anywhere how to do it. Maybe HGM knows?
-
- Posts: 27817
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: On-line engine blitz tourney July
The ICS maintains 'lists', and has a command that adds an item to a list. I always use the predefined alias '+' for this command. So "+computer Nightmare" would add Nightmare to the 'computer' list. And this list is used to add the (C) to printed player names. I don't remember whether the computer list is automatically created when you add something to it, or whether there is a separate command to create lists that has to be used first.
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: On-line engine blitz tourney July
Thanks! This leads me in the right direction.hgm wrote: ↑Sat Sep 28, 2019 4:11 pm The ICS maintains 'lists', and has a command that adds an item to a list. I always use the predefined alias '+' for this command. So "+computer Nightmare" would add Nightmare to the 'computer' list. And this list is used to add the (C) to printed player names. I don't remember whether the computer list is automatically created when you add something to it, or whether there is a separate command to create lists that has to be used first.
The ICS is fully functional now, I've added chessd, mamer and a script to spool the emails as .service to etc/systemd, it all seems to work, only mamer does not automatically reconnect when it has lost connection to the server, I still have to look at this.