В письме от Воскресенье, 30-июн-2013 03:41:37 пользователь Александр
написал:> В письме от Вторник, 25-июн-2013 11:47:10 пользователь Michal Privoznik
>
> написал:
> > On 24.06.2013 11:36, Александр wrote:
> > > libvirtd will lock if for example kill programm which established
> > > connection,>
> > >
> > > only sigkill + restart helps., to reproduce:
> > > virConnectPtr libvirt_connection =
virConnectOpen("qemu:///system");
> > > if(libvirt_connection == NULL)
> > > {
> > >
> > > std::cout<<"failed to connect to
qemu:///system\n";
> > > exit(-1);
> > >
> > > }
> > > exit(0);
> >
> > Unfortunately, I'm unable to reproduce. Can you 't a a bt'
again? Are
> > you able to try the current git HEAD?
> >
> > Michal
>
> i also fail to reproduce it now, but my program still locks libvirt,
> currently i trying to create domain with
>
> <?xml version="1.0" encoding="UTF-8"?>
> <domain type="kvm">
> <tittle>Automatically created domain with default
configuration</tittle>
> <uuid>70a2e046-769c-43d2-88a0-5310ce33cbf8</uuid>
> <name>vm1</name>
> <description>no description</description>
> <os>
> <type>hvm</type>
> <boot dev="cdrom"/>
> <boot dev="hd"/>
> </os>
> <vcpu>1</vcpu>
> <memory unit="MB">512</memory>
> <cpu model="host-model">
> <topology sockets="1" cores="1"
threads="1"/>
> </cpu>
> <clock offset="localtime"/>
> <devices>
> <graphics type="vnc" autoport="yes"
password="admin"/>
> <channel type="unix">
> <source mode="bind"
path="/var/run/vm1.sock"/>
> <target type="virtio"
name="org.guest_agent.0"/>
> </channel>
> </devices>
> </domain>
>
> backtrace from gdb
>
> t a a bt
>
> Thread 11 (Thread 0x7f57484a2700 (LWP 17528)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d26b in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 10 (Thread 0x7f5747ca1700 (LWP 17529)):
> #0 0x00007f574eddd344 in __lll_lock_wait () from /lib64/libpthread.so.0
> #1 0x00007f574edd8e56 in _L_lock_511 () from /lib64/libpthread.so.0
> #2 0x00007f574edd8caa in pthread_mutex_lock () from /lib64/libpthread.so.0
> #3 0x00007f574f12bcd1 in virDomainObjListSearchName.23513 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574f129e95 in virHashSearch () from /usr/lib64/libvirt.so.0
> #5 0x00007f574f0bf46d in virDomainObjListAddLocked.isra.54.25425 () from
> /usr/lib64/libvirt.so.0
> #6 0x00007f574f0bf557 in virDomainObjListAdd () from
> /usr/lib64/libvirt.so.0 #7 0x00007f5741e7e8bf in qemuDomainDefineXML.40992
> () from
> /usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so
> #8 0x00007f574f06eddb in virDomainDefineXML () from
/usr/lib64/libvirt.so.0
> #9 0x00007f574facac6d in remoteDispatchDomainDefineXMLHelper.10498 () #10
> 0x00007f574f04ec27 in virNetServerProgramDispatch () from
> /usr/lib64/libvirt.so.0
> #11 0x00007f574f04f128 in virNetServerHandleJob.78060 () from
> /usr/lib64/libvirt.so.0
> #12 0x00007f574f17d1db in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #13 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #14 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #15 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 9 (Thread 0x7f57474a0700 (LWP 17530)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d26b in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 8 (Thread 0x7f5746c9f700 (LWP 17531)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d26b in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 7 (Thread 0x7f574649e700 (LWP 17532)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d26b in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 6 (Thread 0x7f5745c9d700 (LWP 17533)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d153 in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 5 (Thread 0x7f574549c700 (LWP 17534)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d153 in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 4 (Thread 0x7f5744c9b700 (LWP 17535)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> ---Type <return> to continue, or q <return> to quit---
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d153 in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 3 (Thread 0x7f574449a700 (LWP 17536)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d153 in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 2 (Thread 0x7f5743c99700 (LWP 17537)):
> #0 0x00007f574edda90c in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1 0x00007f574f17b246 in virCondWait () from /usr/lib64/libvirt.so.0
> #2 0x00007f574f17d153 in virThreadPoolWorker.18087 () from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f1adef1 in virThreadHelper.17820 () from
> /usr/lib64/libvirt.so.0
> #4 0x00007f574edd6d63 in start_thread () from /lib64/libpthread.so.0
> #5 0x00007f574eb0e04d in clone () from /lib64/libc.so.6
>
> Thread 1 (Thread 0x7f574fa45740 (LWP 17527)):
> #0 0x00007f574eb0476d in poll () from /lib64/libc.so.6
> #1 0x00007f574f14ad5e in virEventPollRunOnce () from
> /usr/lib64/libvirt.so.0 #2 0x00007f574f11841d in virEventRunDefaultImpl ()
> from
> /usr/lib64/libvirt.so.0
> #3 0x00007f574f18d79d in virNetServerRun () from /usr/lib64/libvirt.so.0
> #4 0x00007f574fac4149 in main ()
>
>
> i using git build 3a214482ec07be65adcfa9d8e08ad55a333589bb
i have found source of problem, my code looks like this:
int count = virConnectListAllDomains(connection, NULL, 0);
....
domain = virDomainDefineXML(connection, d.write_to_string().c_str());
call to virConnectListAllDomains always cause libvirt deadlock.
and another question, is here exists any other way to determinate number of
persistent domains ?