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

Exception being thrown from tartiflette #34

Closed
rjwills28 opened this issue May 12, 2022 · 3 comments
Closed

Exception being thrown from tartiflette #34

rjwills28 opened this issue May 12, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@rjwills28
Copy link
Collaborator

While running coniql locally I occasionally see exceptions being thrown by tartiflette. This occurred when testing the cs-web-proto and using coniql+cs-web-proto to monitor 100 PVs changing at a rate of 10Hz.

Exception:
Traceback (most recent call last): File "/home/cnuser/.local/share/virtualenvs/coniql-W5jWBl11/lib/python3.7/site-packages/tartiflette/execution/execute.py", line 200, in execute_operation fields, File "/home/cnuser/.local/share/virtualenvs/coniql-W5jWBl11/lib/python3.7/site-packages/tartiflette/execution/execute.py", line 147, in execute_fields return_exceptions=True, concurrent.futures._base.CancelledError

@rjwills28
Copy link
Collaborator Author

I have noticed that on occasion the Coniql application does not unsubscribe from all of the PVs when the websocket disconnects. For example when navigating away from a webpage displaying PV updates.

I was debugging the subscribes and unsubscribes in Coniql and noticed this. If it does not unsubscribe from a PV, then when the page is reloaded, a new subscription is created on top of this and we start a memory leak as the first one never gets removed.

I believe this issue is related to the exception detailed in this ticket. The asyncio.gather task here gets cancelled, causing the exception and meaning that the rest of that method does not get executed.

However something else must be happening underneath with the tasks that the asyncio.gather is running as I see this exception on occasions when Coniql does unsubscribe from all PVs and on times where it doesn't and starts a memory leak.

A quick fix to avoid this exception is to surround the asyncio.gather with a try-except:

try:
    awaited = await asyncio.gather(*list(to_await.values()), return_exceptions=True)
    for index, result in zip(to_await, awaited):
        results[index] = result
except asyncio.CancelledError:
            pass

With this fix in place I found that I could no longer reproduce the scenario where Coniql does not unsubscribe from all PVs. The only problem of course is that this fix is in the tartiflette code.

@aawdls
Copy link
Contributor

aawdls commented Feb 13, 2023

This will be resolved on moving to Strawberry.

@aawdls aawdls added the bug Something isn't working label Feb 14, 2023
@rjwills28
Copy link
Collaborator Author

Resolved in move to use the Strawberry API in PR #44.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants