croservices / cro-http

HTTP (including HTTPS and HTTP/2) support for the Cro library for building distributed systems in Raku.
https://cro.services/
Artistic License 2.0
49 stars 26 forks source link

A method to reset connection #189

Open fingolfin0 opened 10 months ago

fingolfin0 commented 10 months ago

Description of problem

In my app I use a Cro::HTTP::Client to connect to remote server and make api requests via http 1.1 persistent connection. After 10-30 minutes of working, the client stops processing requests and throwing these exceptions: X::IO::Socket::Async::SSL::Verification or X::AdHoc with message Failed to resolve host name 'api.example.com' with family 0.. These errors are repeated over and over again if I try to make a request again. The requests only work again after restarting my script. In addition, the problem does not exist if I do not use persistent connections.

Proposed solution

I'm not sure if this is a Cro or a server issue (although it appears on two different servers); In any case, having the ability to close and restart the connection (something like $http-client.reset-connection would help. A new method ($http-client = Cro::HTTP::Client.new(...)) does not give the desired effect.

Note

I saved the full logs of my script with CRO_TRACE enabled. I did not analyze them because it is very difficult for me. But if it helps improve the Cro, I can find out the difference between normal responses and erroneous ones.