shmocz / ra2yrcpp

Protobuf API and C++/Python library to interact with Red Alert 2: Yuri's Revenge through WebSockets and HTTP
GNU General Public License v3.0
13 stars 2 forks source link

Command id's are assigned wrong #5

Closed shmocz closed 1 year ago

shmocz commented 1 year ago

This seems to occur when issuing async commands, while executing regular commands at high frequency. Upon flushing the results, an async commands gets assigned the id of another sync command.

The bug manifests itself in pyra2yr as follows:

  1. Game state is fetched by executing regular command GetGameState. The command id is retrieved from the ack and used to identify the result when it's polled back in the poll loop.
  2. Async command, such as PlaceQuery is executed.
  3. When state retrieval of step 1 happens, the command result indicated by the ack contains actually the PlaceQuery result.

This was assumed to be due to race condition addressed in a19197f, but the problem still persists, indicating a deeper issue.