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

prevent debugpy from getting stuck #7612

Merged
merged 16 commits into from
Sep 24, 2021
10 changes: 9 additions & 1 deletion src/client/debugger/jupyter/debuggingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,15 @@ export class DebuggingManager implements IExtensionSingleActivationService, IDeb
return;
}

if (this.notebookInProgress.has(editor.document) || this.isDebugging(editor.document)) {
if (this.notebookInProgress.has(editor.document)) {
return;
}

if (this.isDebugging(editor.document)) {
this.updateToolbar(true);
Copy link
Member

Choose a reason for hiding this comment

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

Why do you have to do this here? If you are already debugging, shouldn't it already be in this state?

Copy link
Author

Choose a reason for hiding this comment

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

it should, but that's the buggy state you get trapped in.

this would correct the context keys

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure i like this, feels like we're re-executing some code & that seems to fix a problem (but we don't know why).
I would like us to fix the root cause, why is this required in the first place

Copy link
Author

Choose a reason for hiding this comment

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

The root cause is out of our hands, its debugpy freezing inside ipykernel.

And I disagree, we should be trying to fix root causes, but since the root cause is not on our code, we should also try to fix it if it happens.

Copy link
Contributor

@DonJayamanne DonJayamanne Sep 23, 2021

Choose a reason for hiding this comment

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

its debugpy freezing inside ipykernel.

If that's the cause, how can updating the toolbar fix anything in the kernel (i.e. updating a UI will not address anything in ipykernel freezing).
I think Rob and I would like to know why we need lines 225-230 when we're already debugging,
I dont' think this has to do with ipykernel state.
Unless I'm missing something here.

Copy link
Member

Choose a reason for hiding this comment

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

It seems like the root cause is us having the context keys out of sync with the RBL lifecycle. Your latest commit is a good one towards fixing that, I think previously we reset the context keys too early, before debugging actually stopped.

Fundamentally, at this point in the code, two things are out of sync. It's hard to point at one and say this one is always right. It should be possible to write the code so that they are always in sync.

if (mode === KernelDebugMode.RunByLine) {
this.updateCellToolbar(true);
}
return;
}

Expand Down