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

libjuju failure when trying to raise a websocket connection closed exception #1252

Open
gboutry opened this issue Jan 29, 2025 · 0 comments
Open
Labels
kind/bug indicates a bug in the project

Comments

@gboutry
Copy link
Contributor

gboutry commented Jan 29, 2025

Description

When a disconnection happens, a libjuju fails to raise a websocket connection closed failure.

Line emanating failure:

raise websockets.ConnectionClosed(1006, "no reason")

This seems linked to this commit of websockets:
python-websockets/websockets@5638611
https://github.com/python-websockets/websockets/blob/5638611169aa763ec84cdc8d2a967b0533401129/src/websockets/exceptions.py#L100

It introduced an assert that always fails in how python libjuju instantiates the exception.

Urgency

Blocker for our release

Python-libjuju version

3.6.1.0

Juju version

3.6.1

Reproduce / Test

This is a coding failure, just need to instantiate (not raise) the exception, and the assertion will fail:

python3
>>> import websockets
>>> websockets.ConnectionClosed(1006, "no reason")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gboutry/Documents/canonical/projects/python-libjuju/.venv/lib/python3.12/site-packages/websockets/exceptions.py", line 96, in __init__
    assert (self.rcvd_then_sent is None) == (self.rcvd is None or self.sent is None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
@gboutry gboutry added the kind/bug indicates a bug in the project label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug indicates a bug in the project
Projects
None yet
Development

No branches or pull requests

1 participant