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

Using Celluloid::IO for async reading from a TLS socket does not work #2502

Closed
keltia opened this issue Jan 22, 2015 · 12 comments
Closed

Using Celluloid::IO for async reading from a TLS socket does not work #2502

keltia opened this issue Jan 22, 2015 · 12 comments

Comments

@keltia
Copy link

keltia commented Jan 22, 2015

9.0.0.0-pre1 installed through rbenv. OS X 10.10.1.

Hello, using the following code https://gist.github.com/keltia/e3bc40e9b2b1d84da5f8 to read from a streaming TLS-enabled socket, 1.7.18 works perfectly, printing snippets of JSON data, 9.0.0.0-pre1 gives me 0-byte strings instead.

1.7.18

386 [22:30] roberto@lonrach-2:GIT/flightaware-client> bin/fa-export
Connecting to foxtrot.hou.flightaware.com:1501 using TLS.
  Initiating TLS negociation
  Authenticating to FlightAware
Init done.
224 bytes read.
{"type":"position","ident":"CES586","air_ground":"A","alt":"32000","clock":"1421962210","id":"CES586-1421735438-airline-0391","gs":"432","heading":"349","hexid":"780504","lat":"44.93806","lon":"-123.59870","updateType":"A"}
239 bytes read.
{"type":"position","ident":"SWA1608","air_ground":"A","alt":"40000","clock":"1421962210","id":"SWA1608-1421735568-airline-0198","gs":"457","heading":"25","hexid":"AB5BB1","lat":"35.58513","lon":"-78.48541","reg":"N8307K","updateType":"A"}
241 bytes read.
{"type":"position","ident":"KLM1608","air_ground":"A","alt":"39700","clock":"1421962210","id":"KLM1608-1421735389-airline-0214:0","gs":"443","heading":"324","hexid":"484FDF","lat":"50.34890","lon":"6.01672","squawk":"3565","updateType":"A"}

whereas 9.0.0.0-pre1 gives:

385 [22:28] roberto@lonrach-2:GIT/flightaware-client> bin/fa-export
Connecting to foxtrot.hou.flightaware.com:1501 using TLS.
  Initiating TLS negociation
  Authenticating to FlightAware
Init done.
0 bytes read.

0 bytes read.

gem list:

*** LOCAL GEMS ***

axiom-types (0.1.1)
bundler (1.7.12)
celluloid (0.16.0)
celluloid-io (0.16.1)
coercible (1.0.0)
descendants_tracker (0.0.4)
equalizer (0.0.9)
hitimes (1.2.2 java)
ice_nine (0.11.1)
jar-dependencies (0.1.2)
jruby-launcher (1.1.1 java)
jruby-openssl (0.9.6 java)
json (1.8.0 java)
maven-tools (1.0.7)
minitest (5.4.1)
nio4r (1.1.0 java)
power_assert (0.1.4)
rake (10.4.2, 10.1.0)
rdoc (4.1.0)
ruby-maven (3.1.1.0.8)
ruby-maven-libs (3.1.1)
test-unit (3.0.3)
thread_safe (0.3.4 java)
timers (4.0.1)
virtus (1.0.4)

Tell me if you need more.

@headius
Copy link
Member

headius commented Jan 22, 2015

I signed up for an account but I'm not sure what to put for "site" and "port" in the script.

@headius
Copy link
Member

headius commented Jan 22, 2015

Oh, I found the bit about json feeds through a commercial account at the low low price of $1100. I'm guessing we won't be able to reproduce this locally?

Perhaps you can dig into the code a bit and try to narrow it down to the line(s) that are failing to read any data?

@headius
Copy link
Member

headius commented Jan 22, 2015

Also, you may want to try downgrading jruby-openssl to 0.9.5 or confirm you're using the same version on 1.7.18.

@keltia
Copy link
Author

keltia commented Jan 22, 2015

0.9.6 for 9.0.0.0-pre1 and 0.9.5 for 1.7.18 yes. Will try with 0.9.5 on 9.0.0.0-pre1.

I'm getting these messages when using 0.9.5 with 9.0.0.0-pre1. Maybe I missed something when installing 0.9.5?

file:/Volumes/Users/roberto/.rbenv/versions/jruby-9.0.0.0-pre1/lib/jruby.jar!/jruby/kernel/kernel.rb:28: warning: unsupported exec option: close_others
LoadError: no such file to load -- krypt/ossl
     require at org/jruby/RubyKernel.java:954
      (root) at /Volumes/Users/roberto/.rbenv/versions/jruby-9.0.0.0-pre1/lib/ruby/gems/shared/gems/jruby-openssl-0.9.5-java/lib/jopenssl21/openssl.rb:23
    load at org/jruby/RubyKernel.java:969
      (root) at /Volumes/Users/roberto/.rbenv/versions/jruby-9.0.0.0-pre1/lib/ruby/gems/shared/gems/jruby-openssl-0.9.5-java/lib/jopenssl/load.rb:1
     require at org/jruby/RubyKernel.java:954
      (root) at /Volumes/Users/roberto/.rbenv/versions/jruby-9.0.0.0-pre1/lib/ruby/gems/shared/gems/jruby-openssl-0.9.5-java/lib/jopenssl/load.rb:22
     require at org/jruby/RubyKernel.java:954

script at bin/fa-export:17

@keltia
Copy link
Author

keltia commented Jan 22, 2015

jruby 1.7.18 works fine with jruby-openssl 0.9.6.

@mkristian
Copy link
Member

for jruby-openssl-0.9.5 you need to install the krypt gem as well, it was part of jruby's default gems until jruby-openssl stopped needing it but the old gems do NOT have a declared dependency on krypt.

@kares
Copy link
Member

kares commented Jun 3, 2015

should be fine now ... could we get a confirmation with 9K-pre2 + gem install jruby-openssl (0.9.7)

@keltia
Copy link
Author

keltia commented Jun 3, 2015

Just tried with these versions. Behaviour is different (no display of 0 bytes read.) but the buffer I get is still empty :(

Connecting to foxtrot.hou.flightaware.com:1501 using TLS.
  Initiating TLS negociation
  Authenticating to FlightAware
Init done.
...
^CINT: stopping...

112 packets received, 0 bytes.
D, [2015-06-03T23:50:45.363000 #26008] DEBUG -- : Terminating 1 actor...

@kares
Copy link
Member

kares commented Jun 3, 2015

@keltia thanks ... that seems weird, guessing there's still no "eazy" way to reproduce ?

if not ... for the record, does 1.7.20 (with jruby-openssl 0.9.7) work as expected ?

@keltia
Copy link
Author

keltia commented Jun 3, 2015

Yes, 1.7.20 + 0.9.7 works as expected:

Connecting to foxtrot.hou.flightaware.com:1501 using TLS.
  Initiating TLS negociation
  Authenticating to FlightAware
Init done.
{"type":"position","ident":"QFA838","air_ground":"A","alt":"28000","clock":"1433370817","id":"QFA838-1433326232-airline-0024","gs":"453","heading":"336","hexid":"7C77FC","lat":"-36.47456","lon":"143.79765","reg":"VHXZI","squawk":"1512","updateType":"A","altChange":"C"}
{"type":"position","ident":"AAL806","air_ground":"A","alt":"32000","clock":"1433370817","id":"AAL806-1433189100-schedule-0145","gs":"463","heading":"273","hexid":"A76DF8","lat":"39.92553","lon":"-91.61661","reg":"N578UW","updateType":"A","altChange":"C"}

As for reproducing, my guess is that any streaming connection could be used instead of FlightAware's.

@kares
Copy link
Member

kares commented Jun 3, 2015

thanks, in that case could you please get us a 'simpler' script to reproduce - current way is quite a hustle :(

@kares
Copy link
Member

kares commented Dec 4, 2015

closing - no activity in several months.

@kares kares closed this as completed Dec 4, 2015
@kares kares added this to the Invalid or Duplicate milestone Dec 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants