Skip to content

Conversation

alto-ruby
Copy link
Contributor

@alto-ruby alto-ruby commented May 11, 2023

This adds pre-built library for aarch64 linux, will help improve the install speed and avoid building environment issues at customer side.

@apolcyn @jtattermusch Can you help build and push the new rake compiler image?
Will update the tag and hash after the image is available

Manually tested locally:

uname -a
Linux u20 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
time gem install /work/ruby/grpc/pkg/grpc-1.56.0.dev-aarch64-linux.gem
Successfully installed grpc-1.56.0.dev-aarch64-linux
Parsing documentation for grpc-1.56.0.dev-aarch64-linux
Installing ri documentation for grpc-1.56.0.dev-aarch64-linux
Done installing documentation for grpc after 0 seconds
1 gem installed

real	0m22.794s
user	0m17.268s
sys	0m5.156s
ruby greeter_server.rb &
[1] 319
ruby greeter_client.rb
"Greeting: Hello world"

Fixes: #31855
Fixes: #29489
Fixes: #26391

@alto-ruby alto-ruby marked this pull request as ready for review May 11, 2023 15:21
@alto-ruby alto-ruby requested review from apolcyn and jtattermusch May 11, 2023 15:21
@apolcyn
Copy link
Contributor

apolcyn commented May 11, 2023

@alto-ruby I pushed the new docker image.

FWIW, the script for pushing the digest editing the current version file to look like this:

$ git diff
diff --git a/third_party/rake-compiler-dock/rake_aarch64-linux.current_version b/third_party/rake-compiler-dock/rake_aarch64-linux.current_version
index be764326f6..275239c016 100644
--- a/third_party/rake-compiler-dock/rake_aarch64-linux.current_version
+++ b/third_party/rake-compiler-dock/rake_aarch64-linux.current_version
@@ -1 +1 @@
-us-docker.pkg.dev/grpc-testing/testing-images-public/rake_aarch64-linux
\ No newline at end of file
+us-docker.pkg.dev/grpc-testing/testing-images-public/rake_aarch64-linux:fa2ee912553de5564f1255b780fd369698b3e06d@sha256:44bbc8244475b09e9ef07306176c01b972b8318a746e8f3f3e7a69d5a05fde1f
\ No newline at end of file

@yijiem yijiem assigned apolcyn and unassigned yijiem May 11, 2023
@alto-ruby
Copy link
Contributor Author

Using the provided image and sha256 give me the following error:

docker: Error response from daemon: manifest for us-docker.pkg.dev/grpc-testing/testing-images-public/rake_aarch64-linux@sha256:44bbc8244475b09e9ef07306176c01b972b8318a746e8f3f3e7a69d5a05fde1f not found: manifest unknown: Requested entity was not found.

I can pull the image but docker inspect outputs a different hash

docker inspect --format='{{index .RepoDigests 0}}' us-docker.pkg.dev/grpc-testing/testing-images-public/rake_aarch64-linux:fa2ee912553de5564f1255b780fd369698b3e06d
us-docker.pkg.dev/grpc-testing/testing-images-public/rake_aarch64-linux@sha256:61a46ab67972990aea77024817d29ca6fa43d2639fe4aaef9c30e031f84519a9

I replaced the hash in another commit and the distribution test passes. (Portability Tests Windows failure is unrelated)

@apolcyn can you double confirm the sha265 I should use?

@apolcyn
Copy link
Contributor

apolcyn commented May 16, 2023

@alto-ruby the tag and sha256 that you have here matches what I see in the published image.

I'm not sure why my run of the script gave a different output, but I think that was wrong and what you have here seems to be right.

@alto-ruby alto-ruby requested a review from HannahShiSFB May 28, 2023 16:00
@alto-ruby alto-ruby added the release notes: no Indicates if PR should not be in release notes label May 28, 2023
@alto-ruby alto-ruby enabled auto-merge (squash) May 28, 2023 16:00
@alto-ruby
Copy link
Contributor Author

tested with built aarch64 linux gem, gcs link

$ uname -a
Linux u20 5.15.49-linuxkit-pr #1 SMP PREEMPT Thu May 25 07:27:39 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
$ gem install ~/test_result_public_prod_grpc_core_pull_request_linux_grpc_distribtests_ruby_19592_20230624-194702_github_grpc_artifacts_grpc-1.57.0.dev-aarch64-linux.gem
Successfully installed grpc-1.57.0.dev-aarch64-linux
Parsing documentation for grpc-1.57.0.dev-aarch64-linux
Installing ri documentation for grpc-1.57.0.dev-aarch64-linux
Done installing documentation for grpc after 0 seconds
1 gem installed
$ gem list | grep grpc
grpc (1.57.0.dev aarch64-linux)
$ ruby greeter_server.rb &
[1] 523
$ ruby greeter_client.rb test-ruby-aarch64-linux
"Greeting: Hello test-ruby-aarch64-linux"

@alto-ruby alto-ruby merged commit 059144a into grpc:master Jun 25, 2023
@jsoref
Copy link

jsoref commented Jun 26, 2023

This merge resulted in #33549 and similar PRs to any PRs created after it was merged.

@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Jun 26, 2023
@markdroth
Copy link
Member

I'm going to get #33546 merged to fix the problem this caused.

mario-vimal pushed a commit to mario-vimal/grpc that referenced this pull request Jul 13, 2023
This adds pre-built library for aarch64 linux, will help improve the
install speed and avoid building environment issues at customer side.

@apolcyn @jtattermusch Can you help build and push the new rake compiler
image?
Will update the tag and hash after the image is available

Manually tested locally:
```
uname -a
Linux u20 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
```
```
time gem install /work/ruby/grpc/pkg/grpc-1.56.0.dev-aarch64-linux.gem
Successfully installed grpc-1.56.0.dev-aarch64-linux
Parsing documentation for grpc-1.56.0.dev-aarch64-linux
Installing ri documentation for grpc-1.56.0.dev-aarch64-linux
Done installing documentation for grpc after 0 seconds
1 gem installed

real	0m22.794s
user	0m17.268s
sys	0m5.156s
```
```
ruby greeter_server.rb &
[1] 319
ruby greeter_client.rb
"Greeting: Hello world"
```

Fixes:
grpc#31855
grpc#29489
@chadlwilson
Copy link
Contributor

chadlwilson commented Aug 9, 2023

Can anyone shed light on what happened to this as to grpc releases? 1.57.0 has just been released but this doesn’t seem to have made it in. (no platform specific binaries at https://rubygems.org/gems/grpc/versions )

Did it get partially reverted (or release held off) somewhere along the line which I have missed?

@jsoref
Copy link

jsoref commented Aug 9, 2023

I can't tell how it's published in general, I don't see a workflow doing it, is it possible there's a human responsible for it?

@chadlwilson
Copy link
Contributor

Yeah, I am not sure.

I've been also trying to work out what happened to the arm64-darwin gems too. Also stuck at the same mystery (code seems to build them, tests seem to run against them, but cant find where it is decided which archs/platforms are gem pushed, and whether there is somewhere else that this process is managed).

I also note someone has asked something similar on the dev list: https://groups.google.com/g/grpc-io/c/HfNJnEwEijY

@alto-ruby
Copy link
Contributor Author

There are some manual steps publishing the built gems to rubygems.org.

@apolcyn I have verified arm artifacts from #34008 works on arm MacOS and Linux, it's safe to publish them.

@chadlwilson
Copy link
Contributor

Thanks @alto-ruby .

Perhaps worth noting that based on #25992 (comment) there may still be some challenges with the signatures for arm64-darwin.

Haven't yet tested myself just yet.

But that's great news for aarch64-linux, all the same!

@alto-ruby
Copy link
Contributor Author

alto-ruby commented Aug 9, 2023

@chadlwilson

Signature issue should have been resolved with #33641 where we removed the manual strip step.

It would be great if you can double test the artifacts in the above comment.

@alevalentz
Copy link

Hi everyone, is there any eta for when the aarch64-linux binaries will be published? Or will they be release only from version 1.58?

@chadlwilson
Copy link
Contributor

I'm not sure if anyone is waiting on volunteers to sanity test, but I personally have not had a chance to sanity test the gems shared earlier, but perhaps if you have a chance @alevalentz that might help the collective effort :-)

@Don-CA
Copy link

Don-CA commented Aug 23, 2023

When running the aarch-64 binary on Fargate ARM64 I'm seeing a segfault

/usr/local/bundle/gems/grpc-1.57.0-aarch64-linux/src/ruby/lib/grpc/generic/active_call.rb:373: [BUG] Segmentation fault at 0x000000000009f900
--
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [aarch64-linux-musl]
-- Control frame information -----------------------------------------------
c:0055 p:---- s:0372 e:000371 CFUNC  :run_batch
c:0054 p:0052 s:0367 e:000366 METHOD /usr/local/bundle/gems/grpc-1.57.0-aarch64-linux/src/ruby/lib/grpc/generic/active_call.rb:373

@chadlwilson
Copy link
Contributor

@Don-CA I wonder if it is reasonable to expect these to work on aarch64-linux-musl. That seems another platform on its own possibly?

Does the same happen with a non-Alpine container?

@alto-ruby
Copy link
Contributor Author

alto-ruby commented Aug 25, 2023

There is #34044 crashes with Alpine as well but x86_64-linux-musl maybe related.

@Don-CA
Can you provide more details on how to reproduce this?
Are you using the pre-built aarch64-linux binary or build from source?

@alto-ruby
Copy link
Contributor Author

@Don-CA

Confirmed this is the same issue as #34044 and will be fixed with #34177
You can set LD_PRELOAD=/lib/libgcompat.so.0 as a workaround before the fix released.

@chadlwilson
Copy link
Contributor

For what it's worth @alto-ruby - I did a basic sanity test using the gems from 1.58.0.dev here.

They installed and seemed to work perfectly fine for me on both aarch64 linux and MacOS.

Linux

  • aarch64 CentOS Stream 9 container
  • ruby 3.2.2 (2023-03-30 revision e51014f9c0) [aarch64-linux]
  • running a basic smoke test through gauge-ruby 0.7.0 (the Ruby plugin for Gauge)

Darwin/MacOS

  • arm64 MacOS 13.5.2 Venture M1 machine
  • ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
  • running a basic smoke test through gauge-ruby 0.7.0 (the Ruby plugin for Gauge)

@chadlwilson
Copy link
Contributor

chadlwilson commented Sep 26, 2023

@alto-ruby is there any other help needed here? How do we best get some Googler help to get the linux and darwin Gem variants pushed to Rubygems, either for 1.58.0 or the next release?

Should I/we perhaps open a specific issue to get these released, and link to the earlier closed Github issues/PRs for your work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloat/none imported Specifies if the PR has been imported to the internal repository lang/ruby per-call-memory/neutral per-channel-memory/neutral release notes: no Indicates if PR should not be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gRPC gem can't be built on aarch64 system gem install grpc:1.45.0 takes lot of time to complete Provide a ruby native gem for aarch64 linux