Re: [gamin] python gamin hanging



On Fri, Sep 15, 2006 at 10:23:53AM -0600, Adam Olsen wrote:
> I'm recursively watching a bunch of directories for changes using something
> like this:
> 
> gam = gamin.WatchMonitor()
> 
> for root, dirs, files in os.walk("/somedir"):
>    for dir in dirs:
>        mon.watch_directory(dir, some_callback)
> 
> It works most of the time, but occassionally (usually when a lot of
> directories are being watched), mon.watch_directory hangs completely.  The
> directory it hangs on seems to be arbitrary.
> 
> What am I doing wrong?

  You are not handling callbacks ! By driving the registration by 
walking the tree directly instead of by registering subdir when 
gamin provides the directory list, all the event reported by gamin
related to directory content when registering a new watch pile up
on your connection ... untill it stuck. It won't be able to send more 
packet to the server because the server is stuck trying to send packets
to your client, which just ignore those continuing to walk and register
monitors.
  Don't do that or switch off directory lists on new monitors.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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