Skip to content

Cycle debugging results in a runaway process that crashes the system #1370

@glubsy

Description

@glubsy
  • 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-debuggingbugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions