On Mon, Jun 26, 2017 at 10:27:54AM +0300, Maxim Kozover wrote:
I'd like to ask you, please, about multithreading with libguestfs. I'm using libguestfs 1.36.4 with Perl front-end.
Should it be possible to have the same libguestfs appliance provide both fuse interface and periodically perform some longer APIs like find0?
I mean make one Perl thread do mount_local_run and another thread periodically run find0 that executes simultaneously with fuse (hopefully not blocking fuse functionality internally until find0 exits)?
Unfortunately not, and as you discovered it will (currently) crash.
When I'm trying this, the whole thing crashes, so the question is if it should be possible, please, and if yes, how could the problem be fixed?
This is really a bug, and something we've been meaning to fix. What should happen is there is a lock in the handle which every API takes. It requires some changes to the generator to implement but is not necessary hard to do. In fact I posted patches for it a while back, but they did not get upstream: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html