Skip to content
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

Exceptions are not always propagated to client code #91

Open
kyllingstad opened this issue Oct 24, 2023 · 0 comments
Open

Exceptions are not always propagated to client code #91

kyllingstad opened this issue Oct 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kyllingstad
Copy link
Member

It seems that proxy-fmu spawns one or more worker threads to perform some of its operations, and exceptions that are thrown within these threads are not handled properly.

I'm not familiar enough with the proxy-fmu API to provide a minimal test case. I discovered this when running the cosim CLI. Here is one way to reproduce it:

  1. Make sure that cosim CLI is available and compiled with proxy-fmu support.
  2. Delete/rename/move the proxyfmu executable so that the program can't find it.
  3. Run cosim run path/to/OspSystemStructure.xml, where the system structure file is one that uses proxyfmu (for example this one).

Observe the following output (on Linux):

terminate called after throwing an instance of 'std::runtime_error'
  what():  [proxyfmu] No proxyfmu executable found. [path redacted]/bin/proxyfmu does not exist!
Aborted (core dumped)  cosim run OspSystemStructure.xm

Using GDB, I've observed that the exception originates in a worker thread and is never caught before it propagates to the thread entry point and causes the C++ runtime to call std::terminate().

Instead, there should be some mechanism to capture the exception, pass it to the main thread, and rethrow it there, enabling the whole program to exit gracefully.

@kyllingstad kyllingstad added the bug Something isn't working label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant