Skip to content
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

Modifications for Ruby 3.1. #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zerebubuth
Copy link

Hi!

I was getting some warnings when running the test suite from https://github.com/openstreetmap/openstreetmap-website saying things like:

/home/matt/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.0.5/lib/active_support/testing/parallelization/worker.rb:15: warning: Exception in finalizer #<Proc:0x00007f069eb3bab8 /home/matt/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/gd2-ffij-0.4.0/lib/gd2/animated_gif.rb:73>
/home/matt/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/gd2-ffij-0.4.0/lib/gd2/animated_gif.rb:74:in `block in frames_finalizer': undefined method `each' for #<GD2::AnimatedGif:0x00007f069eb3bba8 @frames=[#<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ff470>, size=#<FFI::MemoryPointer address=0x00005616e9b1bb30 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ff4b0>, size=#<FFI::MemoryPointer address=0x00005616e9e38a00 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ff630>, size=#<FFI::MemoryPointer address=0x00005616e9caeda0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ff7b0>, size=#<FFI::MemoryPointer address=0x00005616ed2b1210 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ff930>, size=#<FFI::MemoryPointer address=0x00005616eec24430 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ffab0>, size=#<FFI::MemoryPointer address=0x00005616ed070520 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ffc30>, size=#<FFI::MemoryPointer address=0x00005616e9aff6e0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01ffdb0>, size=#<FFI::MemoryPointer address=0x00005616ef5d2db0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f01fff30>, size=#<FFI::MemoryPointer address=0x00005616efa6b480 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f02000b0>, size=#<FFI::MemoryPointer address=0x00005616e9c81f20 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616f0200230>, size=#<FFI::MemoryPointer address=0x00005616ecf8bba0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x00005616ef5dbd70>, size=#<FFI::MemoryPointer address=0x00005616ed20d080 size=4>>]> (NoMethodError)

        each do |frame|
        ^^^^
...

I'm not entirely sure why the finalizer is behaving differently now, but changing it to a proc capturing @frames instead of on @frames itself seemed to work for me, and is recommended in the Ruby 3.1 docs.

Also, Ruby 3.1 removed the "matrix" library from the standard lib, so it now needs to be required as a gem. Thanks @gravitystorm for showing me the right way to do that! I tested on 2.7 as well, and it looked like depending on "matrix" was OK there too.

Needs the 'matrix' gem which is now external to the Ruby Standard Library. Changed finalizer to pass in the @Frames array so that the target of each is explicit.
@gravitystorm
Copy link

@dark-panda Is there anything that we can do to help move this PR along? It would be great to avoid all these warnings on ruby 3.1 and beyond.

@mmd-osm
Copy link
Contributor

mmd-osm commented Aug 4, 2024

@dark-panda : could you please look into this issue? Currently, we're experiencing pages and pages of warning messages in our unit tests as well as running instances, and it's really distracting for everyone. Thanks a lot!

         each do |frame|
        ^^^^
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization/worker.rb:15:in `fork'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization/worker.rb:15:in `start'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization.rb:37:in `block in start'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization.rb:36:in `times'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization.rb:36:in `each'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization.rb:36:in `map'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization.rb:36:in `start'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelize_executor.rb:19:in `start'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/minitest-5.24.1/lib/minitest.rb:285:in `run'
	from /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/minitest-5.24.1/lib/minitest.rb:86:in `block in autorun'
/home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/parallelization/worker.rb:15: warning: Exception in finalizer #<Proc:0x00007fc5edfbb638 /home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/gd2-ffij-0.4.0/lib/gd2/animated_gif.rb:73>
/home/runner/work/openstreetmap-website/openstreetmap-website/vendor/bundle/ruby/3.2.0/gems/gd2-ffij-0.4.0/lib/gd2/animated_gif.rb:74:in `block in frames_finalizer': undefined method `each' for #<GD2::AnimatedGif:0x00007fc5edfbb868 @frames=[#<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1c0ffbb0>, size=#<FFI::MemoryPointer address=0x000055cc1deacc70 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1e5e8690>, size=#<FFI::MemoryPointer address=0x000055cc1cfea0e0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1fcb22c0>, size=#<FFI::MemoryPointer address=0x000055cc1d1338f0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1e21aa00>, size=#<FFI::MemoryPointer address=0x000055cc1ec54220 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1dd9a560>, size=#<FFI::MemoryPointer address=0x000055cc1e2e5800 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1fdd43e0>, size=#<FFI::MemoryPointer address=0x000055cc1cbcc2b0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1f695db0>, size=#<FFI::MemoryPointer address=0x000055cc1dabe990 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1c9a1950>, size=#<FFI::MemoryPointer address=0x000055cc1d134070 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1f2035c0>, size=#<FFI::MemoryPointer address=0x000055cc1e38ada0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1e8e7800>, size=#<FFI::MemoryPointer address=0x000055cc1e413010 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1ddf76f0>, size=#<FFI::MemoryPointer address=0x000055cc1e2403e0 size=4>>, #<struct GD2::AnimatedGif::Frame ptr=#<FFI::Pointer address=0x000055cc1de44eb0>, size=#<FFI::MemoryPointer address=0x000055cc1f1b5ba0 size=4>>]> (NoMethodError)

tomhughes added a commit to tomhughes/openstreetmap-website that referenced this pull request Aug 14, 2024
tomhughes added a commit to tomhughes/openstreetmap-website that referenced this pull request Aug 14, 2024
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