Skip to content

Pasting very long strings freezes node REPL on MacOS #43343

@JoBrad

Description

@JoBrad

Version

18.3.0

Platform

Darwin SoMuchBiggerOnTheInside-2.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64

Subsystem

No response

What steps will reproduce the bug?

  • Open iTerm2 version 3.4.15 and start a new node REPL session.
  • Ignoring the comment on the first line, copy the first 3,500 characters of the jQuery v3.6.0 minified library (https://code.jquery.com/jquery-3.6.0.min.js) into the REPL. The REPL will freeze.
  • Open a new tab, start a new node REPL, and paste ~2,000 characters of the library into the REPL. The code will be cut short. You can copy and paste new chunks of text into the REPL, as long as you keep your text less than ~2,000 - 3,500 characters in length. However if you paste more than that, the REPL will freeze.
  • Use this formatter to format the jquery library (don't make any changes to the default settings for the formatter): https://webformatter.com/javascript
  • Paste the first 128 lines into the REPL (including the first comment line). This is 3,906 characters. The REPL will display errors and only show part of the code you have pasted, but will not freeze.
  • The 129th line is the beginning of a for statement. Copying all of the text up until the end of the keyword for (but before the () and pasting this into the REPL will cause it to freeze. If you only copy a part of the word for it won't freeze.

How often does it reproduce? Is there a required condition?

I can replicate these symptoms every time. Note that I can paste the entire jQuery library into a Python REPL (in the same iTerm2 tab) without any freezing at all. The fact that the for keyword changes behavior makes me think the error is happening when parsing the language. It may be a regression of #32999 (or a similar bug, for Macs), but pasting the 1000 "a" commands in the gist below (mentioned in #32999 comments) does not cause the REPL to freeze.

https://gist.githubusercontent.com/bzoz/bba634114402fee35554f4972a0887b6/raw/c71217ab21ecdf8d6e0874e955fe3b780df4e89f/aaaaaa.txt

What is the expected behavior?

I expect the REPL to accept the pasted text.

What do you see instead?

The REPL freezes or only shows part of the pasted text.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    macosIssues and PRs related to the macOS platform / OSX.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions