Skip to content

Disable rlimit features on Windows#6492

Merged
headius merged 2 commits intojruby:jruby-9.2from
headius:disable_unsupported_rlimit
Dec 14, 2020
Merged

Disable rlimit features on Windows#6492
headius merged 2 commits intojruby:jruby-9.2from
headius:disable_unsupported_rlimit

Conversation

@headius
Copy link
Member

@headius headius commented Dec 13, 2020

See #6491 and ruby/rubygems#4129 for discussions of this issue.

We could also do this disabling when running on a platform that does not support our FFI, but that would increase the compatibility gap on such platforms.

@headius headius added this to the JRuby 9.2.15.0 milestone Dec 13, 2020
@headius
Copy link
Member Author

headius commented Dec 13, 2020

I am unsure if there's a ruby/spec to add for this, since typically ruby/spec does not specify when features should not be implemented.

@eregon
Copy link
Member

eregon commented Dec 13, 2020

I am unsure if there's a ruby/spec to add for this, since typically ruby/spec does not specify when features should not be implemented.

It's totally fine to add a ruby/spec for this, i.e. testing that Process.respond_to?(:getrlimit) is false, and/or that the constants are not defined on Windows, especially since it's clear this affects compatibility in this case.

@slonopotamus
Copy link

Would be great if this fix was quickly released as a 9.2.14.1 or something like that. Because currently latest JRuby + Windows + latest Bundle results in ruby/rubygems#4129.

@headius
Copy link
Member Author

headius commented Dec 14, 2020

@slonopotamus There will be a release of some sort but not until January. We are getting too close to the holiday season to do releases of stable JRuby versions.

It sounds like @deivid-rodriguez will put out Bundler 2.2.1 with the fix for JRuby (among others) and I think that will solve this problem automatically.

@headius
Copy link
Member Author

headius commented Dec 14, 2020

It's totally fine to add a ruby/spec for this

@eregon Thank you for clarifying... I will also add some specs.

Past RubySpec policy was to avoid adding tests that "proved a negative". However if users can observe that a feature is implemented on some platforms and not implemented on others, it seems clear to me that we should have specifications for that behavior.

We attempted to fake getrlimit behavior on Windows, but CRuby just
leaves it and the related constants (plus setrlimit) unimplemented
when the host platform does not support them. Our fake behavior
led to ruby/rubygems#4129 which affects all versions of JRuby
up through 9.2.14.0.

This patch markes the related rlimit methods as not implemented
and skips defining the related constants when on Windows.

Fixes jruby#6491
This is checked by some libraries before attempting to use
getrlimit/setrlimit and therefore is observable behavior that must
be specified.

See an example of how failure to specify this behavior led to a
broken net-http-persistent on JRuby on Windows here:
ruby/rubygems#4129
@headius headius force-pushed the disable_unsupported_rlimit branch from abca1b7 to ee4325b Compare December 14, 2020 19:33
@headius headius merged commit dbb517b into jruby:jruby-9.2 Dec 14, 2020
@headius headius deleted the disable_unsupported_rlimit branch December 14, 2020 19:50
@headius
Copy link
Member Author

headius commented Dec 14, 2020

This is merged and there should be snapshots available soon at https://www.jruby.org/nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants