stefansundin / rssbox

:newspaper: I consume the world via RSS feeds, and this is my attempt to keep it that way.
https://github.com/stefansundin/rssbox/discussions/64
GNU Affero General Public License v3.0
774 stars 73 forks source link

Runtime issue on Synology #67

Closed jeremymeyers closed 1 year ago

jeremymeyers commented 1 year ago

When trying to run the Docker version, it throws the following error:

rssbox
date,stream,content
2023-02-25 15:21:22,stdout, from /usr/local/ruby/bin/bundle:25:in `<main>'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/bin/bundle:25:in `load'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.3/exe/bundle:33:in `<top (required)>'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.3/exe/bundle:45:in `block in <top required)>'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:28:in `start'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:491:in `exec'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/bin/puma:25:in `<top (required)>'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/bin/puma:25:in `load'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.0.2/bin/puma:10:in `<top (required)>'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.0.2/lib/puma/cli.rb:75:in `run'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.0.2/lib/puma/launcher.rb:186:in `run'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.0.2/lib/puma/single.rb:44:in `run'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.0.2/lib/puma/runner.rb:158:in `load_and_bind'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.0.2/lib/puma/configuration.rb:286:in `app'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.0.2/lib/puma/configuration.rb:364:in `load_rackup'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.5/lib/rack/builder.rb:66:in `parse_file'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.5/lib/rack/builder.rb:105:in `load_file'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.5/lib/rack/builder.rb:116:in `new_from_string'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/rack-2.2.5/lib/rack/builder.rb:116:in `eval'
2023-02-25 15:21:22,stdout, from config.ru:3:in `block in <main>'
2023-02-25 15:21:22,stdout, from config.ru:3:in `require'
2023-02-25 15:21:22,stdout, from /app/app.rb:4:in `<top (required)>'
2023-02-25 15:21:22,stdout, from /app/app.rb:4:in `require'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra.rb:3:in `<top (required)>'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra.rb:3:in `require'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra/main.rb:3:in `<top (required)>'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra/main.rb:28:in `<module:Sinatra>'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra/main.rb:28:in `require'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra/base.rb:20:in `<top (required)>'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra/base.rb:908:in `<module:Sinatra>'
2023-02-25 15:21:22,stdout, from /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra/base.rb:1840:in `<class:Base>'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/3.2.0/random/formatter.rb:94:in `hex'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/3.2.0/random/formatter.rb:74:in `random_bytes'
2023-02-25 15:21:22,stdout, from /usr/local/ruby/lib/ruby/3.2.0/securerandom.rb:55:in `gen_random_openssl'
2023-02-25 15:21:22,stdout,/usr/local/ruby/lib/ruby/3.2.0/securerandom.rb:55:in `urandom': failed to get urandom (RuntimeError)
2023-02-25 15:21:22,stdout,bundler: failed to load command: puma (/app/vendor/bundle/ruby/3.2.0/bin/puma)
2023-02-25 15:21:22,stdout,! Unable to load application: RuntimeError: failed to get urandom
2023-02-25 15:21:21,stdout,*          PID: 6
2023-02-25 15:21:21,stdout,*  Environment: production
2023-02-25 15:21:21,stdout,*  Max threads: 5
2023-02-25 15:21:21,stdout,*  Min threads: 0
2023-02-25 15:21:21,stdout,* Puma version: 6.0.2 (ruby 3.2.0-p0) ("Sunflower")
2023-02-25 15:21:21,stdout,Puma starting in single mode...
2023-02-25 15:21:14,stdout,http://localhost:3000/
stefansundin commented 1 year ago

Hello,

Thanks for reporting. It looks like your device is missing urandom which sinatra tries to use. I filed a PR with sinatra that might fix it: https://github.com/sinatra/sinatra/pull/1888

I also prepared a special docker image for you which has the fix from that PR. It would be great if you could try it just to see if there are any other problems (maybe there are other gems that try to use urandom). If it works then you (or I) can report the success in the PR, which should hopefully make them merge the fix faster.

The fixed image is under the missing-urandom-fix tag. So the full image name is stefansundin/rssbox:missing-urandom-fix. Please give it a try and let me know if it works or if you get another error. :)

Thanks!


I added this to the Dockerfile to make it patch the file during the build after running bundle install:

RUN sed -i '1841s/$/, RuntimeError/' /app/vendor/bundle/ruby/3.2.0/gems/sinatra-3.0.5/lib/sinatra/base.rb
stefansundin commented 1 year ago

Also, could you please let us know exactly what Synology model you are using? And if possible what version of the Linux kernel it is using?

jeremymeyers commented 1 year ago

hey! Synology DSM7 runs linux kernel 4.4.180.

Happy to try any custom images/dockerfiles (tho might not get to it today)

jeremymeyers commented 1 year ago

its a DS216+II

stefansundin commented 1 year ago

They already merged the fix but I will have to wait for them to release a new version of sinatra before I can include it. In the mean time the special image I prepared should hopefully work. But it is conceivable that some other part of the app could be broken for the same reason, so it would be great if you could test the image at some point so we can confirm that. There's no rush, so please don't feel like you have to get to it any time soon.

I'll keep this issue open until we've confirmed that no other part of the app has the same problem, and until there's a fixed sinatra version. At that point I'll also delete the temporary docker image.

jeremymeyers commented 1 year ago

Will do. Maybe an opportunity to put in some checks in the Dockerfile to make sure requirements are met before install?

jeremymeyers commented 1 year ago

Hey, just ran the new image and it launches just fine. Looks like the missing dependency was the issue. Thanks for addressing! (now if only soundcloud would start giving out dev tokens again...sigh.

dentarg commented 1 year ago

The fix https://github.com/sinatra/sinatra/pull/1888 was released in Sinatra 3.0.6.

stefansundin commented 1 year ago

I've upgraded sinatra and pushed a new docker image so this issue should be resolved now.