How can I get a more information than `Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. - SSL_connect`

谁说我不能喝 提交于 2019-12-13 06:17:02

问题


I have some ruby test code that hits an API endpoint and sends it JSON.

RestClient.post(url, json, :content_type => :json, :accept => :json) { |response, request, result|
  @last_response = response
}

It works ittermittently sometimes giving this error.

Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. - SSL_connect

What can I get more information about what is going on?


回答1:


By setting RESTCLIENT_LOG=stdout environment variable you will see RestClient debug data in the terminal. Or you can replace stdout with a file path to write it out to a log file.

The reason may be an invalid SSL cert or just a flaky API endpoint that sometimes disconnects before returning a response.




回答2:


It can be challenging to troubleshoot this sort of network error. If it keeps up, you could try capturing the network traffic with Wireshark or tcpdump, which might give some insight into what's happening.

In general ECONNRESET usually means that the remote server closed the connection while you the client still had data queued for sending to it.



来源:https://stackoverflow.com/questions/39779457/how-can-i-get-a-more-information-than-errnoeconnreset-an-existing-connection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!