GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — doc: add warning for socket.connect reuse by ronag · Pull Request #33204 · nodejs/node Conversation
|
|
Might have to deprecate |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I appreciate the subtle problems it introduces in terms of state, but thorough review of ecosystem use-cases would be required, this is a long-standing feature. cc: @bnoordhuis who might have perspective on uses this is put to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
-1 Creating a new socket is not always a solution, especially if there are event handlers to carry over, user-added properties to carry over, etc. I think it would be better to come up with a solution to fix whichever edge cases instead of deprecating |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
In addition, I think there are options that can only be passed to the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I favor this direction but there are a ton of details to figure out. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
But it is possible to workaround this. Just create your own socket wrapper.
This has been broken for quite a while and no one has fixed it. I think it's better to deprecate than leaving it broken.
What options are those? We should fix so that |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Anything specific in mind? Other than the constructor situation? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Addressing a regression (#25969) with a method deprecation does not seem the proper way to fix it to me. What's wrong with |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
This has been an issue for a long time. Last time we discussed it we basically came to the conclusion that this use case should be very unusual and its not worth fixing. It just became relevant again given that issue.
When re-using the socket, i.e. calling |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That's an understatement. :-)
I agree with Luigi that deprecation because of bugs isn't a fix. The original I appreciate it's non-trivial to untangle but deprecation seems like the wrong direction. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Sorry to be a bit negative here. But I don't really see a way to fix this entirely. There simply is too much state and edge cases going on, at least for me. The way I see it we have the following options:
Given that 3. could take a while, I think in the short-medium term we need to do either 1 or 2. I'm fine with either.
As far as I can see, it has been subtly broken since at least 1.x (haven't checked further back). It's still "undestroying" even if it's inline. Depending on when exactly you call |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't recall any bug reports so perhaps it works well enough in practice. If you think it's inherently unfixable (I don't necessarily disagree) then documenting the caveats is a good idea. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I don't know what the exact caveats are. As far as I'm aware it's undefined behavior. So basically the documentation would be "here be dragons". The problem here is that there can be pending events from either IO or I'm not even sure what the user would expect in terms of behavior when I guess what I'm trying to say here is, we know it's broken, but not exactly how, we don't know the exact semantics of how we would like it to behave and it's difficult to fix so that it "reasonably" works. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I think the question here is; what should we do with an API we know (at least I'm personally convinced) is broken and we are unlikely to fix (at least I'm personally sceptical). Maybe I'm a bit ahead of things and there is someone that thinks they can reasonably (whatever that means) fix it within an acceptable (whatever that means) timeframe? It's been broken for a very long time so I guess there is no hurry. On the other hand I'm personally not comfortable leaving it broken without telling our users. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We can document that reusing a socket after it has been closed is not safe instead of deprecating const socket = new Socket(options); socket.connect(); instead of const socket = net.connect(options); which does the same thing and still uses |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I'm fine with this. EDIT: Though I would like to be able to sometime in the future throw when called for re-use. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This reverts commit 76bf3dd.
|
@lpinca: PTAL and see if you agree with the current wording. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2071fb9 to
b4c24ef
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
If a user waits for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
In theory yes. In practice, not necessarily.
EDIT: #33204 (comment) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I would be fine with changing the wording to " |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Can you show an example of this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, I got confused by #33137 which is actually another issue. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I personally would prefer the more limited and informative description in #33204 (comment), so people understand under what circumstances they are really asking for trouble, and what should work. Perhaps not the place to discuss, but if calling .connect() on a currently connected and active socket is particularly dangerous, I think its worth considering whether that very specific use could be deprecated, even runtime deprecated. That would require that it is possible to know that the socket is not in a quiescent and disconnected state. If that is possible, perhaps issuing a run-time warning that the use is not safe would be reasonable. I suspect that people are not regularly doing the unsafe connect, we'd be flooded with bug reports. <-- just a thought, an aside from this documentation here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0382a34 to
3d26329
Compare
|
@sam-github updated wording PTAL |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
3d26329 to
74430ce
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in e50ae7a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #33204 Refs: #25969 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #33204 Refs: #25969 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #33204 Refs: #25969 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.