From be4ff305fa0a45527e78d26fe7c153e74bae5568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Drvo=C5=A1t=C4=9Bp?= Date: Thu, 12 Dec 2024 14:19:14 +0100 Subject: [PATCH] Do not migrate tasks to a different thread pool (backport of #1159) --- Project.toml | 4 ++-- src/clientlayers/StreamRequest.jl | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 8de06479..7079cbe8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "HTTP" uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" authors = ["Jacob Quinn", "contributors: https://github.com/JuliaWeb/HTTP.jl/graphs/contributors"] -version = "1.9.18" +version = "1.9.19" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -22,7 +22,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] CodecZlib = "0.7" -ConcurrentUtilities = "2.2" +ConcurrentUtilities = "2.4" ExceptionUnwrapping = "0.1" LoggingExtras = "0.4.9,1" MbedTLS = "0.6.8, 0.7, 1" diff --git a/src/clientlayers/StreamRequest.jl b/src/clientlayers/StreamRequest.jl index 27b33d7e..64168a59 100644 --- a/src/clientlayers/StreamRequest.jl +++ b/src/clientlayers/StreamRequest.jl @@ -3,6 +3,7 @@ module StreamRequest using ..IOExtras, ..Messages, ..Streams, ..Connections, ..Strings, ..RedirectRequest, ..Exceptions using LoggingExtras, CodecZlib, URIs using SimpleBufferStream: BufferStream +using ConcurrentUtilities: @samethreadpool_spawn export streamlayer @@ -36,7 +37,7 @@ function streamlayer(stream::Stream; iofunction=nothing, decompress::Union{Nothi # use a lock here for request.context changes (this is currently the only places # where multiple threads may modify/change context at the same time) lock = ReentrantLock() - Threads.@spawn try + @samethreadpool_spawn try writebody(stream, req, lock) finally Base.@lock lock begin @@ -46,7 +47,7 @@ function streamlayer(stream::Stream; iofunction=nothing, decompress::Union{Nothi closewrite(stream) end read_start = time() - Threads.@spawn try + @samethreadpool_spawn try @debugv 2 "client startread" startread(stream) if !isaborted(stream)