MantisBT - Zandronum
View Issue Details
0004068Zandronum[All Projects] Bugpublic2022-12-29 18:522024-04-09 04:04
Kaminsky 
Kaminsky 
normalmajorsometimes
resolvedfixed 
x86_64Linux
3.1 
3.23.2 
0004068: Linux servers don't send out commands normally if there's at least one client connected but spectating
Here's a recording from a 3.2-alpha server that was full of bots and only one client that was connected but spectating:'https://cdn.discordapp.com/attachments/472599799825432577/1021956762414370846/2022-09-20_20-28-33.mp4 [^]'

You'll see that the bots' movements aren't updating constantly, their movement gets updated roughly once every second. Likewise, actors that are spawned like projectiles only happen in the same intervals. Although this was recorded on a 3.2-alpha server, it should also happen in 3.1.

While the client's spectating, commands sent by the server don't actually get sent out properly, but as soon as they join the game, the issue stops and the commands get sent out normally.
This issue particularly affects Linux servers because the network socket goes to sleep for one second, waiting for any input commands from clients. After one second, the socket stops waiting and sends out any server commands that are queued (in bursts). This doesn't happen on Windows servers since the network socket doesn't go to sleep, as shown in I_DoSelect below:

void I_DoSelect (void)
{
#ifdef WIN32
/*
    struct timeval timeout;
    fd_set fdset;

    FD_ZERO(&fdset);
    FD_SET(g_NetworkSocket, &fdset);
    timeout.tv_sec = 1;
    timeout.tv_usec = 0;
    if (select (static_cast<int>(g_NetworkSocket)+1, &fdset, NULL, NULL, &timeout) == -1)
        return;
*/
#else
    struct timeval timeout;
    fd_set fdset;

    FD_ZERO(&fdset);
    if (do_stdin)
        FD_SET(0, &fdset);

    FD_SET(g_NetworkSocket, &fdset);
    timeout.tv_sec = 1;
    timeout.tv_usec = 0;
    if (select (static_cast<int>(g_NetworkSocket)+1, &fdset, NULL, NULL, &timeout) == -1)
        return;

    stdin_ready = FD_ISSET(0, &fdset);
#endif
}

Clients don't send commands (e.g. CLC_CLIENTMOVE) to the server constantly, unlike when they're in the game. With no incoming commands reaching the server, the network keeps waiting even though there's already a client in the server.
No tags attached.
related to 0002602resolved  Ceiling height updates aren't sent correctly to spectators 
Issue History
2022-12-29 18:52KaminskyNew Issue
2022-12-29 18:53KaminskyRelationship addedrelated to 0002602
2022-12-29 19:12KaminskyStatusnew => confirmed
2023-07-02 21:15KaminskyNote Added: 0022859
2023-07-02 21:15KaminskyAssigned To => Kaminsky
2023-07-02 21:15KaminskyStatusconfirmed => needs testing
2024-04-09 04:04Ru5tK1ngNote Added: 0023573
2024-04-09 04:04Ru5tK1ngStatusneeds testing => resolved
2024-04-09 04:04Ru5tK1ngResolutionopen => fixed
2024-04-09 04:04Ru5tK1ngFixed in Version => 3.2

Notes
(0022859)
Kaminsky   
2023-07-02 21:15   
This should now be fixed with:'http://hg.osdn.net/view/zandronum/zandronum-stable/rev/a5156e1a5726 [^]'
(0023573)
Ru5tK1ng   
2024-04-09 04:04   
Hoped on a EB server that was running Linux and the latest April 3.2 beta. The server had 9 bots and as I connected and spectated they all moved and fired normally. No issues were spotted after a few minutes of spectating.