Skip to content

Segfault on Sockets._sockname #29087

@quinnj

Description

@quinnj
Member

Backtrace from HTTP.jl travis run:

running async 1, 1:100, Pair{Symbol,Int64}[:verbose=>0], http C
[ Info: Accept (1):  πŸ”—    0↑     0↓    0s 127.0.0.1:8081:8081 ≣16
(HTTP.Sockets).getsockname(http) = (ip"127.0.0.1", 0x1f91)[ Info: Closed (1):  πŸ’€    0↑     0β†“πŸ”’   0s 127.0.0.1:8081:8081 ≣16
signal (11): Segmentation fault: 11
in expression starting at /Users/travis/build/JuliaWeb/HTTP.jl/test/async.jl:189
uv_tcp_getsockname at /Users/osx/buildbot/slave/package_osx64/build/deps/srccache/libuv-ed3700c849289ed01fe04273a7bf865340b2bd7e/src/unix/tcp.c:222
jl_tcp_getsockname at /Users/osx/buildbot/slave/package_osx64/build/src/jl_uv.c:647
_sockname at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Sockets/src/Sockets.jl:601 [inlined]
getsockname at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Sockets/src/Sockets.jl:584 [inlined]
getsockname at /Users/travis/build/JuliaWeb/HTTP.jl/src/Streams.jl:59 [inlined]
macro expansion at ./show.jl:555 [inlined]
#109 at /Users/travis/build/JuliaWeb/HTTP.jl/test/async.jl:17
handle_stream at /Users/travis/build/JuliaWeb/HTTP.jl/src/Servers.jl:481
#54 at ./task.jl:259
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1558 [inlined]
start_task at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:271
Allocations: 88437210 (Pool: 88416323; Big: 20887); GC: 198
ERROR: Package HTTP errored during testing
Stacktrace:
 [1] pkgerror(::String, ::Vararg{String,N} where N) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:120
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] #test#61(::Bool, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1284
 [4] #test at ./none:0 [inlined]
 [5] #test#42(::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:267
 [6] #test at ./none:0 [inlined]
 [7] #test#41 at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:250 [inlined]
 [8] #test at ./none:0 [inlined]
 [9] #test#38(::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:coverage,),Tuple{Bool}}}, ::Function) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:247
 [10] (::getfield(Pkg.API, Symbol("#kw##test")))(::NamedTuple{(:coverage,),Tuple{Bool}}, ::typeof(Pkg.API.test)) at ./none:0
 [11] top-level scope at none:1

I'm wondering if we need some kind of assertion around

r = ccall(:jl_tcp_getsockname, Int32,
. The docs say it's only valid for connected sockets, so I imagine the HTTP.jl tests got into a situation where that happened to be the case (saw this error on 1/4 builds for a single PR).

Activity

added
ioInvolving the I/O subsystem: libuv, read, write, etc.
on Sep 10, 2018
NHDaly

NHDaly commented on Dec 7, 2021

@NHDaly
SponsorMember

Looks like this is missing a call to check_open(sock), like we do here:

check_open(sock)

added
bugIndicates an unexpected problem or unintended behavior
good first issueIndicates a good issue for first-time contributors to Julia
on Dec 7, 2021
NHDaly

NHDaly commented on Dec 8, 2021

@NHDaly
SponsorMember

Fixed by #41000 (duplicate of #40993). :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorgood first issueIndicates a good issue for first-time contributors to JuliaioInvolving the I/O subsystem: libuv, read, write, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @JeffBezanson@NHDaly@quinnj

        Issue actions

          Segfault on Sockets._sockname Β· Issue #29087 Β· JuliaLang/julia