-
Notifications
You must be signed in to change notification settings - Fork 30k
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
doc: add domain post mortem #6159
Conversation
built-in http benchmark, `http_simple.js`, without domains it can handle over | ||
22,000 requests/second. Whereas if it's run with `NODE_USE_DOMAINS=1` that | ||
number drops down to under 17,000 requests/second. In this case there is only | ||
as single global domain. If we edit the benchmark so the http request callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as
-> a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a single domain
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global is more technically correct. though even more so if it said a single active global domain. since the domain is activated at startup and left active for the remainder of the script.
docs-wise LGTM with nits. Good write-up. |
intercept the exceptions of unrelated code in a different module. Preventing | ||
the originator of the code from knowing about its own exceptions. | ||
|
||
Another is the how domains route errors automatically if no `'error'` handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting with "Another" sounds kind of funny here. Maybe change it to "Domains also route errors..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps "Another issue is that domains route errors automatically...."
While on the topic, are there any thoughts about replacements and/or the way forward? Would it be beneficial to include at least a little information on that at the end of this document or no? |
@mscdex I'm hopeful that AsyncWrap can assume the functionality of continuous local storage. The postmortem intended to demonstrate the difficulty in properly implementing asynchronous error handling, and how anything mildly complex leads to a situation where reliable resource cleanup is impossible. Since my initial inception of AsyncListener, and its error handling implementation, I've reiterated on how to make this more feasible. After the initial features are implemented I'll write up a design doc for review. |
|
||
As we can see from this example a lot more must be done to properly clean up | ||
resources when something fails than what can be done strictly through the | ||
domain API. All domains offer us is an exception aggregation mechanism. Even |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All domains offer us
looks a bit weird. @trevnorris Is this the right wording?
LGTM ✅ |
1362cf0
to
e51b4b1
Compare
All nits addressed. @mscdex Would you like a small section about how we plan on moving forward now that this functionality has been deprecated? Would also like input from others on how this should be addressed. |
`domain.enter()`. Which then acts as a catch-all for any exception in the | ||
future that couldn't be observed by the thrower. Allowing a module author to | ||
intercept the exceptions of unrelated code in a different module. Preventing | ||
the originator of the code from knowing about its own exceptions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A code sample here would do wonders to explain this to people considering domains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
I left some comments @trevnorris - otherwise excellently written 👏 |
@trevnorris It's up to you, but after reading all of it it just seemed to kind of leave me hanging at the end. |
LGTM |
e51b4b1
to
9c82e15
Compare
@benjamingr Added two examples, changed error message and added a new section, with example, on using domain for data propagation. @mscdex See your point. I'll try to get something written up, but no promises. NOTE: Been working on this too long and too late. I don't take corrections to my grammar personally, so feel free to request changes. I know there are improvements that can be made, but too tired to see them. |
9c82e15
to
c096e6a
Compare
Very nice. |
I think Or |
LGTM otherwise. |
|
||
### API Gaps | ||
|
||
While APIs based using `EventEmitter` can use `bind()` and errback style |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"based using" -> "based on using"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
Nice work @trevnorris, so good to have all of this in one place that we can point to when it comes up. I think this needs an intro to explain why this doc exists in the first place, something along the lines of "The Domains API has been deprecated, this document explains some of the major problems observed with Domains and why the decision was made to scrap, rather than attempt to fix the API". Another possible addition here could be a section on complexity and the overhead that Domains has introduced in maintenance of so many parts of core. /cc @misterdjules who may have some good insight to add on this topic. |
Even manually removing the connection via `d.remove(c)` does not prevent the | ||
connection's error from being automatically intercepted. | ||
|
||
A failure that plagues both error routing and exception handling are the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar nit: "A failure ... are ..." <-- singular subject, plural verb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
6f6782a
to
ab675f2
Compare
@trevnorris LGTM |
ab675f2
to
b026231
Compare
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: nodejs#6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
b026231
to
4a74fc9
Compare
Thanks all. Landed in 4a74fc9. |
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: #6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: #6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: #6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: #6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
@trevnorris I've gone ahead and marked this don't land on v4 Please let me know if you think it should be backported to lts docs |
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: #6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: nodejs#6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
Do to various reasons, outlined in the committed document, domains were only in core for 2 years before being deprecated. This outline explains why they received criticism from the community and never gained traction with module authors. Also included is an example script that accompanies the postmortem analysis. PR-URL: #6159 Reviewed-By: Robert Lindstädt <[email protected]> Reviewed-By: Kelvin Knighton <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Brian White <[email protected]>
@thealphanerd Sounds fine. This is only informative. |
Checklist
Affected core subsystem(s)
doc
Description of change
The domain module did not live a long and fruitful life. Instead it was
ultimately deprecated and abandon. The domain postmortem addresses why
this happened so that it doesn't happen again in the future.
Also included is an example script that accompanies the postmortem
analysis.
R=@Fishrock123
R=@nodejs/documentation