We have a Ruby on Rails application and this has a "search" functionality (search for some company). From browser user key-in some name and hit search and this search make an rest api call to outside system and get us some search results.
We are using "rest-client" (for Ruby on Rails).
I noticed this seems to work for few hours and suddenly my search seems to be broken all of a sudden and I can see in my log I get:
Errno::ECONNRESET: Connection reset by peer
We tried to investigate this issue by looking in to logs and we dont see any logs.
If we need to make this search work again we need to restart the passenger and then it works immediately. This is happening only in production environment. I tested in staging it seems to work well.
Questions:
Code:
def call
resp_data = RestClient.get(@request_url, @header)
rescue => error
puts 'Exception: ' error.message
end
This error is generated when the OS receives notification of TCP Reset (RST) from the remote peer. Connection reset by peer means the TCP stream was abnormally closed from the other end. A TCP RST was received and the connection is now closed.
This error is generated when the OS receives notification of TCP Reset (RST) from the remote peer. Connection reset by peer means the TCP stream was abnormally closed from the other end.
The peer will return the data packet you sent while sending the RST (reset) bit and forcefully terminate the connection. This issue usually happens if you are being blocked by the Firewall on any point in the route.
“Connection reset by peer” is the TCP/IP equivalent of slamming the phone back on the hook. It’s more polite than merely not replying, leaving one hanging. But it’s not the FIN-ACK expected of the truly polite TCP/IP. RST is used to abort connections.
Try to the following
resp_data = RestClient::Request.new(
method: :get,
url: @request_url, #=> https://api.example.com/auth2/endpoint
:headers => {
:Authorization => @header, #=> "Bearer access_token",
}
)
rescue => error
puts 'Exception: ' error.message
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With