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

Meaning and Handling of connection reset by peer Error #547

Closed
ueliwechsler opened this issue Jun 23, 2020 · 2 comments
Closed

Meaning and Handling of connection reset by peer Error #547

ueliwechsler opened this issue Jun 23, 2020 · 2 comments

Comments

@ueliwechsler
Copy link
Contributor

ueliwechsler commented Jun 23, 2020

I am using https://github.com/wookay/Bukdu.jl for creating a REST web server.

The application is running without problems but from time to time I get aBase.IOError("read: connection reset by peer (ECONNRESET)", -4077) error message which was generated at

@error exception=(e, stacktrace(catch_backtrace()))
(see full error log below).

I have posted already an issue https://github.com/wookay/Bukdu.jl/issues/105 in the Bukdu repo and also read this post on discourse https://discourse.julialang.org/t/econnreset-error-with-http-jl/11228 but I didn't understand the scope of the problem entirely since my understanding of web protocol is basic at best.

Even though the application runs, I do feel uneasy to use it in production just like this. Do you have any more resources on why this error happens (apart from the source code 😅). Do I need to refactor the webserver or is it safe to use with this message occurring?

The versions are:

Julia 1.4.2
HTTP v0.8.15
MbedTLS v1.0.2

and the full error message is

(Base.IOError("read: connection reset by peer (ECONNRESET)", -4077), 
Base.StackTraces.StackFrame[wait_readnb(::Sockets.TCPSocket, ::Int64) at stream.jl:350, eof at stream.jl:48 [inlined], 
read_to_buffer(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::Int64) at ConnectionPool.jl:253, 
readuntil(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::Function, ::Int64) at ConnectionPool.jl:273, readuntil at ConnectionPool.jl:271
 [inlined], readheaders(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Messages.Request) at Messages.jl:471, 
startread(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at Streams.jl:155, 
handle_transaction(::typeof(Bukdu.handle_stream_with_remote_ip), ::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}; final_transaction::Bool) at Servers.jl:343, 
(::HTTP.Servers.var"#handle_transaction##kw")(::NamedTuple{(:final_transaction,),Tuple{Bool}}, ::typeof(HTTP.Servers.handle_transaction), ::Function, ::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}) at Servers.jl:338, handle_connection(::Function, ::HTTP.ConnectionPool.Connection{Sockets.TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}, ::Int64, ::Int64) at Servers.jl:299, 
(::HTTP.Servers.var"#8#9"typeof(Bukdu.handle_stream_with_remote_ip),HTTP.Servers.Server{Nothing,Sockets.TCPServer},Base.RefValue{Int64},Int64,Int64,Bool,HTTP.ConnectionPool.Connection{Sockets.TCPSocket}})() at task.jl:358])
└ @ HTTP.Servers D:\Libraries\Julia\v1.x\packages\HTTP\BOJmV\src\Servers.jl:264
@gseastream
Copy link

I am also getting this happening. I'm running an internal package server using PkgServer.jl behind a corporate proxy, and almost every time a user makes a request to my container I get this connection reset error. I see in the following line:

if e isa Base.IOError && e.code == -54

It is attempting to capture this event and throw a warning instead, but my error code is -104, not -54, and the original issue above has a code of -4077. I guess this error can come with many different codes.

Are these codes really all the same error? And are they not actually errors, simply warnings of a benign connection reset? It'd be nice to resolve this, but I'm also curious if anyone knows why this happens. And maybe in the code above you can check for the existence of ECONNRESET or something.

Click to see full error message
┌ Error: (Base.IOError("read: connection reset by peer (ECONNRESET)", -104), Base.StackTraces.StackFrame[
wait_readnb(::TCPSocket, ::Int64) at stream.jl:350,
eof at stream.jl:48 [inlined],
read_to_buffer(::HTTP.ConnectionPool.Transaction{TCPSocket}, ::Int64) at ConnectionPool.jl:251,
readuntil(::HTTP.ConnectionPool.Transaction{TCPSocket}, ::Function, ::Int64) at ConnectionPool.jl:271,
readuntil at ConnectionPool.jl:269 [inlined],
readheaders at Messages.jl:471 [inlined],
startread(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at Streams.jl:155,
handle_transaction(::PkgServer.var"#72#75", ::HTTP.ConnectionPool.Transaction{TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}; final_transaction::Bool) at Servers.jl:343,
(::HTTP.Servers.var"#handle_transaction##kw")(::NamedTuple{(:final_transaction,),Tuple{Bool}}, ::typeof(HTTP.Servers.handle_transaction), ::Function, ::HTTP.ConnectionPool.Transaction{TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}) at Servers.jl:338,
handle_connection(::Function, ::HTTP.ConnectionPool.Connection{TCPSocket}, ::HTTP.Servers.Server{Nothing,Sockets.TCPServer}, ::Int64, ::Int64) at Servers.jl:299,
(::HTTP.Servers.var"#8#9"{PkgServer.var"#72#75",HTTP.Servers.Server{Nothing,Sockets.TCPServer},Base.RefValue{Int64},Int64,Int64,Bool,HTTP.ConnectionPool.Connection{TCPSocket}})() at task.jl:356])
└ @ HTTP.Servers ~/depot/packages/HTTP/IAI92/src/Servers.jl:264

ashleysommer added a commit to ashleysommer/HTTP.jl that referenced this issue Sep 21, 2021
Windows uses -4077
SPAC and ALPHA on linux use -54
Generic on linux uses -104
PARSIC on linux uses -232
MIPS on linux uses -131
I'm guessing MacOS uses -54 too, as this was one code that already worked for a large group of people.
Fixes JuliaWeb#763 JuliaWeb#547
quinnj pushed a commit that referenced this issue Sep 22, 2021
Windows uses -4077
SPAC and ALPHA on linux use -54
Generic on linux uses -104
PARSIC on linux uses -232
MIPS on linux uses -131
I'm guessing MacOS uses -54 too, as this was one code that already worked for a large group of people.
Fixes #763 #547
@fredrikekre
Copy link
Member

#764

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

3 participants