react icon indicating copy to clipboard operation
react copied to clipboard

"Should not already be working" in Firefox after a breakpoint/alert

Open gzzo opened this issue 5 years ago • 75 comments

Do you want to request a feature or report a bug? Bug

What is the current behavior? I'm seeing "Error: Should not already be working" after upgrading to React 16.11

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

This is exclusively happening on an older version of Chrome, 68.0.3440 on Windows 7

I was unable to reproduce this in a VM environment but our Sentry is getting littered with these errors.

I know it's a long shot, but I wasn't able to find any information about this error anywhere, just a reference in the error codes file in react, so thought it would be a good idea to report this just in case. Curious if anyone has seen this.

gzzo avatar Nov 13 '19 16:11 gzzo

Is there any way you can provide a code sample that reproduces the problem? That error should only occur if there's a bug in React, so it'd be very helpful if we could reproduce.

aweary avatar Nov 13 '19 23:11 aweary

I see the same error message in sentry, and the breadcrumbs show an "out of memory" error - and then further down some react errors.

Not sure if it'll be useful, but here's some the breadcrumbs.

OS: Windows 7, Browser: Firefox 70.0 React: 16.9.0

out of memory
out of memory
08:21:52
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:21:52
sentry
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:21:52
xhr
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:21:52
sentry
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:21:53
xhr
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:21:57
xhr
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:22:22
fetch
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:23:25
xhr
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
08:23:30
xhr
08:24:39
exception
Error: Should not already be working.

CoryDanielson avatar Nov 17 '19 03:11 CoryDanielson

To add some more data points:

I'm not seeing out of memory errors on my end.

We downgraded to React 16.10.2 and are still seeing errors. Will keep downgrading and report back.

Also to the FB team, we're happy to share Sentry reports with you.

gzzo avatar Nov 18 '19 16:11 gzzo

I just updated my comment to include the React version (v16.9.0)


Edit: Also I searched outside of the last 24h and we've received this error many times.

Browser: Firefox 70.0 & 68.0 OS: Windows 10

Browser: Firefox 70.0 OS: Mac OS X 10.14

Browser: IE 11 OS: Windows 10

CoryDanielson avatar Nov 18 '19 16:11 CoryDanielson

I am getting the exact same sentry reports, but unable to reproduce the same in VM environment.

mohsinulhaq avatar Nov 21 '19 08:11 mohsinulhaq

We're seeing this in Sentry, too.

OS: Windows 10 Browser: Edge 18.18362 React 16.11.0 (from yarn.lock)

AFAICT it happens before the user did anything; here's the stack trace:

  at Lj(../node_modules/react-dom/cjs/react-dom.production.min.js:5382:1)
  at Anonymous function(../node_modules/react-dom/cjs/react-dom.production.min.js:2829:1)
  at t.unstable_runWithPriority(../node_modules/scheduler/cjs/scheduler.production.min.js:266:1)
  at fg(../node_modules/react-dom/cjs/react-dom.production.min.js:2794:1)
  at ig(../node_modules/react-dom/cjs/react-dom.production.min.js:2824:1)
  at Y(../node_modules/scheduler/cjs/scheduler.production.min.js:203:1)
  at A.port1.onmessage(../node_modules/scheduler/cjs/scheduler.production.min.js:94:1)```

jhou avatar Nov 27 '19 17:11 jhou

@gzzo Are you by any chance in any of your componentDidMount functions attempting to update the state as the first thing to do in that function?

I was getting the error Should not already be working when I had the following line in my componentDidMount function : this.setState({ hasLaunched: true });

shriniketsarkar avatar Dec 04 '19 15:12 shriniketsarkar

Interesting. We do call setState in a couple of componentDidMount. The React docs specify this is okay though:

You may call setState() immediately in componentDidMount(). It will trigger an extra rendering, but it will happen before the browser updates the screen. This guarantees that even though the render() will be called twice in this case, the user won’t see the intermediate state. Use this pattern with caution because it often causes performance issues. In most cases, you should be able to assign the initial state in the constructor() instead. It can, however, be necessary for cases like modals and tooltips when you need to measure a DOM node before rendering something that depends on its size or position.

gzzo avatar Dec 04 '19 16:12 gzzo

Hello,

We've also noticed this error in our sentry. It's only occurred once so far under these conditions:

OS: Windows 10 Browser: IE 11 React: 16.11.0

The stack trace does not appear to provide much additional info:

Error: Should not already be working.
  at Lj(webpack://[name]/./node_modules/react-dom/cjs/react-dom.production.min.js:223:104)
  at Anonymous function(webpack://[name]/./node_modules/react-dom/cjs/react-dom.production.min.js:121:110)
  at t.unstable_runWithPriority(webpack://[name]/./node_modules/scheduler/cjs/scheduler.production.min.js:18:431)
  at fg(webpack://[name]/./node_modules/react-dom/cjs/react-dom.production.min.js:120:318)
  at ig(webpack://[name]/./node_modules/react-dom/cjs/react-dom.production.min.js:121:61)
  at Y(webpack://[name]/./node_modules/scheduler/cjs/scheduler.production.min.js:17:178)
  at S.port1.onmessage(webpack://[name]/./node_modules/scheduler/cjs/scheduler.production.min.js:14:64)

rfboykin avatar Dec 16 '19 19:12 rfboykin

I had this same issue. Was not a problem in Chrome however I received a blank screen and the error. Error: Should not already be working. React 16.12.0 I had two(2) this.setState calls in conditional if statements in componentDidMount. This should have been ok however I removed them and figured a way to set them a little later and the error stopped. this.setState should have been ok to run in componentDidMount so I hope this gets resolved.

dvineyardUPD avatar Jan 15 '20 22:01 dvineyardUPD

We also experience this issue. React 16.12.0 OS: IOS 13.3 Browser: Safari

We have tons of cases were we call one or multiple 'setState' in 'componentDidMount'. It has never been an issue. Moving these calls to other places is not an option.

magnetnation avatar Jan 29 '20 14:01 magnetnation

I am able to reproduce the issue when stepping through a function after a breakpoint in an otherwise working development build application.

Console output: Error: Should not already be working. react-dom.development.js:24247 performSyncWorkOnRoot React performSyncWorkOnRoot self-hosted:920 flushSyncCallbackQueueImpl React unstable_runWithPriority scheduler.development.js:697 React 2 runWithPriority$2 flushSyncCallbackQueueImpl workLoop scheduler.development.js:641 flushWork scheduler.development.js:596 performWorkUntilDeadline scheduler.development.js:203 enter event-loop.js:79 enter self-hosted:874 _pushThreadPause thread.js:256 _pauseAndRespond thread.js:851 pauseAndRespond thread.js:1049 _makeOnStep thread.js:978 authCheckState auth.js:100 createThunkMiddleware Redux dispatch (index):1 onTryAutoSignIn App.js:42 componentDidMount App.js:17 React 6 commitLifeCycles commitLayoutEffects callCallback invokeGuardedCallbackDev invokeGuardedCallback commitRootImpl commitRootImpl self-hosted:975 unstable_runWithPriority scheduler.development.js:697 React 10 runWithPriority$2 commitRoot finishSyncRender performSyncWorkOnRoot scheduleUpdateOnFiber updateContainer legacyRenderSubtreeIntoContainer unbatchedUpdates legacyRenderSubtreeIntoContainer render js index.js:51 Webpack 7 webpack_require fn 1 webpack_require checkDeferredModules webpackJsonpCallback

xUSERxNAMEx avatar Feb 07 '20 21:02 xUSERxNAMEx

We also experience this issue since we bumped React.

React 16.12.0 Browser: Firefox 72/73/74 OS: Window 10, Mac OS 10.0/10.10/10.14

The stack traces point us to this function call

More detail

InvalidStateError An attempt was made to use an object that is not, or is no longer, usable

alexandcote avatar Feb 25 '20 15:02 alexandcote

Any movement on this? I am also getting these errors in FireFox (73.0.1 (64-bit) but not in Chrome (Version 80.0.3987.122 (Official Build) (32-bit) React - 16.12 React-Redux 7.1.3

It is happening when trying to initialize data from props:

//Parent Page
<SimpleForm sampleData = {sampleData} />

//SimpleForm.js
 componentDidMount (){
 if (this.props.sampleData) {
      this.props.initialize(this.props.sampleData);
}

Error:

performSyncWorkOnRoot React
    performSyncWorkOnRoot self-hosted:920
    flushSyncCallbackQueueImpl React
    unstable_runWithPriority scheduler.development.js:701
    React 2
        runWithPriority$2
        flushSyncCallbackQueueImpl
    workLoop scheduler.development.js:645
    flushWork scheduler.development.js:600
    performWorkUntilDeadline scheduler.development.js:197
    enter event-loop.js:79
    enter self-hosted:874
    _pushThreadPause thread.js:256
    _pauseAndRespond thread.js:851
    hit breakpoint.js:235
    componentDidMount Redux
    React 6
        commitLifeCycles
        commitLayoutEffects
        callCallback
        invokeGuardedCallbackDev
        invokeGuardedCallback
        commitRootImpl
    commitRootImpl self-hosted:975
    unstable_runWithPriority scheduler.development.js:701
    React 10
        runWithPriority$2
        commitRoot
        finishSyncRender
        performSyncWorkOnRoot
        scheduleUpdateOnFiber
        updateContainer
        legacyRenderSubtreeIntoContainer
        unbatchedUpdates
        legacyRenderSubtreeIntoContainer
        render
    js index.js:10
    Webpack 7
        __webpack_require__
        fn
        0
        __webpack_require__
        checkDeferredModules
        webpackJsonpCallback
        <anonymous>

rralbritton avatar Feb 26 '20 18:02 rralbritton

I got the same error 'Should not already be working' because I created a pipe write stream in my dataActions, shifting the function to a util file outside the action file fixed the issue for me.

nikhil3000 avatar Mar 06 '20 11:03 nikhil3000

I got the same error reported on sentry

Error: Should not already be working.
  at Lj(/node_modules/react-dom/cjs/react-dom.production.min.js:223:129)
  at b(/node_modules/react-dom/cjs/react-dom.production.min.js:121:115)
  at Lf(/node_modules/scheduler/cjs/scheduler.production.min.js:18:437)
  at fg(/node_modules/react-dom/cjs/react-dom.production.min.js:120:325)
  at ig(/node_modules/react-dom/cjs/react-dom.production.min.js:121:61)
  at X(/node_modules/scheduler/cjs/scheduler.production.min.js:17:184)
  at hf2P/S.port1.onmessage(/node_modules/scheduler/cjs/scheduler.production.min.js:14:64)
User-Agent: 
Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

I can point to the live website where this error was reported but I cannot reproduce it manually.

hinok avatar Mar 26 '20 12:03 hinok

Getting this error in React Native as well. react: "16.11.0" react-native: "0.62.2"

Based on my understanding of this reddit comment.

I think if user land code throws an error in componentDidMount, React does not reset state and next time render occurs, this Error "Should not already be working" gets thrown.

azizhk avatar Apr 27 '20 04:04 azizhk

I has this issue and the problem was related toan ajax call with jquery made in componentDidMount with async parameter to false, this causes some issues with latest react release to synchronise the state I assume. setting async to true solved the issue

rtremblet-fr avatar May 11 '20 09:05 rtremblet-fr

This happens to me if I set a breakpoint in componentDidMount, either by clicking the line number in Firefox's debugger or by calling debugger in the code.

dimaryaz avatar May 19 '20 05:05 dimaryaz

Ok, at least in my case, this looks like a... thread-safety issue? Firefox has no problem running JavaScript event handlers while stopped at a breakpoint, causing all kinds of bizarre behavior. I must've missed the memo that JavaScript is no longer single-threaded.

dimaryaz avatar May 19 '20 06:05 dimaryaz

@aweary Can we add some more diagnostic info, like what component React is working on, maybe that might give us some information on where to concentrate. Right now, we are getting multiple reports about users facing App Crashes (React Native)

azizhk avatar May 20 '20 01:05 azizhk

Just got this error in a React Native project. "react": "16.13.1", "react-native": "0.61.5"

cristianoccazinsp avatar May 25 '20 13:05 cristianoccazinsp

@cristianoccazinsp I've created an issue on react-native repo as well, because its a different renderer: https://github.com/facebook/react-native/issues/28948 Please do subscribe there as well.

azizhk avatar May 25 '20 14:05 azizhk

Same here if we run $.ajax() in componentDidMount(). Our solution is to use a setTimeout():

{
  componentDidMount() {
    setTimeout(() => {
      $.ajax();
    }, 300);
  }
}

guoyunhe avatar May 29 '20 15:05 guoyunhe

Hi @acdlite (sorry for tagging you here), Just wanted to know what React features would trigger the usage of unstable_runWithPriority. Maybe that might help in figuring out what is causing this issue and help with creating a reproduction.

azizhk avatar Jun 05 '20 05:06 azizhk

Hi Team,

I am facing this issue now in firefox browser. How to resolve this issue ? Any suggestion please?

karthikravichandran94 avatar Aug 29 '20 07:08 karthikravichandran94

My error reporting system has been reporting me this error in production for my react app https://twisti.app. anyone know what is causing it or how to fix it? the error message is not very helpful

user info:

Firefox 60.0
Windows 7
Windows

Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0

error:

error
Should not already be working.

/static/js/2.27fae31b.chunk.js at line 2

/*! For license information please see 2.27fae31b.chunk.js.LICENSE.txt */
(this.webpackJsonptwisti=this.webpackJsonptwisti||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(163)},function(e,t,n){"use strict" {snip}
//# sourceMappingURL=2.27fae31b.chunk.js.map

trace:


Status | internal_error
-- | --
Trace ID | 26d237fb8f5a4643b2fa8fc001a47e59
Span ID | ae29218588485a11
Operation Name | pageload



KyleAsaff avatar Sep 07 '20 04:09 KyleAsaff

This happens to me if I set a breakpoint in componentDidMount, either by clicking the line number in Firefox's debugger or by calling debugger in the code.

same with me, when i set a breakpoint between setState and Axios request in componentDidUpdate, this error will appear. But if i delete the breakpoint, everything is fine.

oopsRookie avatar Sep 27 '20 06:09 oopsRookie

Also seeing this reported all of a sudden by my application monitoring service. All on Windows 10 and Firefox 80 so far.

leojh avatar Sep 30 '20 04:09 leojh

Also having this problem. This only happened in Firefox for me; couldn't reproduce in Chrome (dev version 87).

Tried to isolate it - as far as I can tell, after a call to setState in componentDidMount, invoking the debugger anywhere in that method after that call will cause the error, and anywhere in subsequent calls to componentDidMount in any component, including subsequent children, parent components (since a parent calls its componentDidMount after its children) and even higher up & down the hierarchy (I tried as distant as two components with a common grandparent, still caused the error).

I tested this both with a Create React App project I was already working on, and a pretty barebones test project (only React, Babel, Webpack) and the error occurred in both, which both had the latest version of React as of this writing installed (16.13.1). Tested in the current Firefox release, 81.0.1, and the current Firefox Developer Edition, 82.0b7, no difference. All on Windows 10, version 2004 (build 19041.508, really hope that doesn't matter though).

Hope this helps.

NuclearFej avatar Oct 06 '20 07:10 NuclearFej