feschber / lan-mouse

mouse & keyboard sharing via LAN
GNU General Public License v3.0
2.61k stars 82 forks source link

Recover from `Resource temporarily unavailable` error #193

Open xf- opened 2 months ago

xf- commented 2 months ago

If network is busy or the system is under high load it will throw a warning and a restart of lan-mouse is required.

Error

WARN  lan_mouse::server::emulation_task] input emulation exited: error emulating input: `io error: `Resource temporarily unavailable (os error 11)``

Would be nice to restart the handshake or whatever is at fault so it can recover from such an error.

feschber commented 2 months ago

this should prompt you to reenable input emulation like this: image

is that correct?

It would make sense to try recovering immediately without a prompt in some cases, but I wanted to avoid a situation where it constantly tries to reactivate the input emulation and fails (e.g. when the wayland compositor is terminated).

Will see what I can do.

xf- commented 2 months ago

I have no libadwaita and run it on cli. Maybe add an option for it. Feels like no retry or do 1 sec 10 sec 30 sec and afterward stop.

cargo build --release --no-default-features --features wayland,xdg_desktop_portal,libei 
feschber commented 2 months ago

Ah okay that makes sense, I have not implemented any way of reenabling the emulation via cli (yet).

Some sort of timeout would probably make sense for recoverable errors, yeah

feschber commented 2 months ago

by the way: How often does this happen? And it would be good to know what backends are being used.

xf- commented 2 months ago

by the way: How often does this happen? And it would be good to know what backends are being used.

Depends a lot on circumstances. Most common under high load (system or network). I sometimes feel like the switch is at its limit with 2.5 Gbit.

wayland - wayland

High load: Few seconds or every minute No load: Never an issue/weeks/months