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

Fix crash when purge deleting while starting #3679

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sploder12
Copy link

resolves #3279

There are several sources of crashes when running delete -p and start at the same time.
One source stems from a race condition in the daemon involving multiple reads and writes to operative_instances concurrently. The crash source is from a callback created in on_restart which can unsafely write into operative_instances if the instance has been deleted. A workaround is to ensure this is always a read operation and catching the resulting error, but this still causes UB and puts the thread in a corrupt state. Preventing the callback or having safe access into the operative_instances map would be better.

Another is from callbacks in the QemuVirtualMachine which are called during or after the destruction of the VM instance. This is addressed by disconnecting the callbacks so they are not called when they shouldn't be and reconnecting them when appropriate.

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

Attention: Patch coverage is 26.31579% with 28 lines in your changes missing coverage. Please review.

Project coverage is 88.85%. Comparing base (5f4dfe2) to head (c09db2e).

Files with missing lines Patch % Lines
...rc/platform/backends/qemu/qemu_virtual_machine.cpp 30.30% 23 Missing ⚠️
src/daemon/daemon.cpp 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3679      +/-   ##
==========================================
- Coverage   88.85%   88.85%   -0.01%     
==========================================
  Files         254      254              
  Lines       14269    14277       +8     
==========================================
+ Hits        12679    12686       +7     
- Misses       1590     1591       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multipass crashes when trying to delete purge an instance while it is starting
1 participant