Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON-RPC python tests frequently fail with OSError: [Errno 9] Bad file descriptor #6082

Open
link2xt opened this issue Oct 21, 2024 · 4 comments

Comments

@link2xt
Copy link
Collaborator

link2xt commented Oct 21, 2024

Failure looks like this:

 ================================== FAILURES ===================================
_______________________________ test_acfactory ________________________________
[gw1] win32 -- Python 3.13.0 D:\a\deltachat-core-rust\deltachat-core-rust\deltachat-rpc-client\.tox\py\Scripts\python.EXE

acfactory = <deltachat_rpc_client.pytestplugin.ACFactory object at 0x000002049AC1DB50>

    def test_acfactory(acfactory) -> None:
        account = acfactory.new_configured_account()
        while True:
            event = account.wait_for_event()
            if event.kind == EventType.CONFIGURE_PROGRESS:
                assert event.progress != 0  # Progress 0 indicates error.
                if event.progress == 1000:  # Success
                    break
            else:
>               print(event)
E               OSError: [Errno 9] Bad file descriptor

tests\test_something.py:60: OSError

This looks like a problem with print usage in pytest when print attempts to print directly and something else (pytest?) closed the file descriptor.

pytest is configured in tox.ini with log_cli = true, maybe this changes something.

Here is CI log (from windows runner):
job-logs.txt

This is not the result of teardown, because by the time test_acfactory test failed with this print exception only 50% of tests passed and other tests continue to run successfully.

@link2xt
Copy link
Collaborator Author

link2xt commented Oct 21, 2024

This just happened another time with Windows:
https://github.com/deltachat/deltachat-core-rust/actions/runs/11440333909/attempts/1

Let's collect some failed runs to find out if it only happens on windows.

@link2xt
Copy link
Collaborator Author

link2xt commented Oct 23, 2024

@link2xt
Copy link
Collaborator Author

link2xt commented Oct 24, 2024

macOS failure:
https://github.com/deltachat/deltachat-core-rust/actions/runs/11489190507/job/31977700193

     def test_two_parallel_realtime_simultaneously(acfactory, path_to_webxdc):
        """Test two peers trying to establish connection simultaneously."""
        ac1, ac2 = acfactory.get_online_accounts(2)
        ac1.set_config("webxdc_realtime_enabled", "1")
        ac2.set_config("webxdc_realtime_enabled", "1")
    
        ac1_webxdc_msg, ac2_webxdc_msg = setup_realtime_webxdc(ac1, ac2, path_to_webxdc)
        ac1_webxdc_msg2, ac2_webxdc_msg2 = setup_realtime_webxdc(ac1, ac2, path_to_webxdc)
    
        setup_thread_send_realtime_data(ac1_webxdc_msg, [10])
        setup_thread_send_realtime_data(ac1_webxdc_msg2, [20])
        setup_thread_send_realtime_data(ac2_webxdc_msg, [30])
        setup_thread_send_realtime_data(ac2_webxdc_msg2, [40])
    
        wait_receive_realtime_data([(ac1_webxdc_msg, [30]), (ac1_webxdc_msg2, [40])])
>       wait_receive_realtime_data([(ac2_webxdc_msg, [10]), (ac2_webxdc_msg2, [20])])

tests/test_iroh_webxdc.py:147: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_iroh_webxdc.py:73: in wait_receive_realtime_data
    log(f"msg {msg.id}: got correct realtime data {data}")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

msg = 'msg 13: got correct realtime data [10]'

    def log(msg):
        print()
>       print("*" * 80 + "\n" + msg + "\n", file=sys.stderr)
E       OSError: [Errno 9] Bad file descriptor

tests/test_iroh_webxdc.py:28: OSError
----------------------------- Captured stdout call -----------------------------

@link2xt
Copy link
Collaborator Author

link2xt commented Oct 24, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant