-
Notifications
You must be signed in to change notification settings - Fork 32
✅ Add TruffleRuby and JRuby to CI #470
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
base: master
Are you sure you want to change the base?
Conversation
I had a quick look through the failures at https://github.com/ruby/net-imap/actions/runs/14711726747/job/41285563407?pr=470
That looks like an issue of Data#inspect or #to_s in truffleruby not calling inspect on the values. For the other failures I don't see anything obvious, I think they'll need investigation with some debugging, I suggest to do that later and so omit these 9 failures for now. |
2b8ac4d
to
f098a98
Compare
One thought I had given this gem is 3.1+ would be to use Struct (which exists since forever) instead of Data (+ freeze it, BTW thanks for this issue, should be an easy quick fix). But you're saying there are other issues with Struct too? |
That's fair. I did consider going that route. But I also wanted the more constrained API of Data vs Struct. I originally started down the path of building a facade over Struct. And then a switched from that to just a PORO. But the API I wanted turned out to be the Data-API. So in the end, I just used Data. And I'd already done much of the work for several features using Data... but I was waiting for v0.6.0 (which will require ruby > 3.2) before merging them.
So I was originally going to hold off on merging any new data structures until v0.6.0, just to avoid these issues. But work priorities bumped up the schedule for #333 and #329, which were both features I'd already mostly completed on my own time, based on
great! 👍🏻
My intention has always been (see #352 (comment)) for v0.6.0 to delete While working on this ticket, I briefly considered keeping it in v0.6.0, just for TruffleRuby and JRuby... but... I'm not gonna do that. 😉 I expect the JRuby and TruffleRuby bugfixes to come faster than my 0.6.0 release plans. 🙂
Yep. If you don't get to it first, I'll open TruffleRuby issue for it later today. But the failing And, to me, they seem very similar to the Data issues. My intuition may be completely wrong, but I would not be surprised if the fixes for |
On further investigation, I suspect the Struct issue is not inheritance related, but a difference in how Struct handles mixed positional and keyword arguments. I created oracle/truffleruby#3855. |
@eregon here's the issue I saw with #!/usr/bin/env ruby
puts ?=*72
puts "Ruby Engine: #{RUBY_ENGINE} #{RUBY_ENGINE_VERSION}"
require 'bundler/inline'
gemfile do
gem "stringio", ">= 3.1.7"
end
require "stringio"
puts "Using StringIO #{StringIO::VERSION}"
io = StringIO.new("123456789\r\n123456789\r\n")
pp stringio: io.gets("\r\n", 10)
r, w = IO.pipe
w.write "123456789\r\n123456789\r\n"
w.close
pp io_pipe: r.gets("\r\n", 10)
__END__
$ ruby test.rb && RBENV_VERSION=truffleruby-24.2.1 ruby test.rb
========================================================================
Ruby Engine: ruby 3.4.2
Using StringIO 3.1.7
{stringio: "123456789\r"}
{io_pipe: "123456789\r"}
========================================================================
Ruby Engine: truffleruby 24.2.1
Using StringIO 3.0.1
{:stringio=>"123456789\r\n"}
{:io_pipe=>"123456789\r"} I didn't make a TruffleRuby ticket for this. I'm guessing this is already a known issue, given that it silently failed to use a newer version of |
Thank you for reporting those and your work on adding TruffleRuby & JRuby in CI! Using Struct was just a quick idea, thank you for the detailed reply, I didn't expect that much details but it's good context. Re the StringIO issue, you are right, currently StringIO on TruffleRuby always uses our internal pure-Ruby implementation of it. But we should fix it to match the gem, so I created an issue from your comment: oracle/truffleruby#3856 |
Sorry for the side question, but can you explain what a PORO is? I wasn't able to find this with a Web search, probably just my bad. |
PORO = Plain Old Ruby Object (might derive from POJO use in Java?), i.e. just objects with a regular class and typically Object superclass, e.g. using |
If `disconnected?` returns true, the connection state is most likely already `logout`. But, just in case, we'll ensure it's set every time.
Not doing this with the other states, because the intention is to eventually store small bits of information about each state on the state objects, e.g: which mailbox was selected, what caused the logout. For `logout`, the first attempt wins and shouldn't be overwritten. For `selected`, the last attempt _should_ win. (That said, commands that affect connection state should be serialized.)
Net::IMAP#disconnect will still attempt to enter the logout state first, but it won't wait for the lock until after it's shutdown the socket.
The reciever thread should close the connection before it finishes, and `@sock.shutdown` should've been enough to trigger that. But this ensures the socket is closed right away, without needing to wait on whatever the receiver thread might be in the middle of doing.
This pushes `ensure state_logout!` from the receiver's `Thread.start` down into `#receive_responses`. As a side-effect, this also pulls the state change inside the receiver thread's exception handling. But that's fine: it fits better inside `receive_responses`, and `state_logout!` really should never raise an exception anyway.
Using jruby-head to get unreleased parser bugfix.
Perhaps this will improve compatibility with JRuby and TruffleRuby? I tried to use `defined?(::Data.define)`, but that didn't work for some reason. 🤷 Co-authored-by: Benoit Daloze <[email protected]>
This should _not_ be merged into main. 😉 It's only temporary, until bugs in TruffleRuby and JRuby are addressed: * jruby/jruby#8829 * oracle/truffleruby#3846 * oracle/truffleruby#3847 The JRuby bug is a showstopper. The TruffleRuby bugs are cosmetic (inspect "nil" vs "") or academic (we never create recursive Data).
This is a real edge-case... one which I included only for completeness. We _should not_ be making any recursive `Data` objects in `Net::IMAP`.
bb04982
to
fd2fd33
Compare
Will fix #454 (once it's passing)
net-imap
issues/PRs#inspect
)#disconnect
JRuby issues/PRs
net-imap
test code.TruffleRuby issues/PRs:
Misc
get_tagged_response
andreceive_responses
?)Data
polyfill. Rather than just check RUBY_ENGINE and RUBY_ENGINE_VERSION and defined?(::Data) and ::Data.respond_to?(:define), it tries to use all of the features that were causing tests to fail. If anything looks off, it prints a warning and falls back to the polyfill. I'm not going to merge this feature check. But it's in the branch. 😉net-imap
v0.6.0 will still be deletingDataLite
.