#230 Spectranet freeze GUI

open
nobody
None
5
2013-01-01
2011-12-09
Sergio Baldoví
No

I tested simpleclient with fuse-spectranet branch (linux, gtk, svn r4580). alioth web server seemed a bit overloaded as response times were upto 2 min (see attachment)

I noticed that fuse was frozen most of the time and GUI was unresponsive. After the server response all went ok. I have not found out yet the operation or mutex that cause this, probably something worth fixing.

Discussion

  • I can reproduce this issue by these ways:
    - Changing simpletest to connect to a non existent server (e.g., 10.10.10.10), or
    - Blocking output TCP traffic with iptables:
    iptables -A OUTPUT -p tcp -j DROP

    The GUI freeze happens when connect() call. The main thread stalls until a network timeout raises. That's about 20 sec on Debian and Windows XP, or 3 min on Ubuntu. Eventually, if the working thread awakes from select(), it will be blocked too because a mutex was acquired before connect().

    A fix would be setting TCP connections as non-blocking and wait its completion in the working thread. In Windows success is reported in the writefds set and failure is reported in the exceptfds set. With BSD-sockets completion is reported in the writefds and we must check the socket status to determine whether completed successfully. Patch attached.

    Moreover, I've seen that spectranet emulation stall after connection failures. Fuse sets the socket status to CLOSED and sets the TIMEOUT interrupt, but spectranet sends a DISCON command which Fuse ignores. Assuming that W5100 chipset completes DISCON commands over CLOSED sockets, in my opinion Fuse should not ignore this command.