Skip to content

Commit

Permalink
WIP: Disable pipelining to alleviate race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
c42f committed Jul 20, 2021
1 parent ed987aa commit 9529e30
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/ConnectionPool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ function IOExtras.closewrite(t::Transaction)
@v1_3 unlock(t.c.writelock)
end
flush(t.c)
release(t.c)

return
end
Expand Down Expand Up @@ -590,7 +589,7 @@ end
function isvalid(pod, conn, reuse_limit, pipeline_limit)
# Close connections that have reached the reuse limit...
if reuse_limit != nolimit
if readcount(conn) >= reuse_limit && !readbusy(conn)
if conn.sequence[] >= reuse_limit && !readbusy(conn)
@debug 2 "💀 overuse: $conn"
close(conn.io)
end
Expand All @@ -615,7 +614,7 @@ function isvalid(pod, conn, reuse_limit, pipeline_limit)
return false
end
# If we've hit our pipeline_limit, can't use this one, but don't close
if (writecount(conn) - readcount(conn)) >= pipeline_limit + 1
if (conn.sequence[] - readcount(conn)) >= pipeline_limit + 1
return false
end

Expand Down
2 changes: 1 addition & 1 deletion src/IODebug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else

struct IODebug{T <: IO} <: IO
io::T
log::Vector{Tuple{String,String}}
log::Vector{Tuple{String,Symbol,String}}
end

IODebug(io::T) where T <: IO = IODebug{T}(io, [])
Expand Down
1 change: 1 addition & 0 deletions src/StreamRequest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function request(::Type{StreamLayer{Next}}, io::IO, req::Request, body;

@sync begin
if iofunction === nothing
# Writes request asynchronously with the read.
@async try
writebody(http, req, body)
catch e
Expand Down

0 comments on commit 9529e30

Please sign in to comment.