lcpz / lain

Awesome WM complements
GNU General Public License v2.0
1.06k stars 210 forks source link

Filesystem (FS) widget freezes Awesome due to remote filesystem (network query) #462

Closed renyuneyun closed 3 years ago

renyuneyun commented 4 years ago

I'm using a few widgets from the lain library and it works great for a few years. However, I have recently set up autofs to mount my remote filesystems (samba share and NFS) automatically. When there are issues/changes with the network, the filesystem (fs) widget often freezes the whole awesome wm (and it may return responsible after a while, probably because the query timed out).

The reason I say it's the fs widget that freezes the whole awesome wm is because:

  1. If I remove the fs widget (both from the panel and its initialization), this freeze won't happen (for weeks, so I think it's safe to say it).
  2. Mouse cursor moves, but nothing related to mouse event happens (e.g. no switching of focused windows).

This doesn't happen when the network is good, i.e. queries to the filesystem returns reasonably fast. But when there are issues with the network or the remote machine, thie becomes observable and annoying.

Somewhere on the Internet (I forgot the source) says I can ignore some filesystems by adding a configuration options = "---exclude-type=nfs4", but this doesn't work, and doesn't exist on the wiki. So I believe this option has been deleted.

Therefore, there seems to be no way to avoid quering all mounted filesystems, so supporting async should be very useful, especially when the network latency is big.


Although probably doesn't matter, here are the required command outputs:

awesome v4.3 (Too long)
 • Compiled against Lua 5.3.5 (running with Lua 5.3)
 • D-Bus support: ✔
 • execinfo support: ✔
 • xcb-randr version: 1.6
 • LGI version: 0.9.2
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
lcpz commented 4 years ago

The reason is that the current implementation was not meant to be fault-tolerant against remote filesystems (a bit extreme use case).

However, it is also not asynchronous as it should.

This would be fixed by launching fs.update() asynchronously.

@psychon Could you please tell me if is there a way to execute the callback function of gears.timer asynchronously?

Another fix would be to give the possibility to select mounts by type or to specify them individually, instead of picking all.

psychon commented 4 years ago

Could you please tell me if is there a way to execute the callback function of gears.timer asynchronously?

Well... is there anything special about gears.timer? You can just use LGI's Async.start() in the same way that you can do everywhere. There even seems to be an async version of query_filesystem_info: https://developer.gnome.org/gio/2.64/GFile.html#g-file-query-filesystem-info-async (From a random guess, I would expect the other APIs to be non-blocking, but the docs do not really say anything about this, e.g. https://developer.gnome.org/gio/2.64/gio-Unix-Mounts.html#g-unix-mounts-get)

Or am I misunderstanding your question?

Random idea: Is there some FUSE filesystem that can be used to test this? E.g. an implementation which works for 10 seconds and then "freezes"?

Edit: Random example of a use of Async.start(): https://github.com/awesomeWM/awesome/blob/7a759432d3100ff6870e0b2b427e3352bf17c7cc/lib/menubar/utils.lua#L406