Skip to content

Fix support for JRuby 9.2.0.0#1409

Merged
marcotc merged 3 commits into
masterfrom
jruby-9.2.0.0-support
Mar 17, 2021
Merged

Fix support for JRuby 9.2.0.0#1409
marcotc merged 3 commits into
masterfrom
jruby-9.2.0.0-support

Conversation

@marcotc

@marcotc marcotc commented Mar 16, 2021

Copy link
Copy Markdown
Member

We advertise as supporting JRuby 9.2.0.0, which is the most recent major JRuby release, supporting Ruby 2.5 syntax.
But our existing test suite only runs on JRuby 9.2.11.1.

This causes one issue to come up recently around a bug that was fixing in 9.2.9.0, but affected our 9.2 supported versions older than that.

This PR addresses that issue, regarding Enumerator::Lazy#slice_before returning an eager Enumerator instead of a lazy oh, as well as adding JRuby 9.2.0.0 to CI, given it's the oldest supported JRuby version.

The PR keeps JRuby 9.2.11.1 in CI, as there have been significant behaviour changes since JRuby 9.2.0.0 that warrant a distinct test suite run.

@marcotc marcotc added the bug Involves a bug label Mar 16, 2021
@marcotc marcotc self-assigned this Mar 16, 2021
@marcotc
marcotc requested a review from a team March 16, 2021 22:40
ivoanjo
ivoanjo previously approved these changes Mar 17, 2021

@ivoanjo ivoanjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the need for this (and that's why I'm clicking approve), but I have some concerns about the future of this testing.

At this point JRuby 9.2.0.0 is more than two years old. If library developers already normally don't even test on JRuby, they definitely will not test on old JRuby. This makes my crystal ball (ruby ball?) predict other CI failures due to bugs that may have been fixed in newer JRuby versions.

When that happens, we may need to revisit this approach.

Comment thread lib/ddtrace/transport/traces.rb Outdated
Comment on lines +127 to +128

responses = responses.to_a # Force resolution of lazy enumerator

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be worth commenting here that this was causing us trouble with older JRuby versions (as otherwise it may not be entirely clear that this is very deliberate)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an explanation there.

Comment thread .circleci/config.yml Outdated
Comment on lines +442 to +445
- &config-jruby-9_2_0 # Oldest supported version
<<: *filters_all_branches_and_tags
ruby_version: 'jruby-9.2.0'
image: marcotc/docker-library:ddtrace_rb_jruby_9_2_0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps call this jruby-9_2_0_0 everywhere, just to match how JRuby sets its versions?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the naming suggestion, performed both.

Comment thread .circleci/config.yml Outdated
- test-3.0
- test-3.0-jit
- test-jruby-9.2.0
- test-jruby-9.2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename this one jruby-9_2-latest or something to better distinguish from the other?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the naming suggestion, performed both.

Comment on lines +128 to +140
# Force resolution of lazy enumerator.
#
# The "correct" method to call here would be `#force`,
# as this method was created to force the eager loading
# of a lazy enumerator.
#
# Unfortunately, JRuby < 9.2.9.0 erroneously eagerly loads
# the lazy Enumerator during intermediate steps.
# This forces us to use `#to_a`, as this method works for both
# lazy and regular Enumerators.
# Using `#to_a` can mask the fact that we expect a lazy
# Enumerator.
responses = responses.to_a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly enough, this was incorrect in TruffleRuby as well, lol: truffleruby/truffleruby#2273 . Seems like there may be gaps in https://github.com/ruby/spec around this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's accurate, as the JRuby repo got an update to their lazy enum specs, copied from ruby/spec, around the same time the bug was fixed.

@marcotc
marcotc merged commit d3a6a87 into master Mar 17, 2021
@marcotc
marcotc deleted the jruby-9.2.0.0-support branch March 17, 2021 19:32
@github-actions github-actions Bot added this to the 0.47.0 milestone Mar 17, 2021
ivoanjo added a commit that referenced this pull request Jan 26, 2022
In #1409 we added JRuby 9.2.0.0 explicitly to CI, because there was a
behavior change between <= 9.2.8.0 and >= 9.2.9.0 and we wanted to
support customers running on either side of the behavior change.

Keeping JRuby 9.2.0.0 working is non-trivial work, since it's missing
hundreds of fixes and changes from the 9.2 branch. We already had to
change things to acommodate it in #1434, and while investigating
msgpack/msgpack-ruby#239 I found YET another
issue where 9.2.0.0 is broken but later releases are fine.

Thus, since the only place in our test suite where we actually test for
different behavior is related to #1409, let's replace 9.2.0.0 in our
test suite with 9.2.8.0.

Hopefully 9.2.8.0 is in a bit of a better shape, and we'll avoid
needing to chase down any more 9.2.0.0-specific bugs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Involves a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants