Skip to content

Issue with JRuby/SSL #30

Open
Open
@ioquatix

Description

@ioquatix

Hey @ioquatix,

Sorry for the delay, I finally got back to digging into this. I'm not sure if this is jruby specific or if it is something else, but I get these errors when I try to use the cloudflare gem with a proxy:

40.67s    error: <Async::Task:0x80e pipe writer failed> [pid=36119] [2019-10-04 08:59:40 -0400]
               |   ArgumentError: mode not supported for this object: r
               |   → org/nio4r/Selector.java:124 in `register'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/reactor.rb:129 in `register'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/wrapper.rb:222 in `wait_for'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/wrapper.rb:122 in `wait_readable'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/generic.rb:218 in `async_send'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/generic.rb:67 in `block in read_nonblock'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/stream.rb:242 in `fill_read_buffer'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/stream.rb:87 in `read_partial'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-http-0.48.2/lib/async/http/body/pipe.rb:88 in `writer'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/task.rb:248 in `block in make_fiber'
40.81s    error: <Async::Task:0x810 pipe writer failed> [pid=36119] [2019-10-04 08:59:40 -0400]
               |   ArgumentError: mode not supported for this object: r
               |   → org/nio4r/Selector.java:124 in `register'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/reactor.rb:129 in `register'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/wrapper.rb:222 in `wait_for'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/wrapper.rb:122 in `wait_readable'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/generic.rb:218 in `async_send'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/generic.rb:67 in `block in read_nonblock'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/stream.rb:242 in `fill_read_buffer'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/stream.rb:87 in `read_partial'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-http-0.48.2/lib/async/http/body/pipe.rb:88 in `writer'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/task.rb:248 in `block in make_fiber'
40.87s    error: <Async::Task:0x812 pipe writer failed> [pid=36119] [2019-10-04 08:59:40 -0400]
               |   ArgumentError: mode not supported for this object: r
               |   → org/nio4r/Selector.java:124 in `register'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/reactor.rb:129 in `register'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/wrapper.rb:222 in `wait_for'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/wrapper.rb:122 in `wait_readable'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/generic.rb:218 in `async_send'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/generic.rb:67 in `block in read_nonblock'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/stream.rb:242 in `fill_read_buffer'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-io-1.25.0/lib/async/io/stream.rb:87 in `read_partial'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-http-0.48.2/lib/async/http/body/pipe.rb:88 in `writer'
               |     /Users/robert.widmer/.rvm/gems/jruby-9.2.8.0/gems/async-1.21.0/lib/async/task.rb:248 in `block in make_fiber'

It appears that it is making a connection to the proxy (from the squid access logs):

1570193980.519    305 127.0.0.1 TCP_TUNNEL/200 39 CONNECT api.cloudflare.com:443 - HIER_DIRECT/2606:4700::6810:1f5a -
1570193980.581     53 127.0.0.1 TCP_TUNNEL/200 39 CONNECT api.cloudflare.com:443 - HIER_DIRECT/2606:4700::6810:1f5a -
1570193980.657     68 127.0.0.1 TCP_TUNNEL/200 39 CONNECT api.cloudflare.com:443 - HIER_DIRECT/2606:4700::6810:1f5a -

This is how I am configuring the cloudflare connection (simplified version):

endpoint = Async::HTTP::Endpoint.new(URI::HTTP.build(Settings.http_proxy.to_h))
client = Async::HTTP::Client.new(endpoint).proxied_endpoint(::Cloudflare::DEFAULT_ENDPOINT)
Cloudflare.connect(endpoint, Settings.cloudflare.credentials, &block)

Any thoughts on things that could potentially be misconfigured?

Originally posted by @rdubya in #25 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions