question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cycle debugging results in a runaway process that crashes the system

See original GitHub issue
  • VS Code version: 1.21.1
  • Extension version (available under the Extensions sidebar): XXX
  • OS and version: Antergos (Arch Linux based) kernel 4.14.32-1-lts
  • Python version (& distribution if applicable, e.g. Anaconda): python3.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv

Actual behavior

itertools.cycle() returns an infinite sequence of items. When debugging, hovering the mouse over the cycle() object displays details about its items. VSCode will allocate memory ad infinitum and crash the entire system when it runs out of memory (in less than 2 second on my machine with 16GB or RAM).

Expected behavior

No crash occurs, maybe only some items in the iterator should be displayed? With a hardcoded limit of only a few items perhaps? Or just not expanded at all just to be safe.

Steps to reproduce:

  1. import itertools
  2. Create an itertools.cycle() like so mycycle = itertools.cycle((1,2,3))
  3. Start debugging
  4. After the cycle class has been instantiated and populated (e.g. from a list), hover the mouse cursor above its symbol mycycle
  5. Click “items” to expand the list in the popup details view.

Logs

No logs, system hard locks, no way to recover but to cold reboot the system.

I don’t know TypeScript, but it looks like the problem is located around here maybe: https://github.com/DonJayamanne/pythonVSCode/blob/master/src/client/debugger/Main.ts#L637

Maybe cycles should be marked as not expandable?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
glubsycommented, Sep 28, 2018

Hovering over a cycle object in debug mode doesn’t show any detail about it anymore (except its memory address), so I suppose it will prevent any potential crash that way from now on. Thanks.

0reactions
DonJayamannecommented, Sep 27, 2018

@glubsy I believe we have fixed this issue. Please could you validate the fix in the latest development version of the extension. Instructions for installing the dev version can be found here https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING.md#development-build

Please feel free to re-open the issue if it hasn’t been resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception triggered when trying to render an infinite generator
DonJayamanne mentioned this issue on May 4, 2018. Cycle debugging results in a runaway process that crashes the system microsoft/vscode-python#1370.
Read more >
Say "Whoa!" to Runaway Processes
Say "Whoa!" to Runaway Processes · 1. Run windbg.exe from the Debugging Tools for Windows directory. · 2. Click File-Open Crash Dump and...
Read more >
How to analyze a process crash or hang when the cause is ...
When a Progress process is found crashing or hanging, the general approach to diagnose the issue is as follows: Try to isolate the...
Read more >
Debugging tips: How to exit a process on Linux
When this happens accidentally, it's normally because of a tight infinite loop in some low-level part of the system, such as the kernel,...
Read more >
My program crashed. How do I find out why?
Run the program from within a debugger (gdb if you have compiled with g++). Don't worry about breakpoints or single-stepping or any of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found