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
Use {shutdown, Error} when terminating connection processes #238
Conversation
Previously they exited `normal`, which helped avoid error log spam. However, that also meant any linked helper processes would not exit when the main connection process had been terminated. To automatically clean up any linked processes, and continue avoiding generating error logs, we can use `{shutdown, Error}` as the exit reason. That error, along with `shutdown` atom, are special exit reasons which are considered `normal` for proc_lib processes and will not generate error logs [1]. Another benefit is having more specific exit reasons (send error, recv error, etc.), which may help with debugging. [1] https://www.erlang.org/docs/24/man/proc_lib.html#description
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.
This looks like a good idea, it does impact backwards compatibility though since the behavior has changed.
@etrepum good point, it would introduce an incompatibility. I had tried to see what it would take to upgrade CouchDB apache/couchdb#4013. There were a few places, most just duplicated the I thought of perhaps gating it with a config option but options are not always propagated to all the places where exits happen so might lead to a larger refactoring. |
I added a note to the changes log file about the incompatibility to hopefully make it more visible to the users. |
I wonder if it would be a reason for a major version bump 3.0, or not large enough of a change? It could be a chance to drop some of the old Erlang VM compatibility, say <18, to avoid checking for rand module, maps, TLS SNI. |
Totally agree that a major version change is the way to go for this release, and it is the perfect opportunity to ditch <18 compat (which is almost 7 years old now)! |
Makes sense. I can give that a try later tonight (if you don't get to it first). It should be a decent cleanup! |
After mochi#238 acceptor processes would exit with {shutdown, Error} on timeouts and other errors which were `normal` before.
Previously they exited
normal
, which helped avoid error log spam. However, that also meant any linked helper processes would not exit when the main connection process had been terminated.To automatically clean up any linked processes, and continue avoiding generating error logs, we can use
{shutdown, Error}
as the exit reason. That error, along withshutdown
atom, are special exit reasons which are considerednormal
for proc_lib processes and will not generate error logs [1].Another benefit is having more specific exit reasons (send error, recv error, etc.), which may help with debugging.
[1] https://www.erlang.org/docs/24/man/proc_lib.html#description