canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.64k stars 634 forks source link

SSHFSMountsTest not deleting mock processes #1469

Open ricab opened 4 years ago

ricab commented 4 years ago

Describe the bug The mock processes created in SSHFSMountsTests are not being deleted reliably when those tests finish, so they don't get the expectation verification in the right tests.

Most often (depending on the test order) these mock processes are often deleted in other tests. Expectations are currently honored, so that goes by silently.

However, when shuffling, the tests may finish with some mock processes still around, which google test detects and reports. This is what we hit in #1399.

To Reproduce Running these tests in isolation is enough to trigger the source problem:

multipass_tests --gtest_filter=SSHFSMounts*
ricab commented 4 years ago

This issue comes from the "delete_later" ptrs here. They were supposed to be deleted with this, but that isn't working.

townsend2010 commented 4 years ago

Ugh, that delete_later pointer is sure causing some issues. There are other runtime scenarios that exposes the issue and cause headaches such as deleting an instance with a mount and quickly launching a new instance with that same name and defining a mount afterwards. The primary instance is particularly prone to this since the mount is automatic and can happen before the previous deleteLater() is finished.

ricab commented 4 years ago

Interesting. I wonder if there would be a way to do away with them and have some proper RAII in there.

ricab commented 4 years ago

Meanwhile, this mentions the requirements for the objects to actually be deleted in an event loop. Maybe they are not fulfilled in the test... TBC