vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Variables in local window stop stop updating their value when stepping through code quickly

Open stevencl opened this issue 11 years ago • 11 comments

In a node express app I have the following loop:

var msg = 'hello world'; var i = 0; while (i < 100) { msg = msg + i.toString(); i++; }

I set up the local and watch windows in the debugger so that I can see the msg variable in both.

When stepping through the loop, if I press F10 very quickly, eventually the msg variable in the locals window will stop updating. See the screenshot below snip_20151116130725

When stepping through quickly, I sometimes see a message in the watch window that says 'Exception while processing request'

This is on 0.10.0

stevencl avatar Nov 16 '15 13:11 stevencl

I can not repro this. I was even holding down F5 and all was good. @stevencl do you still see this on latest and with latest node version (e.g 4.2.1)? If yes please reopen this issue.

isidorn avatar Nov 20 '15 16:11 isidorn

debugger @isidorn Yes, I still see this issue in 0.10.1 and with the latest node (4.2.2). It happens when I step through the code very quickly.

stevencl avatar Nov 20 '15 17:11 stevencl

I am also able to replicate this. For me, it completly breaks the variable panel until restart of VS Code (can scroll but unable to expand any items and nothing gets updated)

jel-massih avatar Nov 22 '15 18:11 jel-massih

@weinand can you please try reproing this? I can not repro on my mac machine.

@jel-massih if it breaks the variables pane it should be unrelated since for steven the pane seems to be fine. If you open the developer tools console via command palette do you see some exceptions once the variables pane is broken?

isidorn avatar Nov 23 '15 08:11 isidorn

@isidorn, I have the same behaviour as @jel-massih. Here is the console log:

issue30.txt

stevencl avatar Nov 23 '15 09:11 stevencl

This looks like an exception on the node-debug side, moving to Andre

isidorn avatar Nov 23 '15 09:11 isidorn

@isidorn for me the problem is easily reproducible: open the dev tools console and step through the loop by keeping F10 pressed (and auto-repeat starts). You don't need a watch for this. After some time the 'index' problem occurs but the CALL STACK continues to update (line numbers of the top frame changes). But the VARIABLES view is stuck: it doesn't update and you cannot drill down into variables.

I've debugged the problem and here is my analysis:

After some time the UI sends a 'scope' request with an invalid frame id. This can happen if node-debug already got another 'step' request which has invalidated the frames of the previous step. Since node-debug did not check for this situation sufficiently, a "Cannot read property 'index' of undefined" occurs. I've fixed this problem by returning a proper error. However, the variables UI still doesn't work because it doesn't seem to be able to recover from exceptions or proper errors returned from the 'scope' request.

Could you please try to reproduce with my steps from above and then try to fix the issue that the variables view does not recover from an exception/error returned from the 'scope' request.

weinand avatar Nov 23 '15 12:11 weinand

Thanks for the analysis. I will look into it following your steps.

isidorn avatar Nov 23 '15 12:11 isidorn

In case of an error I now set the scopes to []. This way all consectuive step attepts should recover the variables view.

Please note that I was still unable to repro this on my machine, so please verify instead of me. Thanks

isidorn avatar Nov 23 '15 15:11 isidorn

@isidorn @stevencl With the latest fixes in VS Code and node-debug I'm no longer able to reproduce the problem on OS X. Steven could you please try on Windows?

weinand avatar Nov 23 '15 17:11 weinand

Thanks, I confirmed that this fix works on Windows too. Thanks!

stevencl avatar Nov 24 '15 10:11 stevencl