socketry / io-endpoint Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
io-endpoint/lib/io/endpoint/wrapper.rb
Line 157 in e82badc
1m warn: Async::Task [oid=0xdfc] [ec=0xde8] [pid=56009] [2024-05-08 20:40:28 +1200]
| Task may have ended with unhandled exception.
| OpenSSL::SSL::SSLError: SSL_accept returned=1 errno=0 peeraddr=[::1]:50598 state=error: ssl/tls alert certificate unknown
| → /home/samuel/.rubies/ruby-3.3.1/lib/ruby/3.3.0/openssl/ssl.rb:527 in `accept'
| /home/samuel/.rubies/ruby-3.3.1/lib/ruby/3.3.0/openssl/ssl.rb:527 in `accept'
| /home/samuel/.gem/ruby/3.3.1/gems/io-endpoint-0.10.2/lib/io/endpoint/wrapper.rb:157 in `accept'
| /home/samuel/.gem/ruby/3.3.1/gems/io-endpoint-0.10.2/lib/io/endpoint/generic.rb:83 in `block in accept'
| /home/samuel/.gem/ruby/3.3.1/gems/io-endpoint-0.10.2/lib/io/endpoint/bound_endpoint.rb:65 in `block (2 levels) in bind'
| /home/samuel/.gem/ruby/3.3.1/gems/async-2.11.0/lib/async/task.rb:164 in `block in run'
| /home/samuel/.gem/ruby/3.3.1/gems/async-2.11.0/lib/async/task.rb:377 in `block in schedule'
Since most of the "endpoints" can be represented as URIs (ex: tcp://host:port
, ssl://host:port
, unix://host:port
, etc), I think you could rename IO::Endpoint
to IO::URI
(ex: IO::Endpoint::SSLEndpoint
-> IO::URI::SSL
). This would also reduce the number of times one must type Endpoint
.
May be related to #9
(Still migrating vom EM/Thin to Async/Falcon...)
While configuring SSL support for the Falcon::Server
instance that runs in one of the processes of our app, I noticed these OpenSSL errors in the log:
With Safari connected the server running inside my Linux VM:
59.39s warn: Async::Task [oid=0x1e21c] [ec=0x1e230] [pid=3923825] [2024-07-10 19:56:41 +0200]
| Task may have ended with unhandled exception.
| OpenSSL::SSL::SSLError: SSL_accept returned=1 errno=0 peeraddr=192.168.56.2:62856 state=error: unexpected eof while reading
| → /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/ssl_endpoint.rb:16 in `accept'
| /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/ssl_endpoint.rb:16 in `start'
| /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/wrapper.rb:171 in `block in accept'
| /home/user/dev/oss/async/lib/async/task.rb:164 in `block in run'
| /home/user/dev/oss/async/lib/async/task.rb:377 in `block in schedule'
With Chromium connected to the server inside the VM:
1m warn: Async::Task [oid=0x1e2d0] [ec=0x1e2e4] [pid=3923825] [2024-07-10 19:57:32 +0200]
| Task may have ended with unhandled exception.
| OpenSSL::SSL::SSLError: SSL_accept returned=1 errno=0 peeraddr=192.168.56.2:62867 state=error: sslv3 alert certificate unknown
| → /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/ssl_endpoint.rb:16 in `accept'
| /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/ssl_endpoint.rb:16 in `start'
| /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/wrapper.rb:171 in `block in accept'
| /home/user/dev/oss/async/lib/async/task.rb:164 in `block in run'
| /home/user/dev/oss/async/lib/async/task.rb:377 in `block in schedule'
1m debug: Async::HTTP::Protocol::HTTPS [ec=0x1e2f8] [pid=3923825] [2024-07-10 19:57:32 +0200]
| Negotiating protocol "h2"...
1m debug: Falcon::Server [oid=0x1e208] [ec=0x1e2f8] [pid=3923825] [2024-07-10 19:57:32 +0200]
| Incoming connnection from nil to Async::HTTP::Protocol::HTTPS
With Chromium inside the VM:
6m warn: Async::Task [oid=0x1e550] [ec=0x1e564] [pid=3923825] [2024-07-10 20:02:23 +0200]
| Task may have ended with unhandled exception.
| OpenSSL::SSL::SSLError: SSL_accept returned=1 errno=0 peeraddr=127.0.0.1:37782 state=error: sslv3 alert certificate unknown
| → /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/ssl_endpoint.rb:16 in `accept'
| /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/ssl_endpoint.rb:16 in `start'
| /home/user/.gem/ruby/3.3.1/gems/io-endpoint-0.11.0/lib/io/endpoint/wrapper.rb:171 in `block in accept'
| /home/user/dev/oss/async/lib/async/task.rb:164 in `block in run'
| /home/user/dev/oss/async/lib/async/task.rb:377 in `block in schedule'
Despite these errors, the browser can load the website just fine. How can that be?
When opening a large number of udp connections with Async::IO::Endpoint.udp
, I've found that a few udp source ports will be reused. This creates an issue in async-dns where a socket will read the wrong message since there are two sockets using the same source port.
I ran into this while troubleshooting symptoms that look a lot like async-dns#29. While troubleshooting, I noticed that the conflicting message ids were sent from the same UDP source port. I confirmed this with tcpdump data as well as printing out the local_address
info in a local copy of async-dns.
I can reproduce the issue with the following test code:
opts = ['8.8.8.8', 53]
async_addrs = []
tasks = []
Async::Reactor.run do
1000.times do
tasks << Async do
endpoint = Async::IO::Endpoint.udp(*opts)
endpoint.connect do |socket|
# Sleep to ensure all async sockets are open at the same time
sleep 5
async_addrs << socket.local_address.inspect_sockaddr
end
end
end
tasks.each(&:wait)
end
dup_source_ports = async_addrs.tally.select { |k, v| v > 1 }
puts "Duplicate source ports when opening async: #{dup_source_ports}"
My output looks like:
Duplicate source ports when opening async: {"172.20.0.3:34947"=>2, "172.20.0.3:47288"=>2, "172.20.0.3:50770"=>2, "172.20.0.3:42735"=>2, "172.20.0.3:35920"=>2, "172.20.0.3:55178"=>2, "172.20.0.3:37292"=>3, "172.20.0.3:55541"=>2, "172.20.0.3:60046"=>2, "172.20.0.3:51284"=>2, "172.20.0.3:53503"=>2, "172.20.0.3:55538"=>2, "172.20.0.3:48124"=>2, "172.20.0.3:46663"=>2, "172.20.0.3:46927"=>2, "172.20.0.3:48047"=>2, "172.20.0.3:36643"=>2, "172.20.0.3:35810"=>2, "172.20.0.3:36384"=>2, "172.20.0.3:58197"=>2, "172.20.0.3:56768"=>2, "172.20.0.3:55430"=>2, "172.20.0.3:37374"=>2, "172.20.0.3:59022"=>2}
Ruby version: ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]
async-io version: 1.43.2
async version: 2.12.1
This is all running in a docker container built from ruby:3.1-slim
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.