0

I connected Node A (which contains a gen_server that monitors yaws processes) to a Node B which runs YAWS.

gen_server's handle_info does receive 'EXIT' and 'DOWN' messages from remote nodes but not particularly from yaws processes. However when I stop yaws the gen_server does receive a message containing something like "no connection"

Now the question is how do I receive 'DOWN' messages from yaws processes?

1 Answers1

1

There's nothing special about a Yaws process compared to other Erlang processes. It's likely that you're expecting a Yaws process that receives requests to die when it finishes dispatching or handling a request, but that's not how it works. Rather, by default Yaws keeps a pool of processes around to handle requests and it reuses them for multiple requests.

If you want to disable the process pool, set the Yaws config variable acceptor_pool_size to 0 in the global section of your Yaws configuration.

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46
  • 1
    So, There is no way to know when a yaws client disconnects? –  Aug 06 '16 at 09:15
  • In general it's hard to reliably know when a TCP client disconnects. See [this question](http://stackoverflow.com/q/22860969/409228) for example, or try your own web searches for that problem. If you're looking for reasonably reliable detection of client disconnection, you could employ an app-specific protocol that uses heartbeats to check for liveness, thereby forcing traffic across the connection and thus causing sockets to be regularly read/written. – Steve Vinoski Aug 06 '16 at 15:22