You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hapi uses a protect method which registers a global error handler using node.js domains.
When multiple methods enter the get cache method, The callbacks are registered into a _pendings array.
After the cache is returned, there is a loop that invokes all the callbacks that are registered.
After that point the process.domain for each callback is the same as the one that started the cache.
If an error occurs in any of the subsequent requests, the wrong error handler is used in the protect method because it is registered to the wrong domain.
This means that requests that share the _pending queue will all have the wrong domain when they return.
Which makes the process.domain an unreliable storage space when using hapi.
This can easily be demonstrated using a flow like the following:
Hapi 8.8.0 (Also happens on 8.2.0 and 6.11.1)
Throwing an error breaks the request lifecycle when using a cached server method.
Only the first request is returned and the server is stuck.
This only happens when multiple connections are active at the same time.
Async.times
toAsync.timesSeries
The expected console output is:
0: Complete
1: Complete
The actual console output is:
0: Complete
Example Code:
The text was updated successfully, but these errors were encountered: