-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
'close' listener stop working with socket.removeAllListeners('end') #24577
Comments
This is most likely happening because we removed the event that we used internally in #18607. This issue should be fixed once you use |
So the Can we do something to prevent the internal |
I looked at https://github.com/joyent/node-ldapjs, whoever wrote it seemed to have some trouble getting consistent behaviour from socket events, and is using |
So … I’m not sure, but is there a specific reason you’re using |
I'm just innocent user of node-ldapjs who want to make our project work on Node 10.. @sam-github, Thanks for your detailed explanation. I'm not saying we should change the behavior of removeAllListeners... I'm just wandering if there is better way to help developers to avoid things like this. In Node 8, the Remember that People may do wrong things. They will be induced to call removeAllListeners |
Node has slowly been becoming harder to break, but removing listeners from events that are not yours, removing methods from objects, reassigning values to globals, etc., can cause a lot of damage. New methods, for example, sometimes use private symbols to try and hide them from API users, more values are const, more properties are read-only. Its possible there will be a drift towards node not using the documented object events internally, but that's a big change, and I wouldn't expect it to happen quickly. Wrt. to this specific issue, I don't believe it to be a bug, I think that Note that @lpinca knew that removing |
@sam-github Thanks for your response. I will try to get a fix from Using the documented objects internally sounds like a mix of user mode and kernel mode to me..So I 'm 100 % with the idea of not using them. (easy to say but hard to do) BTW, I changed the title to 'close' listener stop working with socket.removeAllListeners('end'). Hope it is a more accurate brief for people who happens to see this issue. |
yes, that's a descriptive title, thanks. |
Sounds like this can now be closed given that there's nothing from to be done from the Node core side. Do feel free to re-open this though if I misunderstood. |
Run below snippet on Node 10, the
close
listener will never be trigged.If we comment out the line
socket.removeAllListeners('end');
, The close listener is trigged as expected.But on Nodejs 8, close listener works with or without the
removeAllListeners
call.Output in Nodejs 10:
Output in Nodejs 8:
I believe this issue is the root cause of ldapjs/node-ldapjs#483
The text was updated successfully, but these errors were encountered: