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

Error in handling closed websocket for inline completer #724

Open
krassowski opened this issue Apr 11, 2024 · 0 comments
Open

Error in handling closed websocket for inline completer #724

krassowski opened this issue Apr 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@krassowski
Copy link
Member

Description

When websocket gets disconnected we see:

Uncaught TypeError: Cannot read properties of undefined (reading '_reject')
    at reject (jlab_core.0c882064cb12a87cda90.js?v=0c882064cb12a87cda90:1:1731169)
    at we._onClose (392.e7fabd325dafbe2024f7.js?v=e7fabd325dafbe2024f7:1:37258)
    at i.onclose (392.e7fabd325dafbe2024f7.js?v=e7fabd325dafbe2024f7:1:37860)

Reproduce

This comes from:

private _onClose(e: CloseEvent, reject: any) {
reject(new Error('Inline completion websocket disconnected'));
console.error('Inline completion websocket disconnected');
// only attempt re-connect if there was an abnormal closure
// WebSocket status codes defined in RFC 6455: https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1
if (e.code === 1006) {
const delaySeconds = 1;
console.info(`Will try to reconnect in ${delaySeconds} s.`);
setTimeout(async () => await this._initialize(), delaySeconds * 1000);
}
}

Because the reject delegate is not bound to promise instance here:

socket.onclose = e => this._onClose(e, promise.reject);

Expected behavior

No error in onClose handling.

Context

  • Operating System and version:
  • Browser and version:
  • JupyterLab version:
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.
@krassowski krassowski added the bug Something isn't working label Apr 11, 2024
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

1 participant