Open Frigerius opened 6 years ago
I also get this error "Error in returning observation:"
sometimes. For me without apparent reason. I would say every 50 to 100 runs in the middle of a game. I run a bot playing the game and it uses the api in release mode.
When I was trying to multithread my bot, issuing different commands to the sc2 API, it was crashing very fast. I suspect the API is not thread-safe?
How to reproduce: Not sure. It occurres random. My setup: My Bot analyses Replays. My main program starts 4 independent threads with their own Coordinator and ReplayObserverBot. The replays are sorted into 4 different folders and each bot just takes the file from their specified folder. While running the program, the program randomly crashs. I figured out, that it crashes in
ControlImp::GetObservation()
in sc2_client.cc becauseGameResponsePtr response = WaitForResponse();
looks like returning null andstd::cerr << "The main response is of type: " << std::to_string(response->response_case()) << std::endl;
tries to access it. My current work around is to check if response is null, which seems to work, since I get this"Error in returning observation:"
error string, but it doesn't crash anymore.By following the method, in the end
GameResponsePtr ProtoInterface::WaitForResponseInternal()
initializes the object as null and returns null if there occurs a timeout, so I would guess it is related to this method (sc2_proto_interface.cc)Here some logs, in this case the error occurred at the beginning: For each of my observations I rename the replays I already analyzed, so the error can be related to specif replays, BUT for my second run, I connected a debugger, which helped me to find the error and I was able to see which of my instances crashed and which replay it was using, so I tested this specific replay but it didn't crash, so its unlikely that this error just occurs on a specific file. (Replaced parts of the paths by "...")