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

ssl_unsafe_read requires isreadable(::SSLContext) #188

Closed
omus opened this issue Nov 16, 2018 · 3 comments · Fixed by #257
Closed

ssl_unsafe_read requires isreadable(::SSLContext) #188

omus opened this issue Nov 16, 2018 · 3 comments · Fixed by #257

Comments

@omus
Copy link
Member

omus commented Nov 16, 2018

An issue encountered on Julia 0.6.4 on MbedTLS 0.5.14:

ArgumentError: `ssl_unsafe_read` requires `isreadable(::SSLContext)`
ssl_unsafe_read(::MbedTLS.SSLContext, ::Ptr{UInt8}, ::UInt64) at /root/.julia/v0.6/MbedTLS/src/ssl.jl:298
readavailable at /root/.julia/v0.6/MbedTLS/src/ssl.jl:434 [inlined]
purge(::HTTP.ConnectionPool.Connection{MbedTLS.SSLContext}) at /root/.julia/v0.6/HTTP/src/ConnectionPool.jl:335
close(::HTTP.ConnectionPool.Connection{MbedTLS.SSLContext}) at /root/.julia/v0.6/HTTP/src/ConnectionPool.jl:321
close(::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}) at /root/.julia/v0.6/HTTP/src/ConnectionPool.jl:308
#request#1(::Void, ::Type{T} where T, ::Array{Any,1}, ::Function, ::Type{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}) at /root/.julia/v0.6/HTTP/src/ConnectionRequest.jl:49
(::HTTP.#kw##request)(::Array{Any,1}, ::HTTP.#request, ::Type{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}) at ./<missing>:0
#request#1(::Array{Any,1}, ::Function, ::Type{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}, ::HTTP.URIs.URI, ::Vararg{Any,N} where N) at /root/.julia/v0.6/HTTP/src/ExceptionRequest.jl:19
(::HTTP.#kw##request)(::Array{Any,1}, ::HTTP.#request, ::Type{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}) at ./<missing>:0
#request#1(::VersionNumber, ::String, ::Void, ::Void, ::Array{Any,1}, ::Function, ::Type{HTTP.MessageRequest.MessageLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /root/.julia/v0.6/HTTP/src/MessageRequest.jl:45
(::HTTP.#kw##request)(::Array{Any,1}, ::HTTP.#request, ::Type{HTTP.MessageRequest.MessageLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at ./<missing>:0
macro expansion at /root/.julia/v0.6/AWSCore/src/http.jl:36 [inlined]
macro expansion at /root/.julia/v0.6/Retry/src/repeat_try.jl:206 [inlined]
http_request(::Dict{Symbol,Any}) at /root/.julia/v0.6/AWSCore/src/http.jl:20
macro expansion at /root/.julia/v0.6/AWSCore/src/AWSCore.jl:421 [inlined]
macro expansion at /root/.julia/v0.6/Retry/src/repeat_try.jl:206 [inlined]
do_request(::Dict{Symbol,Any}) at /root/.julia/v0.6/AWSCore/src/AWSCore.jl:399
macro expansion at /root/.julia/v0.6/AWSS3/src/AWSS3.jl:111 [inlined]
macro expansion at /root/.julia/v0.6/Retry/src/repeat_try.jl:206 [inlined]
#s3#1(::Dict{String,String}, ::SubString{String}, ::Dict{String,String}, ::String, ::Array{UInt8,1}, ::Bool, ::Bool, ::Function, ::Dict{Symbol,Any}, ::String, ::SubString{String}) at /root/.julia/v0.6/AWSS3/src/AWSS3.jl:81
(::AWSS3.#kw##s3)(::Array{Any,1}, ::AWSS3.#s3, ::Dict{Symbol,Any}, ::String, ::SubString{String}) at ./<missing>:0
#s3_put#27(::Dict{String,String}, ::Dict{String,String}, ::Function, ::Dict{Symbol,Any}, ::SubString{String}, ::SubString{String}, ::Array{UInt8,1}, ::String, ::String) at /root/.julia/v0.6/AWSS3/src/AWSS3.jl:659
s3_put(::Dict{Symbol,Any}, ::SubString{String}, ::SubString{String}, ::Array{UInt8,1}, ::String, ::String) at /root/.julia/v0.6/AWSS3/src/AWSS3.jl:627
...
@Keno
Copy link
Member

Keno commented Apr 15, 2020

JuliaWeb/HTTP.jl#529 suppresses those errors during close

@ararslan
Copy link
Member

ararslan commented Sep 14, 2022

I'm running into this with Julia 1.8.0, MbedTLS 1.1.5, HTTP 1.1.3, similarly by way of AWSS3 (0.10.0).

Unhandled Task ERROR: MbedTLS error code -80: NET - Connection was reset by peer
Stacktrace:
 [1] ssl_unsafe_read(ctx::MbedTLS.SSLContext, buf::Ptr{UInt8}, nbytes::UInt64)
   @ MbedTLS ~/.julia/packages/MbedTLS/4i6Lh/src/ssl.jl:376
 [2] wait_for_decrypted_data(ctx::MbedTLS.SSLContext)
   @ MbedTLS ~/.julia/packages/MbedTLS/4i6Lh/src/ssl.jl:312
 [3] eof(ctx::MbedTLS.SSLContext)
   @ MbedTLS ~/.julia/packages/MbedTLS/4i6Lh/src/ssl.jl:175
 [4] monitor_idle_connection(c::HTTP.ConnectionPool.Connection)
   @ HTTP.ConnectionPool ~/.julia/packages/HTTP/PesRN/src/ConnectionPool.jl:264
 [5] (::HTTP.ConnectionPool.var"#2#3"{HTTP.ConnectionPool.Connection})()
   @ HTTP.ConnectionPool ./task.jl:484
Unhandled Task ERROR: ArgumentError: `ssl_unsafe_read` requires `isreadable(::SSLContext)`
Stacktrace:
 [1] ssl_unsafe_read(ctx::MbedTLS.SSLContext, buf::Ptr{UInt8}, nbytes::UInt64)
   @ MbedTLS ~/.julia/packages/MbedTLS/4i6Lh/src/ssl.jl:345
 [2] wait_for_decrypted_data(ctx::MbedTLS.SSLContext)
   @ MbedTLS ~/.julia/packages/MbedTLS/4i6Lh/src/ssl.jl:312
 [3] eof(ctx::MbedTLS.SSLContext)
   @ MbedTLS ~/.julia/packages/MbedTLS/4i6Lh/src/ssl.jl:175
 [4] monitor_idle_connection(c::HTTP.ConnectionPool.Connection)
   @ HTTP.ConnectionPool ~/.julia/packages/HTTP/PesRN/src/ConnectionPool.jl:264
 [5] (::HTTP.ConnectionPool.var"#2#3"{HTTP.ConnectionPool.Connection})()
   @ HTTP.ConnectionPool ./task.jl:484

quinnj added a commit that referenced this issue Sep 15, 2022
Previously we might throw ArgumentError, MbedException, or AssertionError.
This PR proposes we more closely follow Sockets stdlib behavior by making
these errors Base.IOError for consistency.

Fixes #188
@quinnj
Copy link
Member

quinnj commented Sep 15, 2022

@ararslan, ok, should be cleaned up in #257

quinnj added a commit that referenced this issue Sep 16, 2022
Previously we might throw ArgumentError, MbedException, or AssertionError.
This PR proposes we more closely follow Sockets stdlib behavior by making
these errors Base.IOError for consistency.

Fixes #188
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

Successfully merging a pull request may close this issue.

4 participants