[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] In freeze for libvirt-0.9.8 and availability of rc2



On Sun, Dec 04, 2011 at 04:10:34PM +0800, Daniel Veillard wrote:
> On Fri, Dec 02, 2011 at 02:30:35PM +0100, Peter Krempa wrote:
> > On 12/02/2011 01:42 AM, Daniel Veillard wrote:
> > >On Thu, Dec 01, 2011 at 02:11:24PM -0700, Eric Blake wrote:
> > >>But that means we really are committing to an rc2.
> > >
> > >   Definitely. For example there is apparently a problem with commit
> > >fa9595003d043df9f2efe95521c00898cef27106 that we ough to fix quickly too
> > >to allow further testing :-)
> > >
> > >Daniel
> > >
> > The problem was caused by two threads that both were thinking they
> > are having the buck and entering poll() which caused some clients to
> > hang. It was possible due to a race condition and therefore was not
> > 100% reproducible. It should be fixed now with:
> > http://www.redhat.com/archives/libvir-list/2011-December/msg00116.html
> 
>   Indeed, the current git head works fine again for me, thanks a lot
> for chasing this :-)
> 
>   So I made an second release candidate available at:
> 
> ftp://libvirt.org/libvirt/libvirt-0.9.8-rc2.tar.gz
> 
> along with rpms, I also tagged git with it.
>   Hopefully the builds on BSD and Windows should be fixed, it would
> be good if it could be tested on OsX and since there was a build done
> last month on Android, I wonder if this could be done again [1].

Thre is something very broken in the RPC code when an event loop
is activated, which is resulting in frequent crashes. Fixing this
is a release blocker IMHO.

Attaching a demo program which crashes 50% of the time or more with
GIT head.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#include <stdlib.h>
#include <stdio.h>
#include <libvirt/libvirt.h>
#include <pthread.h>

static int quit = 0;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;

static void *threadevent(void *arg)
{
    pthread_mutex_lock(&lock);
    while (!quit) {
        pthread_mutex_unlock(&lock);
        virEventRunDefaultImpl();
        pthread_mutex_lock(&lock);
    }
    pthread_mutex_unlock(&lock);
    return NULL;
}

static void *threadmain(void *arg)
{
    virConnectPtr conn = arg;
    virDomainPtr *doms;
    int *domids;
    int i,j;
    int n = virConnectNumOfDomains(conn);

    doms = malloc(sizeof(virDomainPtr) *n);
    domids = malloc(sizeof(int) *n);

    virConnectListDomains(conn, domids, n);
    fprintf(stderr, "n%d\n", n);
    for (i = 0 ; i < n ; i++)
        doms[i] = virDomainLookupByID(conn, domids[i]);

    for (j = 0 ; j < 10 ; j++) {
        for (i = 0 ; i < n ; i++) {
            virDomainInfo info;

            virDomainGetInfo(doms[i], &info);
            fprintf(stderr, "%s %llu\n", virDomainGetName(doms[i]), info.cpuTime);
        }
    }

    for (i = 0 ; i < n ; i++)
        virDomainFree(doms[i]);

    free(doms);
    free(domids);

    virConnectClose(conn);
    return NULL;
}

#define NUM_THREADS 10

int main(void) {
    virConnectPtr conn;
    int i;
    pthread_t threads[NUM_THREADS];
    pthread_t event;

    virEventRegisterDefaultImpl();

    conn = virConnectOpen("qemu:///session");

    pthread_create(&event, NULL,
                   threadevent, NULL);

    for (i = 0 ; i < NUM_THREADS ; i++) {
        virConnectRef(conn);

        pthread_create(&threads[i], NULL,
                       threadmain, conn);
    }

    for (i = 0 ; i < NUM_THREADS ; i++) {
        pthread_join(threads[i], NULL);
    }

    pthread_mutex_lock(&lock);
    quit = 1;
    pthread_mutex_unlock(&lock);
    virConnectClose(conn);
    pthread_join(event, NULL);

    return 0;
}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]