From 9529e308f8526ee0dc4ae69df6ab6fb3fee41012 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Tue, 20 Jul 2021 19:15:55 +1000 Subject: [PATCH] WIP: Disable pipelining to alleviate race conditions --- src/ConnectionPool.jl | 5 ++--- src/IODebug.jl | 2 +- src/StreamRequest.jl | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ConnectionPool.jl b/src/ConnectionPool.jl index 8a4b69613..a92c5e4e7 100644 --- a/src/ConnectionPool.jl +++ b/src/ConnectionPool.jl @@ -343,7 +343,6 @@ function IOExtras.closewrite(t::Transaction) @v1_3 unlock(t.c.writelock) end flush(t.c) - release(t.c) return end @@ -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 @@ -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 diff --git a/src/IODebug.jl b/src/IODebug.jl index 5fd9e2c16..3a9097414 100644 --- a/src/IODebug.jl +++ b/src/IODebug.jl @@ -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, []) diff --git a/src/StreamRequest.jl b/src/StreamRequest.jl index 5842b260c..fa265f199 100644 --- a/src/StreamRequest.jl +++ b/src/StreamRequest.jl @@ -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