Closed auxbuss closed 11 years ago
$ rake spec
...................................................................F
Failures:
1) EM::Twitter::Connection reconnections reconnector setting on 4xx responses uses the application failure reconnector
Failure/Error: expect(client.connection.reconnector).to be_kind_of(Reconnectors::ApplicationFailure)
expected #<EventMachine::Twitter::Reconnectors::NetworkFailure:0xa0f8250 @reconnect_timeout=0.25, @reconnect_count=0> to be a kind of EventMachine::Twitter::Reconnectors::ApplicationFailure
# ./spec/em-twitter/connection_reconnect_spec.rb:65:in `block (6 levels) in <top (required)>'
# ./spec/em-twitter/connection_reconnect_spec.rb:62:in `block (4 levels) in <top (required)>'
Finished in 47.37 seconds
68 examples, 1 failure
Failed examples:
rspec ./spec/em-twitter/connection_reconnect_spec.rb:61 # EM::Twitter::Connection reconnections reconnector setting on 4xx responses uses the application failure reconnector
The reason you’re seeing a different number of examples running each time you run the tests is a result of the RSpec configuration. This file specifies --order random
, which runs the suite in random order to prevent order-coupling between specs, and --fail-fast
, which aborts the suite as soon as it encounters one failure.
The behavior you’re seeing is as expected.
Oh, I was trying to provide data to help solve the stalling tests issue in tweetstream. I thought it would be useful. I wasn't in the least bothered by the random number of tests.
These issues are not with the suite itself but with Ruby 2.0. I took the liberty of updating the issue title and am reopening.
@auxbuss thanks for taking a look into this, this is very much in line with my experience running the test suite as well. I've not had a chance to dive into this further yet. I haven't seen that second failure either. No doubt, that's a result of the random ordering of the tests
I've isolated the problematic tests.
The stalling spec is connection_error_handling_spec.rb.
The failing spec is connection_reconnect_spec.rb.
When running under rake, note that terminating a stalled connection_error_handling_spec will leave an instance of mockingbird running as a child process of the ruby instance running the test under rpsec.
Observation: Inserting a puts at the start and end, and between each of the nine tests in connection_error_handling_spec.rb, plus adding some debug messages into error_callback_invoked() yielded:
$ rspec spec/em-twitter/connection_error_handling_spec.rb
here 01
here 02
here 03
here 04
here 05
here 06
here 07
here 08
here 09
here 10
*** enter error_callback_invoked()
*** start em block
*** end em block
<test stalls here. error_callback_invoked() never exits>
@auxbuss thanks for taking the time to research the issues and narrowing down the failures. I'll take a look in the next day or two to see if I can't get to the bottom of this. I had experienced segfaults under 2.0.0-p0 but it looks like later patch levels are at least letting the suite run which is somewhat encouraging.
Since the errors seem to be occurring around em connect/reconnect. I tried running with the pure ruby em (require 'em/pure_ruby'
), but the same problems occur. That said, connection_reconnect_spec.rb completes more quickly than the non-pure version. Seems the pure ruby em doesn't go through NetworkFailure
at all in the failing test -- it should. Using regular eventmachine does, but it's not clear what it's doing.
Something concrete \o/ ruby2 never calls Connection::on_headers_complete(), which I presume is invoked by http_parser.
@auxbuss yes, that's exactly what it's supposed to do. Previous usage of http_parser allowed me to simply do Http::Parser.new(self)
on the Connection
instance. One of the suggested changes by @jfrazee for Ruby 2.0 was implemented for on_body
but I didn't change on_headers_complete
in a similar manner, see 8e87d7b5f81fe20c43ccb55b93799541054a569c
well, Travis seems to be choking on that commit, but i've not had any failures or stalls after 7376820c90fa7bcc417a30bd4892d1f8816d3599. Very encouraging so far.
Why does this differ between 1.9 and 2.0?
I wish I knew, http_parser.rb has been very stable, and most recent changes appear to be related to JRuby. https://github.com/tmm1/http_parser.rb/commits/master
I ran this against 2.0.0-p247, 2.0.0-p195, and 1.9.3-p392. All tests pass.
I can wrap up a gem and test in an app tomorrow (it's 23:00+ here), if that's useful.
Closing as tests are now passing with 2.0.
I'm starting to look at the tweetstream ruby2 issue raise here: https://github.com/intridea/tweetstream/issues/117
I installed ruby-2.0.0-p247 (I'm using 195, so this is effectively a clean install), did
bundle install
, thenrake spec
.I'm posting this since it's a failure, rather than a stall, and might be immediately useful.
I ran the test suite three times. The first time:
The second time:
The third time the suite stalled.