-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[Ruby] build: make exported symbol files platform-specific #31970
Conversation
@apolcyn looks good to me! |
@@ -1,2 +1 @@ | |||
_Init_grpc_c | |||
_rb_tr_abi_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem correct as it will break the gem on TruffleRuby if I read the PR correctly. TruffleRuby has rb_tr_abi_version before RUBY_VERSION 3.2, specifically it's 3.0 in the 22.3 release currently for TruffleRuby and it already had it before that. We can consider TruffleRuby always had this symbol, versions before are not supported anymore.
IMHO #31151 is much safer, future proof and a lot simpler. A 1MB increase for the existing 23MB precompiled gem seems minor. |
I agree with @eregon. There isn't really much benefits to stripping symbols (I don't think most users of the gem are too worried about the binary size) and having different behaviour depending on the Ruby version will make it difficult to maintain, especially if CI doesn't test the different Ruby versions. |
I agree with @eregon and @peterzhu2118 |
I've opened #31995 to try to unbreak TruffleRuby.
I agree that #31151 is simpler, but the actual package size for pre-compiled gems will be multiplied by the ~4 supported ruby versions of each gem (there's a separate native library for each ruby version). I.e., total size increase should be closer to ~4MB. Overall, I agree that the size increase in itself is probably not too bad. But I also don't think that these export files add too much complexity at the moment. I'm open to revisit this down the road if we find more problems stemming from these, but I'd prefer to avoid a size regression for now if it's easy enough. For example, one option is to remove symbol-stripping only from TruffleRuby.
We do have tests for to-be-published gems that they'll work on each supported ruby version. We'll add such tests for 3.2 as a part of adding 3.2 support. I'm also adding some better test coverage for different ruby versions in #31991. I don't know of data to side one way or the other, and a size increase will naturally affect downloads, storage, etc., so I'd just like to err on the side of caution here if it's easy enough. There's some evidence that package size is an issue for users in #28627. |
@apolcyn @eregon It seems that |
Submitted #31997 to fix this. |
Thank you.
I think it's getting significant in complexity and the perfect example is #31970 (comment) i.e. yet another brittle check which might change in the future (e.g. I'm not sure why CRuby doesn't include the symbol on releases, it feels like it should be safer and detect bad gem homes, it might change).
That's a different order of magnitude (13.8 MB vs 1018MB), that issue is about size and experience if compiled from source IIUC, a couple MB extra is not a big deal compared to 1GB. |
FYI I've filed https://bugs.ruby-lang.org/issues/19289 on the Ruby side to see how we could improve things related to |
This is an alternative to #31151, and should fix #30976.
The idea of this PR is to use separate export files depending on whether or not we expect
ruby_abi_version
to be defined (i.e. depending on whether or not we're using ruby 3.2+).I lean towards this PR over #31151 because it maintains the current symbol-stripping behavior:
Mainly, it looks like #31151 will cause a size increase of an uncompressed
grpc_c.so
file on linux from ~8MB to ~11MB due to the extra symbols. Compressed size correspondingly increases from ~3MB to ~4MB.The latest pre-compiled linux gem,
grpc-1.50.0-x86_64-linux.gem
, is ~21MB. So the size increase might be noticeable.cc @peterzhu2118