Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Cannot read property 'concat' of undefined" #18256

Closed
byronanderson opened this issue Mar 9, 2020 · 11 comments · Fixed by #19987
Closed

Error: "Cannot read property 'concat' of undefined" #18256

byronanderson opened this issue Mar 9, 2020 · 11 comments · Fixed by #19987

Comments

@byronanderson
Copy link

Describe what you were doing when the bug occurred:

  1. I was using the devtools to investigate some performance issues w/ an app I help maintain
  2. I had just turned on the "Record why each component rendered while profiling" checkbox
  3. I ran a profile while navigating on the underlying page

The react profiler tab in the devtools gave this error, I think as I clicked the record icon to stop recording the profile.


Please do not remove the text below this line

DevTools version: 4.5.0-355970aa4

Call stack: at N (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:160881)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:160015)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)
at j (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:40:159939)

Component stack: in ec
in div
in div
in div
in So
in Unknown
in n
in Unknown
in div
in div
in rl
in Ze
in fn
in Ga
in _s

@bvaughn
Copy link
Contributor

bvaughn commented Mar 9, 2020

Any chance this is reproducible, @byronanderson?

(And if so, any chance you could share steps for us to trigger it?)

@byronanderson
Copy link
Author

Nope, I had tried at the time, and tried again just now, but it won't happen again w/ the same steps.

I can say that the CPU was getting hammered by frequent large react rerenders due to the a redux selector returning a new object without proper memoization, if that tells you anything.

The only reason I even opened the issue was that the issue template was shown to me w/ the crash, so if this minified stack trace means nothing to you, I won't be offended by closing it.

@usama90ned

This comment has been minimized.

@bvaughn
Copy link
Contributor

bvaughn commented May 19, 2020

I assume this error is in CommitTreeBuilder because it's the only place in Profiler code that calls .concat() that I see:

const parentNode = getClonedNode(parentID);
parentNode.children = parentNode.children.concat(id);

In particular, the problem would happen if getClonedNode failed to find a matching node for the parent:

// Clone nodes before mutating them so edits don't affect them.
const getClonedNode = (id: number): CommitTreeNode => {
const clonedNode = ((Object.assign(
{},
nodes.get(id),
): any): CommitTreeNode);
nodes.set(id, clonedNode);
return clonedNode;
};

This isn't an expected case, so I'm not sure what went wrong here. Being able to repro this woudl be very helpful.

@bvaughn
Copy link
Contributor

bvaughn commented May 19, 2020

By the way, yesterday's release (v4.7) fixed several potential Profiler bugs. Maybe it also fixed this one. Were you able to repro this issue before? If so can you try with the latest/current DevTools?

@bvaughn
Copy link
Contributor

bvaughn commented Jun 16, 2020

Sample data set from #19137 that reproduces this bug.

profiling-data.06-16-2020.18-42-16.zip

The more interesting thing is to figure out how the data gets corrupted in the first place though which will require a repro.

@IDrissAitHafid
Copy link
Contributor

IDrissAitHafid commented Oct 6, 2020

I encountered the same error and I think I have a repro:

  1. Open React Devtools Profiler
  2. Select Hide components where type equals suspense
  3. Click on Reload and start profiling
  4. Click on a commit bar

DevTools version: 4.8.2-fed4ae024

@bvaughn
Copy link
Contributor

bvaughn commented Oct 6, 2020

@IDrissAitHafid Can you share your repro as a Code Sandbox app with instructions on how to run?

@IDrissAitHafid
Copy link
Contributor

IDrissAitHafid commented Oct 6, 2020

Okay, I'll see if I can do it!

@IDrissAitHafid
Copy link
Contributor

IDrissAitHafid commented Oct 6, 2020

@bvaughn can you see if you can reproduce it using this Code Sandbox app?

What I did was:

  1. export and run this app.
  2. Open React Devtools Profiler
  3. Select Hide components where type equals suspense
  4. Click on Reload and start profiling
  5. Click on the second commit bar

@bvaughn
Copy link
Contributor

bvaughn commented Oct 6, 2020

Nice repro! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants