Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catching ECONNRESET error codes #939

Closed
JakubPorubcansky opened this issue Oct 17, 2022 · 2 comments
Closed

Catching ECONNRESET error codes #939

JakubPorubcansky opened this issue Oct 17, 2022 · 2 comments

Comments

@JakubPorubcansky
Copy link

JakubPorubcansky commented Oct 17, 2022

I have an HTTP server written in Julia. Sometimes when sending a request it fails with: connection reset by peer (ECONNRESET).

It is similar to issues #547 and #763. Those were fixed in #764 by adding more error codes to check. However, when I look into the current Server.jl code I do not see checking of these codes anymore. I noticed there was some refactor (mainly 170725b) done in the code recently. Is it possible that the bug could reappear after the refactor? Or is now the error code checking handled somewhere else?

Full error
IOError: read: connection reset by peer (ECONNRESET)
Stacktrace:
  [1] try_with_timeout(f::HTTP.TimeoutRequest.var\"#3#8\"{Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{4, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception), Tuple{Nothing, Nothing, Int64, Bool}}}, HTTP.Streams.Stream{HTTP.Messages.Response, HTTP.ConnectionPool.Connection}, HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}, shouldtimeout::HTTP.TimeoutRequest.var\"#4#9\"{Int64, HTTP.ConnectionPool.Connection}, delay::Int64, iftimeout::HTTP.TimeoutRequest.var\"#5#10\"{HTTP.ConnectionPool.Connection})
    @ HTTP.Exceptions /home/timuser/.julia/packages/HTTP/PesRN/src/Exceptions.jl:56
  [2] #1#2
    @ /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/TimeoutRequest.jl:20 [inlined]
  [3] (::HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}})(req::HTTP.Messages.Request  proxy::Nothing, socket_type::Type, readtimeout::Int64, kw::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{4, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception), Tuple{Nothing, Nothing, Int64, Bool}}})
    @ HTTP.ConnectionRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/ConnectionRequest.jl:109
  [4] (::HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}})(req::HTTP.Messages.Request  canonicalize_headers::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{5, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception, :readtimeout), Tuple{Nothing, Nothing, Int64, Bool, Int64}}})
    @ HTTP.CanonicalizeRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/CanonicalizeRequest.jl:17
  [5] (::Base.var\"#76#78\"{Base.var\"#76#77#79\"{ExponentialBackOff, HTTP.RetryRequest.var\"#3#6\"{Int64, HTTP.Messages.Request, Base.RefValue{Int64}}, HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}})(args::HTTP.Messages.Request  kwargs::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{5, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception, :readtimeout), Tuple{Nothing, Nothing, Int64, Bool, Int64}}})
    @ Base ./error.jl:294
  [6] (::HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}})(req::HTTP.Messages.Request  retry::Bool, retries::Int64, retry_non_idempotent::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{5, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception, :readtimeout), Tuple{Nothing, Nothing, Int64, Bool, Int64}}})
    @ HTTP.RetryRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/RetryRequest.jl:60
  [7] (::HTTP.CookieRequest.var\"#1#5\"{HTTP.CookieRequest.var\"#1#2#6\"{HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}})(req::HTTP.Messages.Request  cookies::Bool, cookiejar::HTTP.Cookies.CookieJar, kw::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{5, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception, :readtimeout), Tuple{Nothing, Nothing, Int64, Bool, Int64}}})
    @ HTTP.CookieRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/CookieRequest.jl:42
  [8] (::HTTP.ContentTypeDetection.var\"#1#3\"{HTTP.ContentTypeDetection.var\"#1#2#4\"{HTTP.CookieRequest.var\"#1#5\"{HTTP.CookieRequest.var\"#1#2#6\"{HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}})(req::HTTP.Messages.Request  detect_content_type::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{5, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception, :readtimeout), Tuple{Nothing, Nothing, Int64, Bool, Int64}}})
    @ HTTP.ContentTypeDetection /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/ContentTypeRequest.jl:23
  [9] (::HTTP.BasicAuthRequest.var\"#1#3\"{HTTP.BasicAuthRequest.var\"#1#2#4\"{HTTP.ContentTypeDetection.var\"#1#3\"{HTTP.ContentTypeDetection.var\"#1#2#4\"{HTTP.CookieRequest.var\"#1#5\"{HTTP.CookieRequest.var\"#1#2#6\"{HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request  basicauth::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{5, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose, :status_exception, :readtimeout), Tuple{Nothing, Nothing, Int64, Bool, Int64}}})
    @ HTTP.BasicAuthRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/BasicAuthRequest.jl:22
 [10] (::HTTP.DefaultHeadersRequest.var\"#1#3\"{HTTP.DefaultHeadersRequest.var\"#1#2#4\"{HTTP.BasicAuthRequest.var\"#1#3\"{HTTP.BasicAuthRequest.var\"#1#2#4\"{HTTP.ContentTypeDetection.var\"#1#3\"{HTTP.ContentTypeDetection.var\"#1#2#4\"{HTTP.CookieRequest.var\"#1#5\"{HTTP.CookieRequest.var\"#1#2#6\"{HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request  iofunction::Nothing, decompress::Nothing, kw::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:verbose, :status_exception, :readtimeout), Tuple{Int64, Bool, Int64}}})
    @ HTTP.DefaultHeadersRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/DefaultHeadersRequest.jl:47
 [11] (::HTTP.RedirectRequest.var\"#1#4\"{HTTP.RedirectRequest.var\"#1#2#5\"{HTTP.DefaultHeadersRequest.var\"#1#3\"{HTTP.DefaultHeadersRequest.var\"#1#2#4\"{HTTP.BasicAuthRequest.var\"#1#3\"{HTTP.BasicAuthRequest.var\"#1#2#4\"{HTTP.ContentTypeDetection.var\"#1#3\"{HTTP.ContentTypeDetection.var\"#1#2#4\"{HTTP.CookieRequest.var\"#1#5\"{HTTP.CookieRequest.var\"#1#2#6\"{HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request  redirect::Bool, redirect_limit::Int64, redirect_method::Nothing, forwardheaders::Bool, response_stream::Nothing, kw::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:verbose, :status_exception, :readtimeout), Tuple{Int64, Bool, Int64}}})
    @ HTTP.RedirectRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/RedirectRequest.jl:25
 [12] #1#2
    @ /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/DebugRequest.jl:22 [inlined]
 [13] (::HTTP.MessageRequest.var\"#1#3\"{HTTP.MessageRequest.var\"#1#2#4\"{HTTP.DebugRequest.var\"#1#4\"{HTTP.DebugRequest.var\"#1#2#5\"{HTTP.RedirectRequest.var\"#1#4\"{HTTP.RedirectRequest.var\"#1#2#5\"{HTTP.DefaultHeadersRequest.var\"#1#3\"{HTTP.DefaultHeadersRequest.var\"#1#2#4\"{HTTP.BasicAuthRequest.var\"#1#3\"{HTTP.BasicAuthRequest.var\"#1#2#4\"{HTTP.ContentTypeDetection.var\"#1#3\"{HTTP.ContentTypeDetection.var\"#1#2#4\"{HTTP.CookieRequest.var\"#1#5\"{HTTP.CookieRequest.var\"#1#2#6\"{HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}}}}}})(method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::String  response_stream::Nothing, http_version::VersionNumber, kw::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:status_exception, :readtimeout), Tuple{Bool, Int64}}})
    @ HTTP.MessageRequest /home/timuser/.julia/packages/HTTP/PesRN/src/clientlayers/MessageRequest.jl:17
 [14] request(stack::HTTP.MessageRequest.var\"#1#3\"{HTTP.MessageRequest.var\"#1#2#4\"{HTTP.DebugRequest.var\"#1#4\"{HTTP.DebugRequest.var\"#1#2#5\"{HTTP.RedirectRequest.var\"#1#4\"{HTTP.RedirectRequest.var\"#1#2#5\"{HTTP.DefaultHeadersRequest.var\"#1#3\"{HTTP.DefaultHeadersRequest.var\"#1#2#4\"{HTTP.BasicAuthRequest.var\"#1#3\"{HTTP.BasicAuthRequest.var\"#1#2#4\"{HTTP.ContentTypeDetection.var\"#1#3\"{HTTP.ContentTypeDetection.var\"#1#2#4\"{HTTP.CookieRequest.var\"#1#5\"{HTTP.CookieRequest.var\"#1#2#6\"{HTTP.RetryRequest.var\"#1#4\"{HTTP.RetryRequest.var\"#1#2#5\"{HTTP.CanonicalizeRequest.var\"#1#3\"{HTTP.CanonicalizeRequest.var\"#1#2#4\"{HTTP.ConnectionRequest.var\"#1#7\"{HTTP.ConnectionRequest.var\"#1#2#8\"{HTTP.TimeoutRequest.var\"#1#6\"{HTTP.TimeoutRequest.var\"#1#2#7\"{HTTP.ExceptionRequest.var\"#1#3\"{HTTP.ExceptionRequest.var\"#1#2#4\"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}}}}}}, method::String, url::String, h::Vector{Pair{String, String}}, b::String, q::Nothing  headers::Vector{Pair{String, String}}, body::String, query::Nothing, kw::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:status_exception, :readtimeout), Tuple{Bool, Int64}}})
    @ HTTP /home/timuser/.julia/packages/HTTP/PesRN/src/HTTP.jl:413
 [15] #request#16
    @ /home/timuser/.julia/packages/HTTP/PesRN/src/HTTP.jl:273 [inlined]

Versions:

  • Julia 1.7.3
  • HTTP.jl 1.3.3
  • MbedTLS.jl 1.1.5
@quinnj
Copy link
Member

quinnj commented Oct 18, 2022

That code was only ever emitting a @warn log that the connection was reset; we now have a more consistent logging framework where those errors are always emitted as @error logs instead of sometimes being @warn and sometimes @error. Regardless, these never affected the actual functioning of the server itself.

Hopefully that helps?

@JakubPorubcansky
Copy link
Author

Oh yes, you are right, I did not check the code properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants