Reticulum icon indicating copy to clipboard operation
Reticulum copied to clipboard

make test -> ValueError: flush of closed file

Open iacore opened this issue 2 months ago • 3 comments

Output of make test on my side:

Running tests...
python3 -m tests.all
test_buffer_big (tests.channel.TestChannel.test_buffer_big) ... 
Exception ignored in: <_io.BufferedWriter>
Traceback (most recent call last):
  File "/usr/lib/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
ValueError: flush of closed file
ok
test_buffer_small_bidirectional (tests.channel.TestChannel.test_buffer_small_bidirectional) ... 
[2025-10-15 09:23:59] [Error]    Retry count exceeded on <RNS.Channel.Channel object at 0x7f4b0428b4d0>, t
earing down Link.
Exception ignored in: <_io.BufferedWriter>
Traceback (most recent call last):
  File "/usr/lib/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
ValueError: flush of closed file

Is this intended?

iacore avatar Oct 15 '25 09:10 iacore

This doesn't appear to be an issue with Reticulum, it appears to be an issue with unittest. I've not been able to locate a relevant issue for it upstream. Tests ran on versions previous to 3.13 did not fail in this fashion.

Aareon avatar Oct 28 '25 18:10 Aareon

Yes, something changed in 3.13 that introduced this. It's related to exit cleanup handling, and threads trying to write to buffers after the main process has been terminated, but not sure exactly what is going on.

markqvist avatar Nov 01 '25 13:11 markqvist

Probably related to freethreading (No GIL).

CPython Issue: https://github.com/python/cpython/issues/138720

Fixed here: https://github.com/python/cpython/pull/138724/files

iacore avatar Nov 02 '25 02:11 iacore