ostinelli / syn

A scalable global Process Registry and Process Group manager for Erlang and Elixir.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Turn off logging when process disconnects

Spyes opened this issue · comments

Hi,

First of all - great work! This library is solving a lot of issues for me, and with great ease! Thanks!
My only issue is that when a process disconnects, syn prints an error log (syn_groups.erl#L264) - I don't see in the code any way to turn that off, or maybe I'm missing something? For my project, it's very normal for a process to terminate in an "unhealthy" way, which means that my log is full of supposed "errors".
Would it be possible to allow turning this logger off? Thanks!

In Erlang anything besides normal is to be considered a process exit error. In Syn we consider killed as not generating errors too, because processes can get killed in case of conflict resolution. I am actually considering to change this to a syn-specific exit error instead.

If you are exiting a process with a reason other than normal, I recommend considering changes in your architecture: it is not really normal for a process to terminate with other reasons. This Syn behavior is strongly linked with Erlang philosophy and error management.

Okay, I will give the callback a try. Changing my architecture is a bit more tricky, because the connections are websockets and I have no way of controlling how they exit (they are on the client side, and could close for various reasons which would still be considered "healthy").
Are you suggesting monitoring those sockets/processes for exits, and then cleanly exiting syn via that monitor?

Are you suggesting monitoring those sockets/processes for exits, and then cleanly exiting syn via that monitor?

Syn already monitors them for you so I wouldn't do that. I'm recommending to avoid having processes die for other reasons than normal if they are, in fact, acceptable exit reasons. I don't understand what you mean with "exit reasons being on the client side", so I can't comment on that.

not sure that is possible for me, because like I said, I'm monitoring websockets and it's impossible for me to control how they are closed... but I'll try the callback approach. Thanks!

@ostinelli I'm trying to use the callback method, however I'm writing a Phoenix app in Elixir.. do you have any experience running Syn in Elixir? Where do I pass the config options? Tried under config/config.exs to no avail..

The callback won't change the issue you are having with abnormal exit signals of your processes. These will still generate logs.

Closing due to no activity.