-
Notifications
You must be signed in to change notification settings - Fork 186
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
The grpc gem does not work yet at runtime (it installs fine) #2247
Comments
I have a different scenario that leads to the same stacktrace, involving only Sulong, not TruffleRuby. I have provided a gist showing a Dockerfile to reproduce the issue (files copied into the image were obtained from their official release page) https://gist.github.com/jeshan/6c70fd0b94b6e521a54b6c71454ebd4c/revisions The gist v1 is based on the official ruby docker image and v2 shows my changes that reproduce the issue. |
It's |
@jeshan Please create a separate issue at https://github.com/oracle/graal, I'd like to focus this one on getting grpc to load on TruffleRuby. I digged into this some time ago with @norswap.
The error comes from a vendored version of With that PR:
I have a fix for that one, I'll try to merge it to Sulong. |
With that fix, this happens:
I think this Most likely related to https://github.com/grpc/grpc/blob/4dc84aea46396cde21d13813efcf8ca3b2fda692/src/core/lib/iomgr/exec_ctx.h#L254 In any case, |
I've moved my comment to the separate Sulong issue just mentioned. |
That's now fixed in oracle/graal@9d139ce. |
Hello, we were able to diagnose the issue in Sulong. Basically the missing symbol is an external weak symbol that's not defined, it was something we didn't support before, but I will fix that now, so it'll be supported. I'll try to get a PR in soon. |
The PR for this particular issue has been created, and is in the process of being reviewed and merged. However, there is another issue with grpc gem regarding pthread. And I'm also working towards a fix for that as well. |
The external weak symbol issue is fixed in oracle/graal@1ddc1c2, and I'm updating the graal import to pick that fix. There is another issue with |
Related: recent grpc/google-protobuf need WeakMap to support primitives (#2267) which is now fixed. |
Trying it the examples today on Linux, I get:
The first error might be solved by adopting Truffle safepoints, I'm not sure though. The second error comes from Sulong, that node seems to need some extra specializations. |
With branch https://github.com/eregon/grpc/tree/truffleruby-debug which has a couple workarounds, |
New PR for grpc, cleaned up and rebased on latest grpc: grpc/grpc#27660 |
The PR to support building the grpc gem on TruffleRuby has been merged. |
https://github.com/cookpad/grpc_kit seems a possible alternative to the grpc gem. The test suite also passes, except for 6 failures which are kwargs-related and also happen on CRuby 3.0.3 and one extra failure which is an easy fix:
|
…thod (#2247) PullRequest: truffleruby/3466
FWIW httpx also ships with a grpc plugin which has been successfully testing against truffleruby for quite a while. It's probably the closest to pure ruby (grpc_kit uses dr9 for http2 parsing, which uses C extensions and nghttp2, last time I checked). Both have very fringe communities and usage, IME. The grpc gem has much bigger community of users, and has codegen capabilities which none of the alternatives can match (GRPC service definitions, all of them can codegen protobufs). Truffleruby should probably ensure compatibility with it, for adoption sake. |
Thanks for the context. grpc seems hard to get working because it's a huge amount of rather messy C++/C code (which notably uses reflection with We might be able to run some part on Sulong and some part natively but that would likely need build system changes in grpc, some help from grpc maintainers and the grpc Ruby maintainers seem overall not so responsive (typically it takes months to merge PRs). Hence I am exploring lighter-weight other options, and I've heard multiple companies sharing similar concerns for the |
@eregon we're also trying to evaluate truffleruby in production and have hit grpc stumbling block #2697 which we need for development as many of our devs work on M1 macs, but this now seems blocked by oracle/graal#4726 which sounds equally as difficult to workaround. We're forced to use grpc gem because of https://github.com/googleapis/ruby-spanner-activerecord which we experimented with but found Spanner to be dissapointing vs Postgres, so once Google AlloyDB is GA we'll use that and drop Spanner/grpc and be unblocked to try truffleruby again. All that said, I imagine grpc for all its problems pushes a lot of boundaries for Truffleruby that other gems may also face and making it work now will fix compatibility also for a number of other gems you haven't yet come across. Assuming your goal is still to be MRI compliant :) Either way, we're trying to make this work. Also delighted @HoneyryderChuck to hear HTTPX supports truffleruby, we're big fans of your work and use it exclusively in our app. |
Right, there are quite a few gems depending on
Actually no, it's literally dozens of complicated fixes which seem to be needed only for Thank you for the feedback, I'll try to get oracle/graal#4726 prioritized and we'll keep looking how we can support the |
Summary by @eregon:
The grpc gem should install fine.
On macOS you might need truffleruby-dev.
At runtime,
require 'grpc'
works on Linux.Using GRPC functionality does not work yet in general.
Requiring the
grpc
gem causes an Invalid ElementType of Vector failure. This is affecting thestorefront-renderer
repository's use ofrequire "semian/grpc"
.How to reproduce
Stacktrace
The below issue is resolved by grpc/grpc#24632, but grpc did not merge that PR yet.
As chatted about in our call, it seems like a C language feature that Sulong doesn't support.
Issue about compiling/installing grpc: #1982
General internal issue about grpc: GR-23874
The text was updated successfully, but these errors were encountered: