Skip to content

Commit 29a567c

Browse files
authored
Ensure we hold the IO lock when calling keepalive in libuv (#999)
Fixes a private report of a segfault stemming from our call to `uv_tcp_keepalive`, which is now enabled by default since the 1.7 release.
1 parent 772ce53 commit 29a567c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ConnectionPool.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,11 @@ releaseconnection(c::Connection{T}, reuse) where {T} =
387387
release(getpool(T), connectionkey(c), c; return_for_reuse=reuse)
388388

389389
function keepalive!(tcp)
390-
@debugv 2 "setting keepalive on tcp socket"
390+
Base.iolock_begin()
391391
err = ccall(:uv_tcp_keepalive, Cint, (Ptr{Nothing}, Cint, Cuint),
392392
tcp.handle, 1, 1)
393-
err != 0 && error("error setting keepalive on socket")
393+
Base.uv_error("failed to set keepalive on tcp socket", err)
394+
Base.iolock_end()
394395
return
395396
end
396397

0 commit comments

Comments
 (0)