[libvirt] [PATCHv3 1/6] DO NOT APPLY UPSTREAM: Close callback race corruption crash reproducer.
Eric Blake
eblake at redhat.com
Mon Apr 1 23:01:10 UTC 2013
On 03/31/2013 10:20 AM, Peter Krempa wrote:
> ---
> src/remote/remote_driver.c | 5 +++++
> src/rpc/virnetclient.c | 9 ++++++++-
> 2 files changed, 13 insertions(+), 1 deletion(-)
While I agree that this must not be applied upstream, I applied it
locally and was indeed able to more reliably reproduce the problems.
Thanks; having this patch in place locally will make the rest of my
review easier.
>
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 885120e..711143a 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -1027,6 +1027,11 @@ doRemoteClose(virConnectPtr conn, struct private_data *priv)
> (xdrproc_t) xdr_void, (char *) NULL) == -1)
> ret = -1;
>
> + /* this is needed so that the remote side has the time to close the socket */
> + printf("\n\n DEBUG: Connection close called, sleeping\n\n");
> + sleep(1);
> + printf("\n\n DEBUG: Finishing close\n\n");
> +
> #ifdef WITH_GNUTLS
> virObjectUnref(priv->tls);
> priv->tls = NULL;
> diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
> index 010c5c3..51b80a2 100644
> --- a/src/rpc/virnetclient.c
> +++ b/src/rpc/virnetclient.c
> @@ -674,8 +674,15 @@ virNetClientCloseLocked(virNetClientPtr client)
> virKeepAliveStop(ka);
> virObjectUnref(ka);
> }
> - if (closeCb)
> + if (closeCb) {
> + /* the callback has to delay for a while until the connection object
> + * is being freed in the original thread that closed the connection
> + * */
> + printf("\n\n DEBUG: calling the close callback\n\n");
> + sleep(2);
> closeCb(client, closeReason, closeOpaque);
> + printf("\n\n DEBUG: callback returned\n\n");
> + }
>
> virObjectLock(client);
> virObjectUnref(client);
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130401/bf575a37/attachment-0001.sig>
More information about the libvir-list
mailing list