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

Pass session_id during Websocket connect #1440

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

gogasca
Copy link
Contributor

@gogasca gogasca commented Jun 29, 2024

Fixes: #1439

Pass HTTP query param session_id during Websocket channel connection.
Example:

GET /api/kernels/342eba8f-aa8c-47a9-8fee-8541cee8ddfe/channels

vs

GET /api/kernels/342eba8f-aa8c-47a9-8fee-8541cee8ddfe/channels?session_id=4feb3f46-4e83-4fba-bebd-3aba95e96fc0 

@@ -47,6 +47,8 @@ async def connect(self):
url_escape(self.kernel_id),
"channels",
)
if self.session_id:
ws_url += f"?session_id={self.session_id}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should session_id be escaped with escape_url? Also a test case would be nice :)

Copy link
Contributor Author

@gogasca gogasca Jun 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krassowski thanks for the feedback, used url_escape and added a test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test, but looks like Windows tests are failing for unrelated reason?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The windows tests were fixed in #1441

Copy link
Contributor Author

@gogasca gogasca Jul 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @blink1073 I synced to main and Windows tests work now, but now I get some coverage error. https://github.com/jupyter-server/jupyter_server/actions/runs/9821413970/job/27117179741?pr=1440 any pointers?

Error: Failed to ListArtifacts: Unable to make request: ECONNRESET
If you are using self-hosted runners, please make sure your runner has access to all GitHub endpoints: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github

Thanks

@blink1073 blink1073 added the bug label Jul 4, 2024
@blink1073
Copy link
Contributor

I kicked the coverage test, it looks like it was a temporary connectivity issue.

@gogasca
Copy link
Contributor Author

gogasca commented Jul 10, 2024

@krassowski would you mind taking another look? Thanks!

Copy link
Collaborator

@krassowski krassowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. It might be worth bringing it up on the server and kernels meeting tomorrow to check for other ideas.

@gogasca
Copy link
Contributor Author

gogasca commented Jul 11, 2024

@krassowski is it ok to merge? Thanks!

@krassowski
Copy link
Collaborator

It looks like @Zsailer commented during the meeting, maybe he can approve and merge (I do not have merge rights here).

Copy link
Member

@Zsailer Zsailer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @gogasca!

Pinging @lresende here too, since he's most familiar with the gateways. Luciano, do you know if e.g. enterprise_gateway tracks individual kernel (ZMQ connection) sessions in any way?

Note, this is different than "sessions" from the server's sessions API, which maps documents to kernels.

The sessions we are dealing with in this PR are tracking ZMQ client sessions. This flows a unique session_id from the browser-->server-->kernel's session client (i.e. at the ZQM interface). I think (?) that JupyterLab uses this type of session_id to distinguish messages coming from the same kernel to different documents, but I'm not totally sure.

We use the word "session" in too many places 😅

@Zsailer Zsailer merged commit b961d4e into jupyter-server:main Jul 12, 2024
36 checks passed
@gogasca
Copy link
Contributor Author

gogasca commented Jul 12, 2024

@Zsailer thanks! do you know when is the next jupyter_server release? Thanks

@Zsailer
Copy link
Member

Zsailer commented Jul 12, 2024

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

Successfully merging this pull request may close these issues.

Pass session ID during Websocket Upgrade connection when using Gateway.
4 participants