Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code failing with Julia dev #1167

Closed
gitboy16 opened this issue Apr 12, 2024 · 9 comments
Closed

Code failing with Julia dev #1167

gitboy16 opened this issue Apr 12, 2024 · 9 comments

Comments

@gitboy16
Copy link

The below code is failing with Julia dev version. I am using HTTP.jl v1.10.5.
Note that I hidded some part in the http message response.
It seems to be related to the introduction of "Memory" in yhe development version of Julia.

julia> HTTP.get(
                   string(URL),
                   [
                     "X-ClientName" => id[1],
                     "X-ID" => id[2],
                     "X-ClientCountry" => id[3],
                   ]
               )
ERROR: HTTP.RequestError:
HTTP.Request:
HTTP.Messages.Request:
"""
GET ########################################################################################## HTTP/1.1
X-ClientName: #######
X-ID: #####
X-ClientCountry: ##
Host: #########################
Accept: */*
User-Agent: HTTP.jl/1.12.0-DEV.339
Content-Length: 0
Accept-Encoding: gzip
Proxy-Authorization: ******

"""Underlying error:
BoundsError: attempt to access 0-element Memory{UInt8} at index [582:3501]
Stacktrace:
  [1] (::HTTP.ConnectionRequest.var"#connections#4"{})(req::HTTP.Messages.Request; proxy::String, socket_type::Type, socket_type_tls::Type, readtimeout::Int64, connect_timeout::Int64, logerrors::Bool, logtag::Nothing, kw::@Kwargs{})
    @ HTTP.ConnectionRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\ConnectionRequest.jl:140
  [2] (::Base.var"#106#108"{Base.var"#106#107#109"{}})(args::HTTP.Messages.Request; kwargs::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::Int64})
    @ Base .\error.jl:298
  [3] (::HTTP.RetryRequest.var"#manageretries#3"{})(req::HTTP.Messages.Request; retry::Bool, retries::Int64, retry_delays::ExponentialBackOff, retry_check::Function, retry_non_idempotent::Bool, kw::@Kwargs{})
    @ HTTP.RetryRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RetryRequest.jl:75
  [4] manageretries
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RetryRequest.jl:30 [inlined]
  [5] (::HTTP.CookieRequest.var"#managecookies#4"{})(req::HTTP.Messages.Request; cookies::Bool, cookiejar::HTTP.Cookies.CookieJar, kw::@Kwargs{})
    @ HTTP.CookieRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\CookieRequest.jl:42
  [6] managecookies
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\CookieRequest.jl:19 [inlined]
  [7] (::HTTP.HeadersRequest.var"#defaultheaders#2"{})(req::HTTP.Messages.Request; iofunction::Nothing, decompress::Nothing, basicauth::Bool, detect_content_type::Bool, canonicalize_headers::Bool, kw::@Kwargs{})
    @ HTTP.HeadersRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\HeadersRequest.jl:71
  [8] defaultheaders
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\HeadersRequest.jl:14 [inlined]
  [9] (::HTTP.RedirectRequest.var"#redirects#3"{})(req::HTTP.Messages.Request; redirect::Bool, redirect_limit::Int64, redirect_method::Nothing, forwardheaders::Bool, response_stream::Nothing, kw::@Kwargs{})
    @ HTTP.RedirectRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RedirectRequest.jl:25
 [10] redirects
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RedirectRequest.jl:14 [inlined]
 [11] (::HTTP.MessageRequest.var"#makerequest#3"{})(method::String, url::URIs.URI, headers::Vector{…}, body::Vector{…}; copyheaders::Bool, response_stream::Nothing, http_version::HTTP.Strings.HTTPVersion, verbose::Int64, kw::@Kwargs{})
    @ HTTP.MessageRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\MessageRequest.jl:35
 [12] makerequest
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\MessageRequest.jl:24 [inlined]
 [13] request(stack::HTTP.MessageRequest.var"#makerequest#3"{}, method::String, url::String, h::Vector{…}, b::Vector{…}, q::Nothing; headers::Vector{…}, body::Vector{…}, query::Nothing, kw::@Kwargs{})
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:457
 [14] request(stack::Function, method::String, url::String, h::Vector{Pair{String, String}}, b::Vector{UInt8}, q::Nothing)
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:455
 [15] #request#20
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:315 [inlined]
 [16] request
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:313 [inlined]
 [17] request(method::String, url::String, h::Vector{Pair{String, String}})
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:313
 [18] get(::String, ::Vararg{Any}; kw::@Kwargs{})
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:518
 [19] top-level scope
    @ REPL[19]:1

caused by: TaskFailedException

    nested task error: BoundsError: attempt to access 0-element Memory{UInt8} at index [582:3501]
    Stacktrace:
      [1] throw_boundserror(A::Memory{UInt8}, I::Tuple{UnitRange{Int64}})
        @ Base .\essentials.jl:14
      [2] checkbounds
        @ .\abstractarray.jl:699 [inlined]
      [3] view
        @ .\genericmemory.jl:309 [inlined]
      [4] readuntil
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\IOExtras.jl:118 [inlined]
      [5] readuntil(c::HTTP.Connections.Connection{…}, f::typeof(HTTP.Parsers.find_end_of_chunk_size), sizehint::Int64)
        @ HTTP.Connections C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Connections.jl:242
      [6] readuntil
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Connections.jl:238 [inlined]
      [7] readchunksize(io::HTTP.Connections.Connection{Sockets.TCPSocket}, message::HTTP.Messages.Response)
        @ HTTP.Messages C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Messages.jl:558
      [8] ntoread
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:202 [inlined]
      [9] readavailable(http::HTTP.Streams.Stream{HTTP.Messages.Response, HTTP.Connections.Connection{…}}, n::Int64)
        @ HTTP.Streams C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:225
     [10] readavailable
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:225 [inlined]
     [11] macro expansion
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:372 [inlined]
     [12] macro expansion
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Exceptions.jl:19 [inlined]
     [13] closeread(http::HTTP.Streams.Stream{HTTP.Messages.Response, HTTP.Connections.Connection{Sockets.TCPSocket}})
        @ HTTP.Streams C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:371
     [14] macro expansion
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\StreamRequest.jl:61 [inlined]
     [15] (::HTTP.StreamRequest.var"#3#5"{})()
        @ HTTP.StreamRequest C:\home\usr\JULIA_DEPOT\packages\ConcurrentUtilities\J6iMP\src\ConcurrentUtilities.jl:9

    caused by: BoundsError: attempt to access 0-element Memory{UInt8} at index [582:3501]
    Stacktrace:
      [1] throw_boundserror(A::Memory{UInt8}, I::Tuple{UnitRange{Int64}})
        @ Base .\essentials.jl:14
      [2] checkbounds
        @ .\abstractarray.jl:699 [inlined]
      [3] view
        @ .\genericmemory.jl:309 [inlined]
      [4] readuntil
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\IOExtras.jl:118 [inlined]
      [5] readuntil(c::HTTP.Connections.Connection{…}, f::typeof(HTTP.Parsers.find_end_of_chunk_size), sizehint::Int64)
        @ HTTP.Connections C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Connections.jl:242
      [6] readuntil
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Connections.jl:238 [inlined]
      [7] readchunksize(io::HTTP.Connections.Connection{Sockets.TCPSocket}, message::HTTP.Messages.Response)
        @ HTTP.Messages C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Messages.jl:558
      [8] ntoread
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:202 [inlined]
      [9] readall!(http::HTTP.Streams.Stream{HTTP.Messages.Response, HTTP.Connections.Connection{…}}, buf::IOBuffer)
        @ HTTP.Streams C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:303
     [10] read (repeats 2 times)
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\Streams.jl:297 [inlined]
     [11] readbody!(stream::HTTP.Streams.Stream{…}, res::HTTP.Messages.Response, buf_or_stream::HTTP.Streams.Stream{…}, lock::ReentrantLock)
        @ HTTP.StreamRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\StreamRequest.jl:169
     [12] readbody(stream::HTTP.Streams.Stream{…}, res::HTTP.Messages.Response, decompress::Nothing, lock::ReentrantLock)
        @ HTTP.StreamRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\StreamRequest.jl:142
     [13] macro expansion
        @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\StreamRequest.jl:54 [inlined]
     [14] (::HTTP.StreamRequest.var"#3#5"{})()
        @ HTTP.StreamRequest C:\home\usr\JULIA_DEPOT\packages\ConcurrentUtilities\J6iMP\src\ConcurrentUtilities.jl:9
Stacktrace:
  [1] sync_end(c::Channel{Any})
    @ Base .\task.jl:600
  [2] macro expansion
    @ .\task.jl:633 [inlined]
  [3] streamlayer(stream::HTTP.Streams.Stream{…}; iofunction::Nothing, decompress::Nothing, logerrors::Bool, logtag::Nothing, timedout::Nothing, kw::@Kwargs{})
    @ HTTP.StreamRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\StreamRequest.jl:35
  [4] streamlayer
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\StreamRequest.jl:21 [inlined]
  [5] (::HTTP.ExceptionRequest.var"#exceptions#2"{})(stream::HTTP.Streams.Stream{…}; status_exception::Bool, timedout::Nothing, logerrors::Bool, logtag::Nothing, kw::@Kwargs{})
    @ HTTP.ExceptionRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\ExceptionRequest.jl:14
  [6] exceptions
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\ExceptionRequest.jl:13 [inlined]
  [7] (::HTTP.TimeoutRequest.var"#timeouts#3"{})(stream::HTTP.Streams.Stream{…}; readtimeout::Int64, logerrors::Bool, logtag::Nothing, kw::@Kwargs{})
    @ HTTP.TimeoutRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\TimeoutRequest.jl:18
  [8] (::HTTP.ConnectionRequest.var"#connections#4"{})(req::HTTP.Messages.Request; proxy::String, socket_type::Type, socket_type_tls::Type, readtimeout::Int64, connect_timeout::Int64, logerrors::Bool, logtag::Nothing, kw::@Kwargs{})
    @ HTTP.ConnectionRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\ConnectionRequest.jl:119
  [9] (::Base.var"#106#108"{Base.var"#106#107#109"{}})(args::HTTP.Messages.Request; kwargs::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::Int64})
    @ Base .\error.jl:298
 [10] (::HTTP.RetryRequest.var"#manageretries#3"{})(req::HTTP.Messages.Request; retry::Bool, retries::Int64, retry_delays::ExponentialBackOff, retry_check::Function, retry_non_idempotent::Bool, kw::@Kwargs{})
    @ HTTP.RetryRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RetryRequest.jl:75
 [11] manageretries
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RetryRequest.jl:30 [inlined]
 [12] (::HTTP.CookieRequest.var"#managecookies#4"{})(req::HTTP.Messages.Request; cookies::Bool, cookiejar::HTTP.Cookies.CookieJar, kw::@Kwargs{})
    @ HTTP.CookieRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\CookieRequest.jl:42
 [13] managecookies
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\CookieRequest.jl:19 [inlined]
 [14] (::HTTP.HeadersRequest.var"#defaultheaders#2"{})(req::HTTP.Messages.Request; iofunction::Nothing, decompress::Nothing, basicauth::Bool, detect_content_type::Bool, canonicalize_headers::Bool, kw::@Kwargs{})
    @ HTTP.HeadersRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\HeadersRequest.jl:71
 [15] defaultheaders
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\HeadersRequest.jl:14 [inlined]
 [16] (::HTTP.RedirectRequest.var"#redirects#3"{})(req::HTTP.Messages.Request; redirect::Bool, redirect_limit::Int64, redirect_method::Nothing, forwardheaders::Bool, response_stream::Nothing, kw::@Kwargs{})
    @ HTTP.RedirectRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RedirectRequest.jl:25
 [17] redirects
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\RedirectRequest.jl:14 [inlined]
 [18] (::HTTP.MessageRequest.var"#makerequest#3"{})(method::String, url::URIs.URI, headers::Vector{…}, body::Vector{…}; copyheaders::Bool, response_stream::Nothing, http_version::HTTP.Strings.HTTPVersion, verbose::Int64, kw::@Kwargs{})
    @ HTTP.MessageRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\MessageRequest.jl:35
 [19] makerequest
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\clientlayers\MessageRequest.jl:24 [inlined]
 [20] request(stack::HTTP.MessageRequest.var"#makerequest#3"{}, method::String, url::String, h::Vector{…}, b::Vector{…}, q::Nothing; headers::Vector{…}, body::Vector{…}, query::Nothing, kw::@Kwargs{})
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:457
 [21] request(stack::Function, method::String, url::String, h::Vector{Pair{String, String}}, b::Vector{UInt8}, q::Nothing)
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:455
 [22] #request#20
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:315 [inlined]
 [23] request
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:313 [inlined]
 [24] request(method::String, url::String, h::Vector{Pair{String, String}})
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:313
 [25] get(::String, ::Vararg{Any}; kw::@Kwargs{})
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\vnQzp\src\HTTP.jl:518
 [26] top-level scope
    @ REPL[19]:1
Some type information was truncated. Use `show(err)` to see complete types.
@marcelo-g-simas
Copy link

marcelo-g-simas commented Apr 12, 2024

I am seeing a similar issue when processing the body of a POST request, see issue above on the Oxygen.jl repo for details.

@mttlmr
Copy link

mttlmr commented Apr 16, 2024

Same thing is happening on Julia 1.11.0-beta1:

ERROR: HTTP.RequestError:
HTTP.Request:
HTTP.Messages.Request:
"""
GET /uaa/oauth/token?grant_type=client_credentials HTTP/1.1
Authorization: ******
Content-Type: application/x-www-form-urlencoded
Host: ###############
Accept: */*
User-Agent: HTTP.jl/1.11.0-beta1
Content-Length: 0
Accept-Encoding: gzip

"""Underlying error:
BoundsError: attempt to access 0-element Memory{UInt8} at index [1164:3216]
Stacktrace:
 [1] NavAPI.Client(creds::Dict{String, String}; environment::Symbol)
   @ NavAPI ~/code/NavAPI.jl/src/NavAPI.jl:110
 [2] Client
   @ ~/code/NavAPI.jl/src/NavAPI.jl:78 [inlined]
 [3] init_client(creds::Dict{String, String})
   @ NavAPI ~/code/NavAPI.jl/src/NavAPI.jl:173
 [4] top-level scope
   @ REPL[10]:1

caused by: HTTP.RequestError:
HTTP.Request:
HTTP.Messages.Request:
"""
GET /uaa/oauth/token?grant_type=client_credentials HTTP/1.1
Authorization: ******
Content-Type: application/x-www-form-urlencoded
Host: #############
Accept: */*
User-Agent: HTTP.jl/1.11.0-beta1
Content-Length: 0
Accept-Encoding: gzip

"""Underlying error:
BoundsError: attempt to access 0-element Memory{UInt8} at index [1164:3216]
Stacktrace:
  [1] (::HTTP.ConnectionRequest.var"#connections#4"{})(req::HTTP.Messages.Request; proxy::Nothing, socket_type::Type, socket_type_tls::Type, readtimeout::Int64, connect_timeout::Int64, logerrors::Bool, logtag::Nothing, kw::@Kwargs{})
    @ HTTP.ConnectionRequest ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/ConnectionRequest.jl:140
  [2] (::Base.var"#104#106"{Base.var"#104#105#107"{}})(args::HTTP.Messages.Request; kwargs::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::Int64})
    @ Base ./error.jl:298
  [3] (::HTTP.RetryRequest.var"#manageretries#3"{})(req::HTTP.Messages.Request; retry::Bool, retries::Int64, retry_delays::ExponentialBackOff, retry_check::Function, retry_non_idempotent::Bool, kw::@Kwargs{})
    @ HTTP.RetryRequest ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/RetryRequest.jl:75
  [4] manageretries
    @ ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/RetryRequest.jl:30 [inlined]
  [5] (::HTTP.CookieRequest.var"#managecookies#4"{HTTP.CookieRequest.var"#managecookies#1#5"{}})(req::HTTP.Messages.Request; cookies::Bool, cookiejar::HTTP.Cookies.CookieJar, kw::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::I
nt64})
    @ HTTP.CookieRequest ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/CookieRequest.jl:42
  [6] managecookies
    @ ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/CookieRequest.jl:19 [inlined]
  [7] (::HTTP.HeadersRequest.var"#defaultheaders#2"{})(req::HTTP.Messages.Request; iofunction::Nothing, decompress::Nothing, basicauth::Bool, detect_content_type::Bool, canonicalize_headers::Bool, kw::@Kwargs{})
    @ HTTP.HeadersRequest ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/HeadersRequest.jl:71
  [8] defaultheaders
    @ ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/HeadersRequest.jl:14 [inlined]
  [9] (::HTTP.RedirectRequest.var"#redirects#3"{})(req::HTTP.Messages.Request; redirect::Bool, redirect_limit::Int64, redirect_method::Nothing, forwardheaders::Bool, response_stream::Nothing, kw::@Kwargs{})
    @ HTTP.RedirectRequest ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/RedirectRequest.jl:25
 [10] redirects
    @ ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/RedirectRequest.jl:14 [inlined]
 [11] (::HTTP.MessageRequest.var"#makerequest#3"{})(method::String, url::URIs.URI, headers::Vector{…}, body::Vector{…}; copyheaders::Bool, response_stream::Nothing, http_version::HTTP.Strings.HTTPVersion, verbose::Int64, kw::@Kwargs{})
    @ HTTP.MessageRequest ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/MessageRequest.jl:35
 [12] makerequest
    @ ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/clientlayers/MessageRequest.jl:24 [inlined]
 [13] request(stack::HTTP.MessageRequest.var"#makerequest#3"{}, method::String, url::String, h::Vector{…}, b::Vector{…}, q::Nothing; headers::Vector{…}, body::Vector{…}, query::Nothing, kw::@Kwargs{})
    @ HTTP ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/HTTP.jl:457
 [14] request(stack::Function, method::String, url::String, h::Vector{Pair{String, String}}, b::Vector{UInt8}, q::Nothing)
    @ HTTP ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/HTTP.jl:455
 [15] #request#20
    @ ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/HTTP.jl:315 [inlined]
 [16] request (repeats 2 times)
    @ ~/.local/share/julia-1.11.0-beta1/.julia/packages/HTTP/vnQzp/src/HTTP.jl:313 [inlined]
 [17] NavAPI.Client(creds::Dict{String, String}; environment::Symbol)
    @ NavAPI ~/code/NavAPI.jl/src/NavAPI.jl:96
 [18] Client
    @ ~/code/NavAPI.jl/src/NavAPI.jl:78 [inlined]
 [19] init_client(creds::Dict{String, String})
    @ NavAPI ~/code/NavAPI.jl/src/NavAPI.jl:173
 [20] top-level scope
    @ REPL[10]:1

[...]

@hhaensel
Copy link

I see the same error when I place a server test in the precompilation step in Stipple (slightly shortened)

  @compile_workload begin
      ui() = [cell("hello"), row("world"), htmldiv("Hello World")]

      @app PrecompileApp begin
        @in demo_i = 1
      end

      route("/") do 
        model = Stipple.ReactiveTools.@init PrecompileApp
        page(model, ui) |> html
      end

      port = rand(8081:8999)
      up(port)

      HTTP.get("http://localhost:$port")

      down()
  end

If I execute the the same code at the REPL, all is fine.
No error on Julia 1.10, above failure on Julia 1.11.beta-1

@cmcaine
Copy link
Contributor

cmcaine commented Apr 21, 2024

We've been seeing the same error in the weekly Mux CI runs. Example here: https://github.com/JuliaWeb/Mux.jl/actions/runs/8769196489/job/24064434203#step:5:136

@mttlmr
Copy link

mttlmr commented Apr 22, 2024

I rerun my test (this one) with the new package version (old: HTTP v1.10.5 - new: HTTP v1.10.6) and it worked. There was no error, no interruption, the query was successfull.

@gitboy16
Copy link
Author

gitboy16 commented Apr 23, 2024

With HTTP v1.10.6 it is actually worst because now both Julia dev and 1.10.2 are failing. Here is the error:

MethodError: no method matching sslupgrade(::Nothing, ::HTTP.Connections.Connection{Sockets.TCPSocket}, ::SubString{String}; readtimeout::Int64, iofunction::Nothing, decompress::Nothing, verbose::Int64, require_ssl_verification::Bool, status_exception::Bool)

Closest candidates are:
  sslupgrade(::Type{IOType}, ::HTTP.Connections.Connection{T}, ::AbstractString; pool, require_ssl_verification, keepalive, readtimeout, kw...) where {T, IOType}
   @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\Connections.jl:613

Stacktrace:
  [1] (::HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}})(req::HTTP.Messages.Request; proxy::String, socket_type::Type, socket_type_tls::Nothing, readtimeout::Int64, connect_timeout::Int64, logerrors::Bool, logtag::Nothing, kw::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ HTTP.ConnectionRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\ConnectionRequest.jl:140
  [2] connections
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\ConnectionRequest.jl:58 [inlined]
  [3] (::Base.var"#96#98"{Base.var"#96#97#99"{ExponentialBackOff, HTTP.RetryRequest.var"#2#5"{Int64, typeof(HTTP.RetryRequest.FALSE), HTTP.Messages.Request, Base.RefValue{Int64}}, HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}})(args::HTTP.Messages.Request; kwargs::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ Base .\error.jl:296
  [4] (::HTTP.RetryRequest.var"#manageretries#3"{HTTP.RetryRequest.var"#manageretries#1#4"{HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}})(req::HTTP.Messages.Request; retry::Bool, retries::Int64, retry_delays::ExponentialBackOff, retry_check::Function, retry_non_idempotent::Bool, kw::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ HTTP.RetryRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\RetryRequest.jl:75
  [5] manageretries
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\RetryRequest.jl:30 [inlined]
  [6] (::HTTP.CookieRequest.var"#managecookies#4"{HTTP.CookieRequest.var"#managecookies#1#5"{HTTP.RetryRequest.var"#manageretries#3"{HTTP.RetryRequest.var"#manageretries#1#4"{HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}})(req::HTTP.Messages.Request; cookies::Bool, cookiejar::HTTP.Cookies.CookieJar, kw::@Kwargs{iofunction::Nothing, decompress::Nothing, verbose::Int64, retries::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ HTTP.CookieRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\CookieRequest.jl:42
  [7] managecookies
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\CookieRequest.jl:19 [inlined]
  [8] (::HTTP.HeadersRequest.var"#defaultheaders#2"{HTTP.HeadersRequest.var"#defaultheaders#1#3"{HTTP.CookieRequest.var"#managecookies#4"{HTTP.CookieRequest.var"#managecookies#1#5"{HTTP.RetryRequest.var"#manageretries#3"{HTTP.RetryRequest.var"#manageretries#1#4"{HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}})(req::HTTP.Messages.Request; iofunction::Nothing, decompress::Nothing, basicauth::Bool, detect_content_type::Bool, canonicalize_headers::Bool, kw::@Kwargs{verbose::Int64, retries::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ HTTP.HeadersRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\HeadersRequest.jl:71
  [9] defaultheaders
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\HeadersRequest.jl:14 [inlined]
 [10] (::HTTP.RedirectRequest.var"#redirects#3"{HTTP.RedirectRequest.var"#redirects#1#4"{HTTP.HeadersRequest.var"#defaultheaders#2"{HTTP.HeadersRequest.var"#defaultheaders#1#3"{HTTP.CookieRequest.var"#managecookies#4"{HTTP.CookieRequest.var"#managecookies#1#5"{HTTP.RetryRequest.var"#manageretries#3"{HTTP.RetryRequest.var"#manageretries#1#4"{HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}})(req::HTTP.Messages.Request; redirect::Bool, redirect_limit::Int64, redirect_method::Nothing, forwardheaders::Bool, response_stream::Nothing, kw::@Kwargs{verbose::Int64, retries::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ HTTP.RedirectRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\RedirectRequest.jl:25
 [11] redirects
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\RedirectRequest.jl:14 [inlined]
 [12] (::HTTP.MessageRequest.var"#makerequest#3"{HTTP.MessageRequest.var"#makerequest#1#4"{HTTP.RedirectRequest.var"#redirects#3"{HTTP.RedirectRequest.var"#redirects#1#4"{HTTP.HeadersRequest.var"#defaultheaders#2"{HTTP.HeadersRequest.var"#defaultheaders#1#3"{HTTP.CookieRequest.var"#managecookies#4"{HTTP.CookieRequest.var"#managecookies#1#5"{HTTP.RetryRequest.var"#manageretries#3"{HTTP.RetryRequest.var"#manageretries#1#4"{HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}})(method::String, url::URIs.URI, headers::Vector{Pair{String, String}}, body::String; copyheaders::Bool, response_stream::Nothing, http_version::HTTP.Strings.HTTPVersion, verbose::Int64, kw::@Kwargs{retries::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ HTTP.MessageRequest C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\MessageRequest.jl:35
 [13] makerequest
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\clientlayers\MessageRequest.jl:24 [inlined]
 [14] request(stack::HTTP.MessageRequest.var"#makerequest#3"{HTTP.MessageRequest.var"#makerequest#1#4"{HTTP.RedirectRequest.var"#redirects#3"{HTTP.RedirectRequest.var"#redirects#1#4"{HTTP.HeadersRequest.var"#defaultheaders#2"{HTTP.HeadersRequest.var"#defaultheaders#1#3"{HTTP.CookieRequest.var"#managecookies#4"{HTTP.CookieRequest.var"#managecookies#1#5"{HTTP.RetryRequest.var"#manageretries#3"{HTTP.RetryRequest.var"#manageretries#1#4"{HTTP.ConnectionRequest.var"#connections#4"{HTTP.ConnectionRequest.var"#connections#1#5"{HTTP.TimeoutRequest.var"#timeouts#3"{HTTP.TimeoutRequest.var"#timeouts#1#4"{HTTP.ExceptionRequest.var"#exceptions#2"{HTTP.ExceptionRequest.var"#exceptions#1#3"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}, method::String, url::String, h::Vector{Pair{String, String}}, b::String, q::Nothing; headers::Vector{Pair{String, String}}, body::String, query::Nothing, kw::@Kwargs{retries::Int64, verbose::Int64, require_ssl_verification::Bool, status_exception::Bool})
    @ HTTP C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\HTTP.jl:457
 [15] #request#20
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\HTTP.jl:315 [inlined]
 [16] request
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\HTTP.jl:313 [inlined]
 [17] post
    @ C:\home\usr\JULIA_DEPOT\packages\HTTP\PnoHb\src\HTTP.jl:532 [inlined]

@gitboy16
Copy link
Author

The above seems to be the same issue as #1172

@svilupp
Copy link

svilupp commented Jun 14, 2024

I can confirm the same issue with HTTP 1.10.8 with Julia 1.11 beta2 for any GET calls.

@quinnj
Copy link
Member

quinnj commented Jul 7, 2024

This should be fixed now

@quinnj quinnj closed this as completed Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants