Ecdar / Ecdar-GUI

A graphical tool for modeling using ECDAR (Environment for Compositional Design and Analysis of Real Time Systems)
MIT License
3 stars 5 forks source link

Dangling engines FIX #140

Closed Nielswps closed 1 year ago

Nielswps commented 1 year ago

This PR fixes the issue of having dangling engine processes after exiting the GUI. This is done by keeping track of started connections in a separate list and still using a BlockingQueue for requesting connections. This removes the need for the QueryHandler to keep track of the currently used connections

Closes #111 and Closes #134

seblund commented 1 year ago

I just fixed so that the started backend connections are added to startedBackendConnections right as they are initialized (in case a user closes the program while the update components query runs) so we ensure all processes are closed.

When running queries I got some errors in the console because the used ports (activeEnginePorts) were calculated from the available connections instead of the started connections, so i fixed that as well. Now i get no errors in the console.

There are no dangling processes now from my testing, so it seems to work!

We are still leaking backend connections though. If you add a break point to closeAllBackendConnections() and check after clicking run all queries a bunch of times in e.g. the university example you can tell. The number of BackendConnections in startedBackendConnections and availableBackendConnections should be the same but when I test there are often just a couple of backends in availableBackendConnections while there are many in startedBackendConnections.

Nielswps commented 1 year ago

Once again PRs prove to be worthwhile. The changes make a lot of sense, thanks for pushing those fixes. I will open an issue on the leak :+1: