Closed patmisch closed 3 years ago
Hi @patmisch,
/layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.0/lib/ffi/struct_layout_builder.rb:171:in
initialize': integer 4294967288 too big to convert to
int' (RangeError)
This looks like a problem with bigint vs. int from inside the ffi
gem
It appears you're running:
2.7.0
6.1.3
heroku run console
I'm curious why you're only running into this in your production env -- can you check your local ruby version to make sure it matches and see if you can reproduce the issue locally?
If that's not working can you try generating a new rails app that reproduces the issue when running the console on Heroku?
@dylanjha Thanks for the quick response.
Our local and production versions definitely do match. And no, I cannot reproduce this locally.
I went ahead and generated a fresh rails app and got the same error after adding the mux_ruby
gem.
FWIW we actually aren't on Heroku. Our app(s) run on Digital Ocean's App Platform, which utilizes heroku buildpacks. If it's helpful, I believe DO is using Kubernetes to power App Platform.
I'm going to experiment a little with installing mux_ruby
dependencies independently to see if we can pinpoint it a little better.
Edit: The dependency in question is obviously ffi, duh.
I went ahead and generated a fresh rails app and got the same error after adding the mux_ruby gem.
Can you share that application & instructions to reproduce?
Repo here: https://github.com/passageinc/mux_test
If you have access to a Digital Ocean account, you can utilize the "Deploy To DO" button provided in the readme.
From the App Platform dashboard, click the "Console" tab. You'll be able to run rails console
and see the resulting error.
https://github.com/passageinc/mux_test/tree/without-mux
Exact same repo, except on a branch that has mux_ruby
uninstalled. Repeat same steps and find rails console
working correctly.
I was able to repo -- thanks for that.
One thing to note is that the ffi gem installs with native extensions against the OS
[mux-test] [2021-07-13 21:26:32] Fetching ffi 1.15.3
[mux-test] [2021-07-13 21:26:33] Installing ffi 1.15.3 with native extensions
That explains why you couldn't repro the problem locally. It must be specific to the OS on the DO box (ubuntu of some sort, I imagine?) -- I couldn't tell from the deploy.template.yaml
1.15.3
is the latest version of ffi, so I'm not sure what else we can do with that dependency. I also saw this question in the DO forum so it looks like this isn't a totally isolated case. I have a feeling you're the one who commented there a few hours ago.
Next things I would try:
2.7.4
(or heck, even 3.0.2
). I think different ruby versions will change the way native extensions are installed, so that's worth a shotdeploy.template.yaml
, I'm unclear about how to go about that, but there must be a wayapt-get install
command you can run on the OS before running bundle install
(like apt-get install libffi-dev
, or something -- this is pretty common when there's a problem building native extensions). You might be able to specify something like this in the deploy.template.yaml
file.Could you also open up a support ticket with DO about this and see if they can help?
Digital Ocean was able to get to the bottom of this...
The problem wasn't actually with ffi
, that is just the furthest down the stack ruby is able to trace.
Turns out the issue was with the ethon
gem. Related to https://github.com/typhoeus/ethon/issues/182
I'm able to work around it by calling ulimit -n 65535
before executing rails console
After along a year, I am here, facing this issue on digitalocean, going to give the ulimit -n 65535
solution a try. thanks
After deploying our mux_ruby implementation I can no longer run
rails console
. Removing themux_ruby
gem resolves this, so I'm thinking it has something to do with this gem.Any ideas?
Here is the error output: