[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/15] migration: fix cleanup_bh leak on resume
From: |
Paolo Bonzini |
Subject: |
[PULL 12/15] migration: fix cleanup_bh leak on resume |
Date: |
Thu, 2 Apr 2020 15:06:37 -0400 |
From: Marc-André Lureau <address@hidden>
Since commit 8c6b0356b53977bcfdea5299db07884915425b0c ("util/async:
make bh_aio_poll() O(1)"), migration-test reveals a leak:
QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64
tests/qtest/migration-test -p /x86_64/migration/postcopy/recovery
tests/qtest/libqtest.c:140: kill_qemu() tried to terminate QEMU
process but encountered exit status 1 (expected 0)
=================================================================
==2082571==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7f25971dfc58 in __interceptor_malloc (/lib64/libasan.so.5+0x10dc58)
#1 0x7f2596d08358 in g_malloc (/lib64/libglib-2.0.so.0+0x57358)
#2 0x560970d006f8 in qemu_bh_new /home/elmarco/src/qemu/util/main-loop.c:532
#3 0x5609704afa02 in migrate_fd_connect
/home/elmarco/src/qemu/migration/migration.c:3407
#4 0x5609704b6b6f in migration_channel_connect
/home/elmarco/src/qemu/migration/channel.c:92
#5 0x5609704b2bfb in socket_outgoing_migration
/home/elmarco/src/qemu/migration/socket.c:108
#6 0x560970b9bd6c in qio_task_complete /home/elmarco/src/qemu/io/task.c:196
#7 0x560970b9aa97 in qio_task_thread_result
/home/elmarco/src/qemu/io/task.c:111
#8 0x7f2596cfee3a (/lib64/libglib-2.0.so.0+0x4de3a)
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
migration/migration.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/migration/migration.c b/migration/migration.c
index c4c9aee15e..187ac0410c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3478,7 +3478,12 @@ void migrate_fd_connect(MigrationState *s, Error
*error_in)
bool resume = s->state == MIGRATION_STATUS_POSTCOPY_PAUSED;
s->expected_downtime = s->parameters.downtime_limit;
- s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup_bh, s);
+ if (resume) {
+ assert(s->cleanup_bh);
+ } else {
+ assert(!s->cleanup_bh);
+ s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup_bh, s);
+ }
if (error_in) {
migrate_fd_error(s, error_in);
migrate_fd_cleanup(s);
--
2.18.2
- [PULL 00/15] Misc patches for 5.0-rc2, Paolo Bonzini, 2020/04/02
- [PULL 02/15] hw/isa/superio: Correct the license text, Paolo Bonzini, 2020/04/02
- [PULL 01/15] hw/scsi/vmw_pvscsi: Remove assertion for kick after reset, Paolo Bonzini, 2020/04/02
- [PULL 03/15] virtio-iommu: depend on PCI, Paolo Bonzini, 2020/04/02
- [PULL 04/15] softmmu: fix crash with invalid -M memory-backend=, Paolo Bonzini, 2020/04/02
- [PULL 06/15] util/bufferiszero: assign length_to_accel value for each accelerator case, Paolo Bonzini, 2020/04/02
- [PULL 07/15] util/bufferiszero: improve avx2 accelerator, Paolo Bonzini, 2020/04/02
- [PULL 08/15] vl: fix broken IPA range for ARM -M virt with KVM enabled, Paolo Bonzini, 2020/04/02
- [PULL 11/15] target/i386: do not set unsupported VMX secondary execution controls, Paolo Bonzini, 2020/04/02
- [PULL 12/15] migration: fix cleanup_bh leak on resume,
Paolo Bonzini <=
- [PULL 09/15] i386: hvf: Reset IRQ inhibition after moving RIP, Paolo Bonzini, 2020/04/02
- [PULL 14/15] object-add: don't create return value if failed, Paolo Bonzini, 2020/04/02
- [PULL 05/15] MAINTAINERS: Add an entry for the HVF accelerator, Paolo Bonzini, 2020/04/02
- [PULL 13/15] qmp: fix leak on callbacks that return both value and error, Paolo Bonzini, 2020/04/02
- [PULL 10/15] serial: Fix double migration data, Paolo Bonzini, 2020/04/02
- [PULL 15/15] xen: fixup RAM memory region initialization, Paolo Bonzini, 2020/04/02
- Re: [PULL 00/15] Misc patches for 5.0-rc2, no-reply, 2020/04/02
- Re: [PULL 00/15] Misc patches for 5.0-rc2, no-reply, 2020/04/02
- Re: [PULL 00/15] Misc patches for 5.0-rc2, no-reply, 2020/04/02
- Re: [PULL 00/15] Misc patches for 5.0-rc2, Peter Maydell, 2020/04/03