[Bug]: Windows: shared-instance RPC always fails with [Errno 9] Bad file descriptor since 4.9.3
MeshChatX version
4.9.3
Release channel
Stable
Platform
Desktop (Electron)
Operating system
Windows 11
OS details (if Other)
No response
How did you install MeshChatX?
Windows installer
What happened?
Symptom: every shared-instance RPC call fails, including interface_stats, first_hop_timeout, destination_data, next_hop and path_table. As a result the Interfaces page shows links as down, path probe returns 500, and the log fills with: Shared instance RPC failed while setting destination data use: [Errno 9] Bad file descriptor An error occurred while getting first hop timeout from shared instance: [Errno 9] Bad file descriptor Crash reports repeat with signature 3723fa807339125b: File "RNS\Reticulum.py", line 1776, in drop_path File "meshchatx\src\backend\rns_startup_recovery.py", line 235, in recv_bytes File "meshchatx\src\backend\rns_startup_recovery.py", line 229, in _read_exact OSError: [Errno 9] Bad file descriptor The data path on LocalInterface[37428] still works: paths resolve and announces arrive. Only the RPC calls fail. The same failure happens again right after restarting MeshChatX.
Cause: _DeadlinedRpcConnection.recv_bytes, added in 4.9.3, reads the reply with os.read(self._conn.fileno(), n). On Windows, multiprocessing.connection.Connection.fileno() for a socket connection returns a Winsock SOCKET handle, not a CRT file descriptor. Calling os.read() on that handle therefore always raises EBADF. On Linux the code works because sockets there are ordinary file descriptors.
Suggested fix: keep the poll(remaining) deadline and read with the connection's own method (self._conn.recv_bytes() or _recv) instead of os.read. Alternatively, on Windows, read through socket.socket(fileno=...) / recv, or skip the patch when os.name == "nt".
What did you expect?
MeshchatX can use prnsd shared instance
Steps to reproduce
- install prnsd on Windows
- use prnsd shared instance on MeshchatX 4.9.3
Logs or error output
Checklist
- [x] I searched existing issues to avoid duplicates
- [x] I included my MeshChatX version, channel, operating system, and install method
- [x] I can reproduce the issue with the steps above
Thanks for the report. If you can attach backend logs (Settings > Debug Logs, the lines around the error) or a screenshot, that usually helps us pin it down faster. No pressure either way.
Will be fixed in v4.10.2, I will do a release today.
Fixed in 4.10.2 (6a5ba792). Shared-instance RPC replies now read through the connection dispatch path (Connection._read) instead of os.read on the socket fileno, so Windows no longer raises EBADF on every shared-instance RPC.