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

Bump Ruby to 3.3.0 and Alpine to 3.19 #561

Closed
wants to merge 3 commits into from
Closed

Conversation

aliuk2012
Copy link
Contributor

@aliuk2012 aliuk2012 commented Dec 27, 2023

Related

What problem does this pull request solve?

Created using our forms-deploy update_app_versions script to bump ruby from 3.2.2 to 3.3.0 and alpine 3.18 to 3.19

Trello card:

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Has all relevant documentation been updated?

NoMethod error usess a lot of CPU calling inspect on an object that has
raised the error. In ruby 3.3 inspect has been removed and now the exception
will only contain the objects name that had the issue instead of inspecting it.

see
https://github.com/ruby/ruby/blob/v3_3_0/NEWS.md#compatibility-issues

```
Error message for NoMethodError have changed to not use the target object's #inspect for efficiency, and says "instance of ClassName" instead. [Feature #18285]

([1] * 100).nonexisting

```
Copy link

sonarqubecloud bot commented Jan 2, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@lfdebrux
Copy link
Member

lfdebrux commented Jan 2, 2024

🤔 I get a segmentation fault when trying to build this image with docker on my machine

% docker-compose build forms-product-page
[+] Building 292.3s (19/20)                                                                                                                 docker:colima
 => [forms-product-page internal] load build definition from Dockerfile                                                                              0.0s
 => => transferring dockerfile: 1.75kB                                                                                                               0.0s
 => [forms-product-page internal] load .dockerignore                                                                                                 0.0s
 => => transferring context: 360B                                                                                                                    0.0s
 => [forms-product-page internal] load metadata for docker.io/library/ruby:3.3.0-alpine3.19@sha256:203b3087530e9cb117d8aab9b49bb766253fd8a6606a0d75  4.0s
 => [forms-product-page build  1/16] FROM docker.io/library/ruby:3.3.0-alpine3.19@sha256:203b3087530e9cb117d8aab9b49bb766253fd8a6606a0d7520a591c7a  37.7s
 => => resolve docker.io/library/ruby:3.3.0-alpine3.19@sha256:203b3087530e9cb117d8aab9b49bb766253fd8a6606a0d7520a591c7a3d992f7                       0.0s
 => => sha256:281d3abc84f91c3bb695753c827ae2e6ca7c68e0c7229e56a199f3013342e9c9 224B / 224B                                                           0.3s
 => => sha256:203b3087530e9cb117d8aab9b49bb766253fd8a6606a0d7520a591c7a3d992f7 1.65kB / 1.65kB                                                       0.0s
 => => sha256:5a4bd81d36284fd9a15eca9300b183c2d25062f6d7651e0857265464e3f62a36 1.36kB / 1.36kB                                                       0.0s
 => => sha256:d7589d1c98fa5f3409ac0472e861902be9a2f9856c57e1be11bc568c6fc9bb51 7.36kB / 7.36kB                                                       0.0s
 => => sha256:c303524923177661067f7eb378c3dd5277088c2676ebd1cd78e68397bb80fdbf 3.35MB / 3.35MB                                                       3.9s
 => => sha256:8febe9514bcbbd8570accd06c02a88cb13576a56f1088f7a3364e7ba9506802e 6.73MB / 6.73MB                                                       7.4s
 => => sha256:e0917ae451a278931096604c1a7aa8b0baedcdb96477fab34286f6a99fcebd0f 33.80MB / 33.80MB                                                    36.4s
 => => extracting sha256:c303524923177661067f7eb378c3dd5277088c2676ebd1cd78e68397bb80fdbf                                                            0.2s
 => => sha256:fd823cfc7a04fa1a814a273cfaadc8faf6a9018024e18b0f1a72a648ed023698 173B / 173B                                                           4.2s
 => => extracting sha256:8febe9514bcbbd8570accd06c02a88cb13576a56f1088f7a3364e7ba9506802e                                                            0.5s
 => => extracting sha256:281d3abc84f91c3bb695753c827ae2e6ca7c68e0c7229e56a199f3013342e9c9                                                            0.0s
 => => extracting sha256:e0917ae451a278931096604c1a7aa8b0baedcdb96477fab34286f6a99fcebd0f                                                            1.2s
 => => extracting sha256:fd823cfc7a04fa1a814a273cfaadc8faf6a9018024e18b0f1a72a648ed023698                                                            0.0s
 => [forms-product-page internal] load build context                                                                                                 0.1s
 => => transferring context: 724.04kB                                                                                                                0.1s
 => [forms-product-page build  2/16] WORKDIR /app                                                                                                    0.1s
 => [forms-product-page build  3/16] RUN apk update                                                                                                  3.3s
 => [forms-product-page build  4/16] RUN apk upgrade --available                                                                                     0.5s
 => [forms-product-page build  5/16] RUN apk add libc6-compat openssl-dev build-base libpq-dev nodejs=~20 npm git python3                          119.2s
 => [forms-product-page build  6/16] RUN adduser -D ruby                                                                                             0.2s
 => [forms-product-page build  7/16] RUN mkdir /node_modules && chown ruby:ruby -R /node_modules /app                                                0.3s
 => [forms-product-page build  8/16] COPY --chown=ruby:ruby Gemfile* ./                                                                              0.0s
 => [forms-product-page build  9/16] RUN gem install bundler -v 2.4.10                                                                               2.3s
 => [forms-product-page build 10/16] RUN bundle config set --local without development:test   && bundle config set --local jobs "$(nproc)"           0.3s
 => [forms-product-page build 11/16] RUN bundle install                                                                                            112.9s
 => [forms-product-page build 12/16] COPY --chown=ruby:ruby package.json package-lock.json ./                                                        0.1s
 => [forms-product-page build 13/16] RUN npm ci --ignore-scripts                                                                                    10.7s
 => [forms-product-page build 14/16] COPY --chown=ruby:ruby . .                                                                                      0.1s
 => ERROR [forms-product-page build 15/16] RUN SECRET_KEY_BASE=dummyvalue rails vite:build_all                                                       0.6s
