Skip to contentSkip to conversation

vnc: qemu can die if the client is disconnected while updating screen

PATCH In review Corentin Chary 2 participants 2 messages Nov 26, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vnc: qemu can die if the client is disconnected while updating screen

agraf reported that qemu_mutex_destroy(vs->output_mutex) was failing in vnc_disconnect_finish() when the vnc client was disconnected while updating the screen.

It's because vnc_worker_thread_loop() tries to unlock the mutex while not locked. The unlocking call doesn't fail (pthread bug ?), but the destroy call does.

---
 ui/vnc-jobs-async.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
ui/vnc-jobs-async.c +4 -0
index 6e9cf08..0b5d750 100644
@@ -227,6 +227,10 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
 
         if (job->vs->csock == -1) {
             vnc_unlock_display(job->vs->vd);
+            /* output mutex must be locked before going to
+             * disconnected:
+             */
+            vnc_lock_output(job->vs);
             goto disconnected;
         }
 
Signature · 1 line
1.7.3.2
#1 lore raw
Quoted 8 lines · Corentin Chary

agraf reported that qemu_mutex_destroy(vs->output_mutex) was failing in vnc_disconnect_finish() when the vnc client was disconnected while updating the screen.

It's because vnc_worker_thread_loop() tries to unlock the mutex while not locked. The unlocking call doesn't fail (pthread bug ?), but the destroy call does.

Not bug but rather (expected in the absence of PTHREAD_MUTEX_ERRORCHECK) undefined behaviour [1]

[1] http://www.opengroup.org/onlinepubs/7990989775/xsh/pthread_mutex_unlock.html

Signature · 1 line
mailto:[email protected]