uperl / AnyEvent-WebSocket-Client

WebSocket client for AnyEvent
9 stars 10 forks source link

t/ae_ssl.t test failure #22

Closed eserte closed 7 years ago

eserte commented 8 years ago

On some of my smoker boxes I see a new failure while running t/ae_ssl.t:

EV: error in callback (ignoring): AnyEvent::Handle uncaught error: ssl3_get_client_hello: parse tlsext at /home/cpansand/.cpan/build/2016021906/AnyEvent-7.12-PQTBdv/blib/lib/AnyEvent/Impl/EV.pm line 88.
connect error: Unexpected end-of-file at t/ae_ssl.t line 50.
# Looks like your test exited with 255 before it could output anything.
t/ae_ssl.t ........................... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/3 subtests 

It seems that it has to do somthing with recent AnyEvent versions, though statistical analysis is not 100% clear about it. Maybe related to this change?

eserte commented 8 years ago

It seems that it has to do somthing with recent AnyEvent versions, though statistical analysis is not 100% clear about it.

If I use the latest AnyEvent and Net::SSLeay versions, then it fails on all systems (freebsd 9 & 10; debian wheezy & jessie; all perl versions).

plicease commented 8 years ago

Confirmed I get it too:

twin% prove -lv t/ae_ssl.t 
t/ae_ssl.t .. 
1..3
# wss://127.0.0.1:39389/echo
# wss://127.0.0.1:39389/count/10
EV: error in callback (ignoring): AnyEvent::Handle uncaught error: ssl3_get_client_hello: parse tlsext at /home/ollisg/.perlbrew/libs/perl-5.23.7tc@dev/lib/perl5/x86_64-linux-thread-multi/AnyEvent/Impl/EV.pm line 88.
connect error: Unexpected end-of-file at t/ae_ssl.t line 50.
# Looks like your test exited with 255 before it could output anything.
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/3 subtests 

Test Summary Report
-------------------
t/ae_ssl.t (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 3 tests but ran 0.
Files=1, Tests=0,  0 wallclock secs ( 0.03 usr  0.00 sys +  0.19 cusr  0.01 csys =  0.23 CPU)
Result: FAIL
huguesmax commented 8 years ago

same problem on Centos 7.2 + perl 5.16 a idea ?

t/00_diag.t .......................... ok t/ae.t ............................... ok t/ae_ssl.t ........................... EV: error in callback (ignoring): AnyEvent::Handle uncaught error: ssl3_get_client_hello: parse tlsext at /usr/local/lib64/perl5/AnyEvent/Impl/EV.pm line 88. connect error: Unexpected end-of-file at t/ae_ssl.t line 50.

Looks like your test exited with 255 before it could output anything. t/ae_ssl.t ........................... Dubious, test returned 255 (wstat 65280, 0xff00)

plicease commented 8 years ago

patches welcome.

Unfortunately I am unlikely to find the time to look into this in any detail in the near term.

keeperofdakeys commented 8 years ago

If this is the same issue I came across, the error occurs because an empty server_name extension is sent in the TLS Client Hello message (so you get an error parsing the tls extension). You need AnyEvent::Handle to send a peername that is non-empty (or none at all).

keeperofdakeys commented 8 years ago

From what I can see, the fix for the zero-length common names is currently in their CVS. http://cvs.schmorp.de/AnyEvent/lib/AnyEvent/TLS.pm?view=markup#l847

plicease commented 8 years ago

Confirmed, patching AnyEvent/TLS.pm as it appears in CVS seems to fix this for me. Thanks for the information. Perhaps the next version of AE will fix this.

debug-ito commented 8 years ago

I think this is fixed with AnyEvent-7.12

debug-ito commented 8 years ago

Wait, maybe I was wrong...

debug-ito commented 8 years ago

Hmm, I tried Net::SSLeay-1.72 and Net::SSLeay-1.74, and both passed the test.

My environment was

plicease commented 8 years ago

Yeah, works for me also on my Debian 8 box:

# perl                 5.025003
# AnyEvent             7.12
# Devel::Cycle         1.12
# EV                   4.22
# IO::Socket::SSL      2.033
# Math::Random::Secure -
# Module::Build        0.4218
# Mojolicious          7.0
# Moo                  2.002004
# Net::SSLeay          1.74
# PerlX::Maybe         1.001
# PerlX::Maybe::XS     -
# Protocol::WebSocket  0.19
# Test::Memory::Cycle  1.06
# Test::More           1.302049
# Test::Warn           0.30
# URI                  1.71
# URI::ws              0.03

I was getting failures on this machine before, so it may be an upgraded system library has fixed the problem there. But it fails on a similar configuration on OS X:

# perl                 5.025003
# AnyEvent             7.12
# Devel::Cycle         1.12
# EV                   4.22
# IO::Socket::SSL      2.033
# Math::Random::Secure -
# Module::Build        0.4218
# Mojolicious          7.0
# Moo                  2.002004
# Net::SSLeay          1.74
# PerlX::Maybe         1.001
# PerlX::Maybe::XS     -
# Protocol::WebSocket  0.19
# Test::Memory::Cycle  1.06
# Test::More           1.302049
# Test::Warn           0.30
# URI                  1.71
# URI::ws              0.03
huguesmax commented 8 years ago

I've just tested on my Centos 6 , it's ok with just cpanm AnyEvent::WebSocket::Client

but failed on Centos 7, I'm going to inverstigate

huguesmax commented 8 years ago

see some details on Centos7

perl 5.016003 AnyEvent 7.12 Devel::Cycle - EV 4.22 IO::Socket::SSL 1.94 Math::Random::Secure - Module::Build 0.4214 Mojolicious - Moo 2.000002 Net::SSLeay 1.72 PerlX::Maybe 1.001 PerlX::Maybe::XS - Protocol::WebSocket 0.19 Test::Memory::Cycle - Test::More 1.302026 Test::Warn 0.30 URI 1.60 URI::ws 0.03

EV: error in callback (ignoring): AnyEvent::Handle uncaught error: ssl3_get_client_hello: parse tlsext at /usr/local/lib64/perl5/AnyEvent/Impl/EV.pm line 88.

FAIL Installing AnyEvent::WebSocket::Client failed. See /root/.cpanm/work/1469799324.17622/build.log for details. Retry with --force to force install it. Expiring 4 work directories.

this is issues noted here : https://github.com/plicease/AnyEvent-WebSocket-Client/issues/22 with SSL

export ANYEVENT_WEBSOCKET_TEST_SKIP_SSL=1 and

cpanm AnyEvent::WebSocket::Client AnyEvent::WebSocket::Client is up to date. (0.34)

keeperofdakeys commented 8 years ago

If you're curious, get a pcap with tcpdump while running the tests, and compare the TLS Client Hello messages in wireshark. The "ssl3_get_client_hello: parse tlsext" error seems to occur because the server_name extension exists, but is zero bytes. Either centos 6 is not setting the extension header at all, or the openssl version has less verification for that header. I came across this issue on centos 7.

Whenever the next release of AnyEvent comes out, this problem should be fixed (since the fix is in their CVS system).

plicease commented 7 years ago

This appears to be fixed in AE 7.13. I am bumping the AE::WS::C requirement of AE to address this. Closing but feel free to open if you are still seeing this.