nodejs / nodejs/node

Cannot set a breakpoint on some modules

オープン
#36,403 コメント 16 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

confirmed-bug inspector
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

Environment

  • macOS 10.15.7
  • Node.js 15.x.x

Steps to Reproduce

$ node inspect -e "console.log('hello')"
< Debugger listening on ws://127.0.0.1:9229/c66c9b5b-fe08-43df-8494-0cd1609f277d
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in [eval]:1
> 1 console.log('hello')
debug> step
break in internal/console/constructor.js:341
 339 const consoleMethods = {
 340   log(...args) {
>341     this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args));
 342   },
 343
debug> step
break in internal/console/constructor.js:305
 303     ...consolePropAttributes,
 304     value: function(args) {
>305       const opts = this[kGetInspectOptions](this._stdout);
 306       return formatWithOptions(opts, ...args);
 307     }
debug> out
break in internal/console/constructor.js:341
 339 const consoleMethods = {
 340   log(...args) {
>341     this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args));
 342   },
 343
debug> step
break in internal/console/constructor.js:242
 240     ...consolePropAttributes,
 241     value: function(streamSymbol, string) {
>242       const ignoreErrors = this._ignoreErrors;
 243       const groupIndent = this[kGroupIndent];
 244
debug> list()
 237     }
 238   },
 239   [kWriteToConsole]: {
 240     ...consolePropAttributes,
 241     value: function(streamSymbol, string) {
>242       const ignoreErrors = this._ignoreErrors;
 243       const groupIndent = this[kGroupIndent];
 244
 245       const useStdout = streamSymbol === kUseStdout;
 246       const stream = useStdout ? this._stdout : this._stderr;
 247       const errorHandler = useStdout ?
debug> setBreakpoint(245)
Uncaught Error: Could not resolve breakpoint - undefined
    at _pending.<computed> (internal/deps/node-inspect/lib/internal/inspect_client.js:243:27)
    at Client._handleChunk (internal/deps/node-inspect/lib/internal/inspect_client.js:213:11)
    at Socket.emit (events.js:314:20)
    at Socket.EventEmitter.emit (domain.js:486:12)
    at addChunk (_stream_readable.js:321:12)
    at readableAddChunk (_stream_readable.js:297:9)
    at Socket.Readable.push (_stream_readable.js:236:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:192:23)
    at TCP.callbackTrampoline (internal/async_hooks.js:129:14) {
  code: -32000
}
debug> cont
< hello
< Waiting for the debugger to disconnect...
debug>

Expected Behavior

Able to set a breakpoint without any errors.

Actual Behavior

Cannot set a breakpoint. Getting an error and a stack trace shown on Steps to Reproduce section.

Analysis

If this is indeed a bug and not the expected behavior, I understand that 7a447bc is the commit that introduced this. How I reached this opinion is:

  1. Observed this issue on my local Node.js installation, which is 15.3.0.
  2. Using the n version manager for Node.js, tested it on all Node.js versions from 14.4.0 to 14.15.1. Observed that the issue does not happen on any of these versions.
  3. Then tested it with 15.0.0 and 15.0.1. The issue was observed in both versions (as well as my initial Node.js version, which is 15.3.0). Deduced that the issue starts with version 15.
  4. Using the n version manager, did a binary search on Node.js nightly binaries from v14.0.0-nightly20200421c3554307c6 (the last version that starts with v14) to v16.0.0-nightly20201021c2ceb15fd5 (the first version that starts with v16). That is, I performed a manual git bisect; first I downloaded v14.0.0-nightly20200421c3554307c6 and observed that it works fine. Then I downloaded v16.0.0-nightly20201021c2ceb15fd5 and observed that the issue is present. Then downloaded the version that's in the middle of them (which is v15.0.0-nightly2020072341c1e72b76) and observed that the issue is present.
  5. After a couple steps, I have realized that v15.0.0-nightly20200717bf0d82c102 is the last version that issue is not observed and v15.0.0-nightly202007187a447bcd54 is the first version that issue is observed. Upon observing this, I ran a comparison on GitHub between the commits of these versions (which are bf0d82c102 for the last working version and 7a447bcd54 for the first broken version). GitHub told me that the following are the commits between those versions:
    • bf0d82c
    • 08e8997
    • 5aeaff6
    • d10c59f
    • d379b00
    • 404302f
    • ef9964f
    • f045387
    • 1faf6f4
    • 7ecb285
    • 0b8ae5f
    • c943cb4
    • f8bde7c
    • b1c3909
    • 7a447bc
  6. Downloaded the Node.js source code, checked out bf0d82c, configured (./configure) and built it (make -j8) on my machine (which is macOS 10.15.7 with xcode-select version 2373). Observed that it works properly.
  7. Then, consecutively, checked out all commits (starting with 08e8997 and going towards 7a447bc), built them and tested them. Observed that the issue does not happen in any of them except the last commit, which is 7a447bc.
  8. Hence, if this is indeed a bug, I deduced that 7a447bc is the commit that introduced this bug.
My nightly build test results for reference (click on the arrow to expand)
WORKS - v15.0.0-nightly20200422d08bd41248/                 22-Apr-2020 07:30                   -
v15.0.0-nightly202004236a07eca49c/                 23-Apr-2020 07:30                   -
v15.0.0-nightly202004240619b600b2/                 24-Apr-2020 07:00                   -
v15.0.0-nightly2020042524a4e6153d/                 25-Apr-2020 07:30                   -
v15.0.0-nightly20200426f8d5474839/                 26-Apr-2020 07:00                   -
v15.0.0-nightly202004275ee1e31e38/                 27-Apr-2020 07:30                   -
v15.0.0-nightly20200428307c67be17/                 28-Apr-2020 08:30                   -
v15.0.0-nightly20200429e7b99e027b/                 29-Apr-2020 07:30                   -
v15.0.0-nightly202004302496db8e09/                 30-Apr-2020 07:30                   -
v15.0.0-nightly20200501e9518254d7/                 01-May-2020 08:30                   -
v15.0.0-nightly202005027c36ec38f1/                 02-May-2020 07:00                   -
v15.0.0-nightly20200503b0aba53195/                 03-May-2020 07:00                   -
v15.0.0-nightly20200504bde5f9baf7/                 04-May-2020 08:30                   -
v15.0.0-nightly20200505c17dcb3253/                 05-May-2020 08:30                   -
v15.0.0-nightly2020050686fdaa7455/                 06-May-2020 07:30                   -
v15.0.0-nightly202005078607f9ec5c/                 07-May-2020 07:00                   -
v15.0.0-nightly20200508bcdbd57134/                 08-May-2020 07:30                   -
v15.0.0-nightly20200509be7fd2d517/                 09-May-2020 07:00                   -
v15.0.0-nightly2020051094e5b5c77d/                 10-May-2020 07:00                   -
v15.0.0-nightly202005118a6fab02ad/                 11-May-2020 07:00                   -
v15.0.0-nightly202005128c5d58b5a7/                 12-May-2020 07:00                   -
v15.0.0-nightly202005135bb4d01fbe/                 13-May-2020 07:30                   -
v15.0.0-nightly20200514eaa16cd477/                 14-May-2020 07:30                   -
v15.0.0-nightly2020051524bf1adacc/                 15-May-2020 07:30                   -
v15.0.0-nightly20200516b533fb3508/                 16-May-2020 07:00                   -
v15.0.0-nightly20200517b3ca8869a6/                 17-May-2020 07:30                   -
v15.0.0-nightly20200518ef1eb8d439/                 18-May-2020 08:30                   -
v15.0.0-nightly20200519fe1b9e09a8/                 19-May-2020 07:30                   -
v15.0.0-nightly20200520a82001a387/                 20-May-2020 07:30                   -
v15.0.0-nightly20200521cd4985c488/                 21-May-2020 07:00                   -
v15.0.0-nightly2020052251af89fe45/                 22-May-2020 07:00                   -
v15.0.0-nightly20200523a416692e93/                 23-May-2020 07:00                   -
v15.0.0-nightly20200524dd5f209213/                 24-May-2020 08:30                   -
v15.0.0-nightly20200525458677f5ef/                 25-May-2020 07:00                   -
v15.0.0-nightly202005265007611294/                 26-May-2020 08:30                   -
v15.0.0-nightly202005279949a2e1e3/                 27-May-2020 08:30                   -
v15.0.0-nightly2020052847044a91c6/                 28-May-2020 08:30                   -
v15.0.0-nightly202005296a1df3b5af/                 29-May-2020 07:30                   -
v15.0.0-nightly20200530d79c330186/                 30-May-2020 07:00                   -
v15.0.0-nightly202005312935f72ae1/                 31-May-2020 08:30                   -
v15.0.0-nightly20200602b1704e4347/                 02-Jun-2020 07:30                   -
v15.0.0-nightly20200603680fb8fc62/                 03-Jun-2020 07:30                   -
v15.0.0-nightly202006043a7a5d7e62/                 04-Jun-2020 07:30                   -
v15.0.0-nightly202006053e2a300710/                 05-Jun-2020 07:30                   -
WORKS - v15.0.0-nightly202006063ac50e1209/                 06-Jun-2020 07:30                   -
v15.0.0-nightly20200607d8eef83757/                 07-Jun-2020 08:30                   -
v15.0.0-nightly202006088a4b5c63e0/                 08-Jun-2020 07:30                   -
v15.0.0-nightly20200609921f75534c/                 09-Jun-2020 08:30                   -
v15.0.0-nightly20200610362e4a1aec/                 10-Jun-2020 14:30                   -
v15.0.0-nightly20200611f4e805c860/                 11-Jun-2020 08:30                   -
v15.0.0-nightly20200612bba9b008ef/                 12-Jun-2020 07:30                   -
v15.0.0-nightly202006137b46793eee/                 13-Jun-2020 08:30                   -
v15.0.0-nightly20200614c17d2f9901/                 14-Jun-2020 07:30                   -
v15.0.0-nightly20200615f645cc7318/                 15-Jun-2020 08:30                   -
v15.0.0-nightly20200616b371213d3d/                 16-Jun-2020 09:00                   -
v15.0.0-nightly20200617ee7f0e3f75/                 17-Jun-2020 07:30                   -
v15.0.0-nightly20200618a4f3206b76/                 18-Jun-2020 07:30                   -
v15.0.0-nightly2020061956967afdca/                 19-Jun-2020 08:30                   -
v15.0.0-nightly20200620fdf10adef8/                 20-Jun-2020 07:30                   -
v15.0.0-nightly20200622122038c6a2/                 22-Jun-2020 07:00                   -
v15.0.0-nightly2020062386cbad837b/                 23-Jun-2020 06:30                   -
v15.0.0-nightly20200624d8f8723577/                 24-Jun-2020 07:00                   -
v15.0.0-nightly20200625e405e82f74/                 25-Jun-2020 07:00                   -
v15.0.0-nightly20200626e18afe45d2/                 26-Jun-2020 07:00                   -
v15.0.0-nightly20200627f63436d190/                 27-Jun-2020 07:00                   -
v15.0.0-nightly20200628f89530fccc/                 28-Jun-2020 09:00                   -
WORKS - v15.0.0-nightly2020062990d5f35f7a/                 29-Jun-2020 07:30                   -
v15.0.0-nightly20200630c23d2fd3f8/                 30-Jun-2020 07:30                   -
v15.0.0-nightly20200701e2b468eb5c/                 01-Jul-2020 07:30                   -
v15.0.0-nightly20200702c118304ad0/                 02-Jul-2020 08:30                   -
v15.0.0-nightly202007031dc837ed9a/                 03-Jul-2020 07:30                   -
v15.0.0-nightly20200704bff7de3b43/                 04-Jul-2020 08:00                   -
v15.0.0-nightly2020070556dbe466fd/                 05-Jul-2020 07:00                   -
v15.0.0-nightly2020070667ba825037/                 06-Jul-2020 08:30                   -
v15.0.0-nightly2020070730612316e4/                 07-Jul-2020 07:30                   -
v15.0.0-nightly20200708e0ecde9737/                 08-Jul-2020 07:30                   -
v15.0.0-nightly202007096ae1b9c457/                 09-Jul-2020 07:00                   -
WORKS - v15.0.0-nightly202007101237955d41/                 10-Jul-2020 07:00                   -
v15.0.0-nightly20200711c176d5fac2/                 11-Jul-2020 07:00                   -
v15.0.0-nightly20200712ac6ecd6b7f/                 12-Jul-2020 07:00                   -
v15.0.0-nightly20200714c7627da837/                 14-Jul-2020 08:00                   -
v15.0.0-nightly202007153b130327fa/                 15-Jul-2020 08:00                   -
v15.0.0-nightly20200716d46fc91be4/                 16-Jul-2020 08:00                   -
WORKS - v15.0.0-nightly20200717bf0d82c102/                 17-Jul-2020 08:00                   -
DOES NOT WORK - v15.0.0-nightly202007187a447bcd54/                 18-Jul-2020 07:30                   -
DOES NOT WORK - v15.0.0-nightly202007190c81cadec6/                 19-Jul-2020 08:30                   -
NO BINARY FOR MACOS - v15.0.0-nightly20200720a51436cbea/                 20-Jul-2020 06:30                   -
v15.0.0-nightly202007212c05beeb54/                 21-Jul-2020 08:00                   -
v15.0.0-nightly20200722b0b52b2023/                 22-Jul-2020 09:00                   -
DOES NOT WORK - v15.0.0-nightly2020072341c1e72b76/                 23-Jul-2020 09:00                   -
v15.0.0-nightly20200724d1e4e8eaba/                 24-Jul-2020 07:30                   -
v15.0.0-nightly20200725de192246bc/                 25-Jul-2020 07:00                   -
v15.0.0-nightly2020072631ba9a20bd/                 26-Jul-2020 07:00                   -
v15.0.0-nightly20200727db54b57042/                 27-Jul-2020 07:00                   -
v15.0.0-nightly202007286fd09e4f36/                 28-Jul-2020 07:00                   -
v15.0.0-nightly20200729360bf9b289/                 29-Jul-2020 08:30                   -
v15.0.0-nightly202007301fe39f0b4b/                 30-Jul-2020 08:30                   -
v15.0.0-nightly20200731dc00a07426/                 31-Jul-2020 07:00                   -
v15.0.0-nightly20200801cc7ec889e8/                 01-Aug-2020 07:00                   -
v15.0.0-nightly2020080273d713b16e/                 02-Aug-2020 07:00                   -
v15.0.0-nightly20200803a9c5b873ca/                 03-Aug-2020 07:00                   -
v15.0.0-nightly2020080474df7496ff/                 04-Aug-2020 07:00                   -
v15.0.0-nightly2020080584b35b2867/                 05-Aug-2020 07:00                   -
v15.0.0-nightly20200806df17fcdc71/                 06-Aug-2020 07:00                   -
v15.0.0-nightly2020080746bef7b771/                 07-Aug-2020 07:00                   -
v15.0.0-nightly20200808ac5773b1c3/                 08-Aug-2020 08:30                   -
v15.0.0-nightly202008098825eb4d73/                 09-Aug-2020 07:00                   -
v15.0.0-nightly20200810dd0c5228ac/                 10-Aug-2020 08:00                   -
v15.0.0-nightly20200811f8a0e62bbf/                 11-Aug-2020 07:00                   -
v15.0.0-nightly202008122f27f1144e/                 12-Aug-2020 08:30                   -
v15.0.0-nightly202008137a1220a1d7/                 17-Aug-2020 22:30                   -
v15.0.0-nightly202008145864fca7bc/                 17-Aug-2020 22:30                   -
v15.0.0-nightly202008158da8ec9c7e/                 17-Aug-2020 22:30                   -
v15.0.0-nightly20200816375b859428/                 17-Aug-2020 22:30                   -
v15.0.0-nightly2020081742a3a7f97d/                 17-Aug-2020 23:00                   -
v15.0.0-nightly20200818ca5ff723d1/                 21-Aug-2020 22:30                   -
v15.0.0-nightly202008196e97a735c8/                 21-Aug-2020 23:00                   -
v15.0.0-nightly2020082003293aa3a1/                 21-Aug-2020 23:00                   -
v15.0.0-nightly202008217aeff6b8c8/                 21-Aug-2020 23:00                   -
v15.0.0-nightly2020082244e6a6af67/                 22-Aug-2020 08:30                   -
v15.0.0-nightly202008238e8d429277/                 23-Aug-2020 08:30                   -
v15.0.0-nightly20200824c3d337db5d/                 24-Aug-2020 09:00                   -
v15.0.0-nightly20200825010383a174/                 25-Aug-2020 08:30                   -
v15.0.0-nightly20200826c6b96895cc/                 26-Aug-2020 09:00                   -
v15.0.0-nightly202008278ec3b55e5b/                 27-Aug-2020 08:30                   -
v15.0.0-nightly202008280848f56cb3/                 28-Aug-2020 08:30                   -
v15.0.0-nightly2020082994fcac7876/                 29-Aug-2020 08:30                   -
v15.0.0-nightly202008305c020762bb/                 30-Aug-2020 07:30                   -
v15.0.0-nightly20200831e1edd6bbfa/                 31-Aug-2020 07:30                   -
v15.0.0-nightly2020090159cad32b51/                 01-Sep-2020 07:30                   -
v15.0.0-nightly20200902e2ffa454d3/                 02-Sep-2020 07:00                   -
v15.0.0-nightly20200903b23a932bfd/                 03-Sep-2020 08:30                   -
v15.0.0-nightly202009043b925219c3/                 04-Sep-2020 08:30                   -
v15.0.0-nightly20200905186230527b/                 05-Sep-2020 08:30                   -
v15.0.0-nightly20200906e326c41fbc/                 08-Sep-2020 12:00                   -
v15.0.0-nightly20200907bb9117ee9f/                 08-Sep-2020 12:30                   -
v15.0.0-nightly202009086f2af08245/                 08-Sep-2020 12:30                   -
v15.0.0-nightly202009091204400d64/                 09-Sep-2020 08:30                   -
v15.0.0-nightly202009104c9b79ed5a/                 10-Sep-2020 07:00                   -
v15.0.0-nightly202009114f176c9110/                 11-Sep-2020 07:30                   -
v15.0.0-nightly20200912541d296d56/                 12-Sep-2020 08:30                   -
v15.0.0-nightly20200913b123e0806f/                 13-Sep-2020 07:00                   -
v15.0.0-nightly202009149d12c14b19/                 14-Sep-2020 07:00                   -
v15.0.0-nightly202009152b3eb101b5/                 15-Sep-2020 07:30                   -
v15.0.0-nightly202009169cf9e4aebc/                 16-Sep-2020 08:30                   -
v15.0.0-nightly2020091718462e0c1d/                 17-Sep-2020 08:30                   -
v15.0.0-nightly202009182d868fe822/                 18-Sep-2020 07:30                   -
v15.0.0-nightly2020091931b3202d59/                 19-Sep-2020 08:00                   -
v15.0.0-nightly20200920770ad3a52d/                 20-Sep-2020 08:30                   -
v15.0.0-nightly20200921039c274dde/                 21-Sep-2020 09:00                   -
v15.0.0-nightly20200922d71b467bbe/                 22-Sep-2020 08:30                   -
v15.0.0-nightly202009233b10f7f933/                 23-Sep-2020 07:00                   -
v15.0.0-nightly20200924d6fe46f749/                 25-Sep-2020 11:30                   -
v15.0.0-nightly20200925785a5f9ae1/                 25-Sep-2020 11:30                   -
v15.0.0-nightly20200926aa99bb47bf/                 26-Sep-2020 08:00                   -
v15.0.0-nightly20200927af92317909/                 27-Sep-2020 09:00                   -
v15.0.0-nightly202009286fc3b0ddb9/                 28-Sep-2020 08:00                   -
v15.0.0-nightly202009291e8cb08edc/                 29-Sep-2020 07:30                   -
v15.0.0-nightly20200930ee9e3e75aa/                 30-Sep-2020 08:30                   -
v15.0.0-nightly20201001726143e683/                 01-Oct-2020 07:00                   -
v15.0.0-nightly202010024a6005c56a/                 02-Oct-2020 07:00                   -
v15.0.0-nightly20201003e7bb8b6dc0/                 03-Oct-2020 08:00                   -
v15.0.0-nightly20201004e6d5af3c95/                 04-Oct-2020 08:30                   -
v15.0.0-nightly202010055e605c0dd9/                 05-Oct-2020 09:00                   -
v15.0.0-nightly20201006642f2064c0/                 06-Oct-2020 08:00                   -
v15.0.0-nightly20201007bc0c094b74/                 07-Oct-2020 07:00                   -
v15.0.0-nightly20201008ccc822c7c8/                 08-Oct-2020 07:00                   -
v15.0.0-nightly20201009c8b950a7af/                 09-Oct-2020 07:00                   -
v15.0.0-nightly202010108d8e06a345/                 10-Oct-2020 07:00                   -
v15.0.0-nightly2020101191e0d9bc30/                 11-Oct-2020 07:00                   -
v15.0.0-nightly202010122d83e743d9/                 12-Oct-2020 07:00                   -
v15.0.0-nightly2020101344a66adbaa/                 13-Oct-2020 07:00                   -
v15.0.0-nightly20201014d5e64952fe/                 14-Oct-2020 08:30                   -
v15.0.0-nightly202010154079bfd462/                 15-Oct-2020 21:00                   -
v15.0.0-nightly20201016c143266b55/                 16-Oct-2020 07:00                   -
v15.0.0-nightly20201017a3731309cc/                 17-Oct-2020 11:00                   -
v15.0.0-nightly20201018ee85eb9f8a/                 18-Oct-2020 07:30                   -
v15.0.0-nightly20201019c55f661551/                 19-Oct-2020 07:00                   -
v15.0.0-nightly2020102011f1ad939f/                 20-Oct-2020 07:00                   -
DOES NOT WORK - v16.0.0-nightly20201021c2ceb15fd5/                 21-Oct-2020 07:00                   -

Please view Other Places This Issue is Mentioned for more information on this issue and a GIF demonstration of the issue.

@joyeecheung
@addaleax

Other Places This Issue is Mentioned

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

node inspect -e "console.log('hello')" セッションで失敗を再現し、internal/deps/node-inspect/lib/internal/inspect_client.js の243行目付近にあるブレークポイント処理を調べてから、コミット 7a447bc と、その前の動作していたバージョンを比較します。ブレークポイントの設定時に未解決ブレークポイントエラーやスタックトレースが発生しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
cli, devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。