[erlang-bugs] httpc:request_cancel oddities
Chris King
colanderman@REDACTED
Thu Sep 5 04:39:42 CEST 2013
Furthermore, there's a race condition in the cancel_request handler here:
case ets:lookup(HandlerDb, RequestId) of
[...snip...]
[{_, Pid, _}] ->
httpc_handler:cancel(RequestId, Pid, From),
{noreply,
State#state{cancel =
[{RequestId, Pid, From} | State#state.cancel]}}
After the ets:lookup, thread death & reuse races with
httpc_handler:cancel. The handler thread then dies when it receives a
cancel message for an unknown request. Easiest (and probably most
correct) solution is for the handler thread to ignore cancel messages for
unknown requests, rather than dying with function_clause as it currently
does.
More information about the erlang-bugs
mailing list