[erlang-questions] Cowboy and links: weird delayed times

Roberto Ostinelli roberto@REDACTED
Fri May 15 11:11:32 CEST 2015

Dear list,
I am using cowboy to handle long lived http connections.

When a new connection is successful, I link a router process to it with
erlang:link/1, which traps exits, so that when I receive the
message {'EXIT', Pid, Reason} I can remove the connection reference from
the router process. Pretty standard stuff.

After Cowboy's terminate/3 callback is called, I immediately see the log
that the connection has been removed from the router process too.

However, in production I see that it can take almost 2 minutes from the
moment the terminate/3 function was called, and the router receiving the
{'EXIT', Pid, Reason}, which means that after exiting from the terminate/3
function the Cowboy process does not exit for almost 2 minutes:

2015-05-14 21:16:25.302 [debug] <0.1714.0>@myapp_device:terminate:180
Terminated robot request
2015-05-14 21:18:15.304 [info] <0.1717.0>@myapp_router:handle_info:157 Now

My question is: have you seen this before? Does this mean that the client
is badly formed and is refusing to shutdown gracefully? If so, is there a
way to close the socket abruptly instead?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150515/4d5b6bdb/attachment.htm>

More information about the erlang-questions mailing list