------
 > [forms-product-page build 15/16] RUN SECRET_KEY_BASE=dummyvalue rails vite:build_all:
0.492 /usr/local/bundle/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb:14: [BUG] Segmentation fault at 0x0026ffff9a6affd0
0.492 ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [aarch64-linux-musl]

Comment on lines -276 to +278
nokogiri (1.15.5-aarch64-linux)
racc (~> 1.4)
nokogiri (1.15.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-linux)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
Copy link
Member

Choose a reason for hiding this comment

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

Do you happen to know why this has changed? Is this something to do with Ruby 3.3?

Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if this change is related to the segmentation faults I'm seeing... it feels like this change could result in bundler not installing the native gems for Nokogiri...

Copy link
Member

Choose a reason for hiding this comment

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

It looks like the Nokogiri native gems for version 1.15.5 don't support Ruby 3.3.0:

% curl https://rubygems.org/api/v1/versions/nokogiri.json | jq '.[] | select(.number == "1.15.5") | {platform, ruby_version}'
{
  "platform": "ruby",
  "ruby_version": ">= 2.7.0"
}
{
  "platform": "x86_64-linux",
  "ruby_version": ">= 2.7, < 3.3.dev"
}
{
  "platform": "x86_64-darwin",
  "ruby_version": ">= 2.7, < 3.3.dev"
}
{
  "platform": "x86-mingw32",
  "ruby_version": ">= 2.7, < 3.3.dev"
}
{
  "platform": "x86-linux",
  "ruby_version": ">= 2.7, < 3.3.dev"
}
{
  "platform": "x64-mingw32",
  "ruby_version": ">= 2.7, < 3.1.dev"
}
{
  "platform": "x64-mingw-ucrt",
  "ruby_version": ">= 3.1, < 3.3.dev"
}
{
  "platform": "java",
  "ruby_version": ">= 2.7.0"
}
{
  "platform": "arm64-darwin",
  "ruby_version": ">= 2.7, < 3.3.dev"
}
{
  "platform": "arm-linux",
  "ruby_version": ">= 2.7, < 3.3.dev"
}
{
  "platform": "aarch64-linux",
  "ruby_version": ">= 2.7, < 3.3.dev"
}

We might want to update Nokogiri to the latest version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The build docker image is passing in this PR but I didn't try to build it on my machine. Let me try running docker build . on my machine and see if I'm seeing the same errors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm getting the same error as you when i try build the images.

@lfdebrux
Copy link
Member

lfdebrux commented Jan 3, 2024

🤔 I get a segmentation fault when trying to build this image with docker on my machine

Looks like this is a known issue in Ruby 3.3.0 on linux-aarch64, see https://bugs.ruby-lang.org/issues/20085 Fiber.new{ }.resume causes Segmentation fault for Ruby 3.3.0 on aarch64-linux (via ruby-concurrency/concurrent-ruby#1023).

Fiber.new{ }.resume is a pretty fundamental operation, we'll see these segfaults when trying to run rails server or any Rails code, not just when running vite.

It looks like a fix is incoming for Ruby 3.3.1 though.

@aliuk2012
Copy link
Contributor Author

Closing this until ruby 3.3.1 is released

@aliuk2012 aliuk2012 closed this Jan 3, 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.

2 participants