Rahix / tbot

Automation/Testing tool for Embedded Linux Development
https://tbot.tools
GNU General Public License v3.0
91 stars 21 forks source link

context: Fix teardown order in keep_alive mode #59

Closed Rahix closed 3 years ago

Rahix commented 3 years ago

When the keep_alive flag is enabled, the order in which instances were torn down was not consistent with instance dependencies. Instead, it was solely dependent on the order in which instances were requested. This could lead to errors of various kinds, where instances which should still be alive were torn down too early.

Fix this by defining a deterministic order for teardown. This order is constructed from the order in which instances become alive - building on the idea that for an instance to become alive, all its dependencies must have come alive beforehand.

Note that this does not always reflect the order of request() calls, as a requested machine might request dependencies itself before yielding a live instance.

Rahix commented 3 years ago

@NoUmlautsAllowed, can you please try this patch to see if it fixes the problem in your setup as well?

NoUmlautsAllowed commented 3 years ago

Yes, this issue is fixed for me with theses changes. Thanks!

The tests I mentioned in #58 work fine with this.