mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
Notebooks: More Jupyter Server Hardening (#5264)
* Do not rely on same starting port every time, misc * put back to 5 seconds for process kill timeout * extHostNotebook shutdown manager handle
This commit is contained in:
@@ -86,8 +86,9 @@ export class ServerInstanceUtils {
|
||||
try {
|
||||
process.kill(childProcess.pid, 'SIGKILL');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
// All is fine.
|
||||
if (!error || !error.code || (typeof error.code === 'string' && error.code !== 'ESRCH')) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
@@ -230,8 +231,8 @@ export class PerNotebookServerInstance implements IServerInstance {
|
||||
return;
|
||||
}
|
||||
let notebookDirectory = this.getNotebookDirectory();
|
||||
// Find a port in a given range. If run into trouble, got up 100 in range and search inside a larger range
|
||||
let port = await ports.strictFindFreePort(new ports.StrictPortFindOptions(defaultPort, defaultPort + 100, defaultPort + 1000));
|
||||
// Find a port in a given range. If run into trouble, try another port inside the given range
|
||||
let port = await ports.strictFindFreePort(new ports.StrictPortFindOptions(defaultPort, defaultPort + 1000));
|
||||
let token = await notebookUtils.getRandomToken();
|
||||
this._uri = vscode.Uri.parse(`http://localhost:${port}/?token=${token}`);
|
||||
this._port = port.toString();
|
||||
|
||||
Reference in New Issue
Block a user