-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
onImmediate is not a function #6298
Comments
The code has changed, yes. This should not cause any problems as long as you are passing a function as the first argument to |
Here is the Error.stack which unfortunately is not very complete, but this is what I get when the exception fires.
This is also probably in some dependency as in our code there is no _setImmediate_ used. If you can give an idea on how to obtain more of the stack i would appreciate that. |
@r0bot There’s https://www.npmjs.com/package/longjohn that can help you get longer stack trace information. |
I know this was before the timer rework by @Fishrock123, but maybe he can shed some light on this after having spent time with that module? |
This means something is manually setting If you use That being said, we do a check like this for timers, so we could also for immediates: https://github.com/nodejs/node/blob/master/lib/timers.js#L182 I suggest grepping for |
We are currently trying to track the issue with longjohn. Thing is that now that longjohn is active the issue stopped. Looking at the source of longjohn I see things like
which might be fixing the issue. |
I think that’s a good sign, because it means that the problem is actually very likely to be that some call to |
Unfortunately not as the issue is happening on a remote server and updating the node at this point is not possible. I can see that in the master branch setImmediate function has a check like this:
We will try to implement this check and see if it helps solves the problem. |
Adding this piece of code:
Added the check that was missing and threw the error in the right moment, so the stack was full and we were able to track the issue. One of our third party modules was calling setImmediate with undefined as a callback in some edge cases. |
Good to hear that this worked!
Unfortunately, I don’t think that’s possible… In #4362 people seemed to agree that this was a semver-major change because it changes the way in which errors are thrown, i.e. it won’t be able to go into v4 or v5. |
@r0bot it looks like the code that you highlighted is at least 2 years old so I don't think that we will be updating it in If you can come up with a way to introduce a guard that is not at all breaking we might be able to consider backporting it |
@thealphanerd One could do something like #4362 but with warnings instead of throwing an error… would that be worthwhile? |
That could work. |
@thealphanerd Sorry if I expressed myself a bit incomprehensibly… that is precisely what I had in mind. 👍 |
@addaleax awesome! Would you want to do that PR or should I? edit: it should be against |
@thealphanerd If you have the time, feel free to to that :) |
Hi,
We tried to update from 0.10.33 to 4.4.3, but the code below causes some issues. As you can see in the code below in 0.10.33 there was a check to see if _onImmediate was defined and in 4.4.3 there is not which causes the following error.
Is this a know issue and is there a know fix, or we have to go and find and fix the places where _undefined_ is passed as onImmediate function?
Node 0.10.33
Node 4.4.3
The text was updated successfully, but these errors were encountered: