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
"Should not already be working" in Firefox after a breakpoint/alert #17355
Comments
|
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. |
|
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, |
|
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. |
|
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 Browser: Firefox 70.0 Browser: IE 11 |
|
I am getting the exact same sentry reports, but unable to reproduce the same in VM environment. |
|
We're seeing this in Sentry, too. OS: Windows 10 AFAICT it happens before the user did anything; here's the stack trace: |
|
@gzzo Are you by any chance in any of your I was getting the error |
|
Interesting. We do call setState in a couple of
|
|
Hello, We've also noticed this error in our sentry. It's only occurred once so far under these conditions: OS: Windows 10 The stack trace does not appear to provide much additional info: |
|
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. |
|
We also experience this issue. 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. |
|
I am able to reproduce the issue when stepping through a function after a breakpoint in an otherwise working development build application. Console output: |
|
We also experience this issue since we bumped React. React 16.12.0 The stack traces point us to this function call More detail
|
|
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) It is happening when trying to initialize data from props: Error: |
|
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. |
|
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.0I can point to the live website where this error was reported but I cannot reproduce it manually. |
|
Getting this error in React Native as well. 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. |
|
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 |
|
This happens to me if I set a breakpoint in |
|
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. |
|
@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. |
|
Just got this error in a React Native project. |
|
@cristianoccazinsp I've created an issue on react-native repo as well, because its a different renderer: facebook/react-native#28948 |
|
Same here if we run {
componentDidMount() {
setTimeout(() => {
$.ajax();
}, 300);
}
} |
|
Hi @acdlite (sorry for tagging you here), |
|
Hi Team, I am facing this issue now in firefox browser. How to resolve this issue ? Any suggestion please? |
|
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:
error:
trace: |
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. |
|
Also seeing this reported all of a sudden by my application monitoring service. |
|
Does anyone have reliable reproduction steps? We can't really help without them. |
|
I has this issue and the problem was related to an ajax call with jquery made in componentDidMount with async parameter to false, the réponse of tha call updated the state, this causes some issues with latest react release to synchronise the state I assume. setting async to true solved the issue |
|
See codesandbox above - run in firefox. |
|
Oh nice. Thanks. |
|
All right, so the consistent repro is:
There is some kind of timing assumption that gets broken by the |
|
@gaearon I can have a look at this |
|
Sure, thanks! |
|
Hi, guys! I ran into this problem on my app and thankfully, this issue is already raised here. I tried to debug the issue locally but I'm unable to reproduce the issue in my local build. Here's what I did:
Screen.Recording.2021-06-02.at.9.52.27.PM.movBased on the error trace, it seems like the error was triggered at I've done a quick investigation and it seems like the executionContext bit value is not equal to NoContext. I assume this means executionContext is still in the rendering stage? Here are the pics: Meanwhile, here are the context bits in Chrome at the same breakpoint: I'd be happy to investigate further into this if no one is taking it up, although it may take some time as I'm unfamiliar with React internals. Also, is there a way for me to test the production version locally e.g. using the production build to test the Thanks! |
|
@julianfssen i have been busy lately I think you have made some progress, I guess you can take it up from here |
Hey @mdaj06 ! Sorry for the slow reply. I apologize as I didn't see your comment about taking the issue up, in that case I will help you take a look at this and see what I can do. Thanks! |
|
TL;DR: Firefox does not block WebSockets execution for I had a look at this issue and made a few observations about why this is happening. This issue happens on Firefox for React v16.10 to the latest v17.02 release. In v16.10, @acdlite added the feature to use message channels to manage the cycle between performing work and yielding to the browser. This works perfectly on every browser except Firefox, which has an issue with it.
One way to observe the bug is to run the Try to change the React version and observe the behavior. If you pulled the latest commit as of today, there should be no issues for your local environment. There should also be no issues for v16.10 and below. Below are snippets to demonstrate the behavior. Observe the behavior and console logs in each browser. Behavior on Chrome: Screen.Recording.2021-06-09.at.9.05.20.PM.movBehavior on Safari: Screen.Recording.2021-06-09.at.9.06.31.PM.movBehavior on Firefox (buggy): Screen.Recording.2021-06-09.at.9.07.27.PM.movAfter calling However, I was curious why this happened in production but not when cloning the repo and testing it locally. It turns out this issue is fixed with the There should be no issues when using microtasks, but the Try checking out the branch (or the latest commit) and replicate the steps above. How to replicate the issue:
However, I'm not sure whether this is the real issue, despite my discoveries. @acdlite, may I know if these assumptions are aligned with your intentions when making the changes and if the replication steps is correct? Your commits helped a lot in drilling down the issue but I'm not familiar with React internals, so don't want to explain or assume the wrong things. |
|
@julianfssen, massive thanks for getting to the bottom of this. |
|
We're a bit overloaded with other things right now so I don't know if we'll take a detailed look very soon. You already gathered a lot of context for this issue — do you have a proposed fix in mind? |
|
@julianfssen Thanks for the detailed write up! So based on your description, Firefox has a bug where My guess for why Perhaps there is a way we could detect this scenario in development and fail more gracefully. I'm loath to add more code to the production build to address something that is ultimately a Firefox bug, and one that only happens during development (unless you use an |
|
I would be curious to know if the |
|
Yea that's the one that got me worried. Confirm is pretty common for "do you want to stay on this page?" flows. |
|
Right, So the fix for this would be pretty simple, I think — instead of throwing an error, we'd exit from the function. I think this would work because when the paused event continues and eventually finishes, it will re-schedule a new render to replace the one that we exited from. But this is a bit fragile, and I'd rather not commit to supporting this workaround long term. Hopefully we can convince the Firefox team to fix the underlying issue. |
|
@acdlite thanks for explanation! That makes sense, and I agree that altering logic to cater for a specific browser bug does not seem 'right'. However, the event loop bug in Firefox has been there for over a decade now so I'm not sure if it's going to be fixed anytime soon. Based on my tests, the microtasks implementation works correctly for the behavior above. Since most modern browsers support microtasks, perhaps this is 'fixed' if the implementation goes in the next release? @alexandcote thanks for pointing that out, I forgot about @gaearon thanks! I'd love to suggest a fix but my knowledge of React internals is not good at the moment. I'll have a look again and tinker around with the implementation this weekend based on @acdlite 's feedback. That said, if anyone wants to take over this issue, go ahead! The issue relates to WebSockets not pausing on calls that are supposed to block execution (e.g. |
|
We just ran across this in our Bugsnag logs this morning but it was ONLY for Chrome 83.0.4103 just like @mooflu. Maybe there is a bug in Chrome 83.0.4103 as well? It might be related to this code - |
|
Same error "Should not already be working" in Firefox but not Brave/Chrome (on Linux). Problem goes away when I wrap the call in setTimeout. |
|
I am getting the same behaviour in Firefox, when React is rendering components from within an IntersectionObserver and rendering components from outside of the same IntersectionObserver at the same time. Using window.setTimeout(renderCall, 0) from within the IntersectionObserver solves the issue. I also noticed this is only happening, if the component NOT rendered through IntersectionObserver is making a synchronous network call! I managed to duplicate the issue here: https://codesandbox.io/s/should-not-already-be-working-x1syi?file=/src/App.js I am guessing this observed behaviour in Firefox is related to the discussions in here. |











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.
The text was updated successfully, but these errors were encountered: