httpc_request(Url) ->
HttpOpts = [{timeout, 5000}],
Opts = [{sync, true}, {full_result, false}, {body_format, binary}],
httpc:request(get, {Url, []}, HttpOpts, Opts).
在gen_server进程p(pid = P)中,执行函数httpc_request(url),我发现某个进程可能在httpc中阻塞:handle_answer receive
process_info(P, current_function)
显示结果:
{current_function,{httpc,handle_answer,3}}
ets:match_object(httpc_manager__handler_db, {_='_', _='_', P})
显示结果:
[{Ref,HandlePid,P}]
process_info(HandlePid, [current_function, status])
显示结果:
[{current_function,{gen_server,loop,6}},{status,waiting}]
进程P是使用receive等待HandlePid回复,但是HandlePid在gen_server循环中等待接收tcp包,如何解决这个问题?