-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simulation errors are not propagated when using cse_execution_start() #415
Comments
I disagree. Consider this scenario:
How do I know which execution has now set the error state? Note that I don't even have to be running two executions. In step 2 I could call any potentially-failing function in Hence, I believe that the error state must be thread local. This, again, means that the error state can only be set by a function called in the foreground thread, and it cannot change magically before the next call of any potentially-failing function in the same thread. |
I'd say that there are 2 main methods for handling errors in asynchronous function calls:
|
The simplest "poll" solution I can think of: We already have a |
Thanks for the feedback! The error state I'm referring to is contained in I might have torn down too many fences with #422, the problem being setting last error code/message from a different thread than the foreground thread. Polling does indeed seem like a better solution, will give this a go. |
Ok, I understand. I was referring to |
…) will throw if exception has been set. We do however need to call future.get() before joining the execution thread, and we need to join the execution thread.
…status. Keep throwing if an error already has occurred.
* #415 Propagate simulation errors from async simulation execution. * #415 Replace DPController.fmu (only win64) with handwritten fail.fmu (win64 and linux64) * #415 Take two with polling. * #415 Update docstring after review * #415 Get rid of execution->simulate_exception_ptr * #415 Don't need to check future.get_exception_ptr() since future.get() will throw if exception has been set. We do however need to call future.get() before joining the execution thread, and we need to join the execution thread. * #415 Perform running execution health check inside cse_execution_get_status. Keep throwing if an error already has occurred.
Setup: Client code using
csecorec
, for examplecse-server-go
.The client code calls
cse_execution_start()
and after a while a simulation error in a slave occurs. The simulation error is caught inalgorithm::do_step()
and rethrown, but not properly caught incse.cpp
. From the client's point of view, simulation time is no longer progressing, butexecution->state = CSE_EXECUTION_RUNNING
. Callingcse_execution_stop()
results in an exception being caught, andexecution->state = CSE_EXECUTION_ERROR
. The error state should be set as soon as the simulation error occurs.The text was updated successfully, but these errors were encountered: