Bug 501888

Summary: internal error: reply callback called twice
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: markmc, mbooth, mgoldman, rjones, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-27 10:06:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Potential fix - switch to reading single messages only in the socket read callback none

Description Richard W.M. Jones 2009-05-21 08:43:51 UTC
Functions which have FileOut parameters can cause
"internal error: reply callback called twice"

The reason is that the socket read handler reads
two or more messages in a single buffer read, and
calls the upper reply callback twice in succession.

In the normal case, the reply callback is switched
after the first callback to the special callback for
reading files.  However if the socket read handler
calls the first reply callback twice in quick succession
this doesn't happen (the main loop isn't exited between
callbacks).

This only happens very rarely, and the fix is fairly
ugly.

Comment 1 Mark McLoughlin 2009-05-25 14:50:08 UTC
Moving upstream, since it happens very rarely

Comment 2 Richard W.M. Jones 2009-06-26 10:15:43 UTC
Created attachment 349531 [details]
Potential fix - switch to reading single messages only in the socket read callback

Matt, could you test this patch please.

I have checked that it still passes the tests, but since I
can't reproduce the original bug I'm not certain that it's
a fix.

Comment 3 Richard W.M. Jones 2009-06-27 13:38:37 UTC
Comment on attachment 349531 [details]
Potential fix - switch to reading single messages only in the socket read callback

This patch causes a segfault for some large messages - please ignore it.

Comment 4 Richard W.M. Jones 2009-09-14 18:40:53 UTC
We think the following patch should fix this error
comprehensively:

http://git.et.redhat.com/?p=libguestfs.git;a=commitdiff;h=0a0d743ba80e33e676084f2a254c63d4188857b0

Comment 5 Fedora Update System 2009-09-15 11:00:15 UTC
libguestfs-1.0.70-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/libguestfs-1.0.70-1.fc11

Comment 6 Fedora Update System 2009-09-15 11:34:26 UTC
libguestfs-1.0.70-1.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/libguestfs-1.0.70-1.el5

Comment 7 Fedora Update System 2009-10-03 19:03:00 UTC
libguestfs-1.0.70-1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Richard W.M. Jones 2010-03-27 10:06:50 UTC
As noted in comment 4, the main loop was completely
rewritten, fixing this problem.