react icon indicating copy to clipboard operation
react copied to clipboard

[DevTools Bug]: "Message length exceeded maximum allowed length" when profiling a complex application

Open joshkel opened this issue 2 years ago • 20 comments

Website or app

N/A

Repro steps

When profiling a complex, proprietary app, I regularly get an error message, "Message length exceeded maximum allowed length."

Steps to reproduce:

  1. Within the Dev Tools, go to the Profiler tab.
  2. Click the "Start Profiling" button.
  3. Let the app run for a bit. Do some things in the app.
  4. Click the "Stop Profiling" ("record") button.

At this point, the Chrome Dev Tools console logs an error:

contentScript.js:116 Uncaught Error: Message length exceeded maximum allowed length.
    at handleMessageFromPage (contentScript.js:116:10)

And the Profiler tab is stuck with the message, "Processing data... This should only take a minute."

The error is thrown from https://github.com/facebook/react/blob/64fe791be84ad04a4a1d005376ba5cf5701db9b7/packages/react-devtools-extensions/src/contentScript.js#L36

The last time this occurred, when breaking on exceptions at that line, JSON.stringify(event.data.payload).length reports 92074565. I can provide further information on the contents of the problematic event.data.payload if that would be helpful.

I apologize for the lack of a reproducible test case - it's a complex app (which is why I was looking into profiling), and I don't think I could simplify it down to a public test case while triggering the error.

How often does this bug happen?

Often

DevTools package (automated)

No response

DevTools version (automated)

No response

Error message (automated)

No response

Error call stack (automated)

No response

Error component stack (automated)

No response

GitHub query string (automated)

No response

joshkel avatar Oct 04 '22 15:10 joshkel

I think I can do this, Can you assign this issue to me, please?

muhammadjufry avatar Oct 05 '22 09:10 muhammadjufry

You sure can do this

greenlife-developer avatar Oct 06 '22 15:10 greenlife-developer

Bumping. Any updates? I just had this happen to me and I can reproduce this. I can't post the code publicly because this is also an internal app but I am up for a screenshare or something to go through debugging it.

elliot-huffman avatar Mar 22 '23 02:03 elliot-huffman

I think he couldn't do this ;) (teasing) but yeah I have the same issue now!

PiTiLeZarD avatar Dec 18 '23 23:12 PiTiLeZarD

Yep, same here!

fgatti675 avatar Jan 29 '24 21:01 fgatti675

@PiTiLeZarD @fgatti675 are either of you able to share a reproducible example?

pwbriggs avatar Jan 30 '24 04:01 pwbriggs

Got the same issue, any updates? Is there a workaround?

kaikun213 avatar Feb 12 '24 12:02 kaikun213

Also have this issue, albeit a slightly different stacktrace:

proxy.js:1 
 Uncaught Error: Message length exceeded maximum allowed length.
    at handleMessageFromPage (proxy.js:1:779)
handleMessageFromPage	@	proxy.js:1
postMessage (async)		
send	@	backendManager.js:1
(anonymous)	@	bridge.js:72
setTimeout (async)		
(anonymous)	@	bridge.js:79
setTimeout (async)		
send	@	bridge.js:168
(anonymous)	@	agent.js:405
emit	@	events.js:37
(anonymous)	@	bridge.js:136
listener	@	backendManager.js:1
postMessage (async)		
handleMessageFromDevtools	@	proxy.js:1

Unfortunately i can't also share a repro scenario as "complex application" is proprietary.

Got the same error with both versions 4.2.8 and 5.0.0 of the react devtools

jorge-fernandes avatar Feb 21 '24 16:02 jorge-fernandes

@PiTiLeZarD @fgatti675 are either of you able to share a reproducible example?

Hi, we face this issue when debugging FireCMS. It is a fairly large project. It is all open source and can be run locally: https://github.com/firecmsco/firecms

If you would like to give it a try, running it should be as simple as yarn and yarn dev

fgatti675 avatar Feb 22 '24 11:02 fgatti675

I had the same issue in my program. In case it is useful to anyone: it turned out to be caused by a few runaway useEffects in my code that were constantly updating.

danielsgriffin avatar Apr 16 '24 22:04 danielsgriffin

Any update on this? I have the same issue in my app.

Aidam1 avatar Jul 23 '24 12:07 Aidam1

We experience this issue in our application aswell. Without the help of the react profiler performance optimizations are almost impossible so we would highly appreciate a fix.

mgmrx avatar Jul 31 '24 12:07 mgmrx

Experiencing same issue. Can someone please check this?

rahulparmar339 avatar Aug 01 '24 09:08 rahulparmar339

I just ran into this trying to profile a huge internal application and worked around it by reducing the number of components that I'm rendering (for example, don't map over the entire array but just a small slice). If you have bottlenecks in your application, they should still be visible when you profile the smaller version.

Angelelz avatar Aug 08 '24 14:08 Angelelz