FS#3909 - Server hangs when client is joining, 100% cpu usage

Attached to Project: OpenTTD
Opened by Dolly (dolly) - Sunday, 27 June 2010, 14:35 GMT
Last edited by Remko Bijker (Rubidium) - Tuesday, 29 June 2010, 21:15 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Critical
Priority Normal
Reported Version 1.0.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This bug cannot be easily reproduced on real server, because this situation is quite rare. Sometimes it takes days to trigger this on my servers.

When new client is joining server game server just hangs up in infinite loop with 100% cpu usage. 1.0.0 is the last stable version without this bug. This behavior is triggered in NetworkSyncCommandQueue() function when there are some commands on _local_command_queue that should be copied to joining client command queue. When the command is copied pointer reference to next command is not cleared and client command queue has now wrong reference to commands in _local_command_queue which causes infinite for-loop in NetworkSyncCommandQueue() function.

Attached patch should fix the problem.

This task depends upon

Closed by  Remko Bijker (Rubidium)
Tuesday, 29 June 2010, 21:15 GMT
Reason for closing:  Fixed
Additional comments about closing:  In r20035. Thanks for the diff.