Daniel P. Berrange
2006-Oct-06 00:01 UTC
[Xen-devel] [PATCH] Make XenD SEXPR HTTP/Unix server threaded
I''ve spent the best part of the afternoon trying to figure out why the virt-manager application was completely locking up while creating new domains. The actual domain creation was being done in a background thread to avoid blocking the main UI refresh thread, but even so it still locks up. After a little while I discovered that both threads were blocked waiting for data to come back from XenD, one in the wait_for_devices call, the other in a simple /xend/node GET. After much code inspection I eventually discovered that the HttpServer class in xen.web.httpserver serializes all pocessing of incoming HTTP requests. Since wait_for_devices was busy waiting for a domain to come up, the other /xend/node GET was being blocked & hence blocking the whole client application. Clearly this is a sub-optimal scenario because wait_for_devices can take a *very* long time indeed (30 seconds in my case due to network device setup failing). I did a very trivial hack to HttpServer class to make it spawn a new thread for every incoming request which ensures all client requests are fully parallelized. Before building this into the Fedora RPMs, I''m just wondering whether there was any special reason why for HttpServer being single threaded in the first place ? I thought perhaps some synchronization / race conditions perhaps, but given that the alternate XML-RPC server is fully multi-threaded I figure this is unlikely. I''m attaching the patch I knocked up - if anyone knows of a reason why this would cause problems, please shout :-) Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=| _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel