Skip to content
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

File Watchers in Docker on M1 - rb-inotify #89

Closed
tripptuttle opened this issue May 10, 2022 · 3 comments
Closed

File Watchers in Docker on M1 - rb-inotify #89

tripptuttle opened this issue May 10, 2022 · 3 comments
Labels
bug Something isn't working needs investigation Requires some exploratory work or research before it can be started on

Comments

@tripptuttle
Copy link

tripptuttle commented May 10, 2022

When Lookbook and dependencies are installed, causes issue with worker termination and prevents server from responding.

Our team thinks this might be related to known issue with Docker inside a VM (Rancher) on M1 Macs not working with ActiveSupport::EventedFileUpdateChecker. We typically use ActiveSupport::FileUpdateChecker.

I'm not knowledgeable enough to understand exactly how Lookbook implements file watchers, but thought sharing the issue would be useful, as I'm sure others may encounter this as ARM platforms are becoming more popular.

Workaround

Removing Lookbook or setting config.lookbook.listen = false resolves issue but prevents live reloading.

Stack

  • Ruby 3.1.0
  • Rails 7.0.2 with Puma
  • Docker base image bitnami/ruby:3.1 built with linux/x86_64 arch (to work with Oracle Instant Client)
  • Rancher Desktop VM
  • Apple ARM M1

Docker

sps-ui-server-1  | [11] + Gemfile in context: /opt/app-root/src/Gemfile
sps-ui-server-1  | [11] ! Unable to start worker
sps-ui-server-1  | [11] /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:69:in `initialize'
sps-ui-server-1  | [11] Early termination of worker

Trace

/opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:69:in `initialize': Function not implemented - Failed to initialize inotify (Errno::ENOSYS)
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/adapter/linux.rb:29:in `new'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/adapter/linux.rb:29:in `_configure'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/adapter/base.rb:47:in `block in configure'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/adapter/base.rb:42:in `each'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/adapter/base.rb:42:in `configure'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/adapter/base.rb:66:in `start'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/forwardable.rb:238:in `start'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/listener.rb:71:in `block in <class:Listener>'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/fsm.rb:124:in `instance_eval'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/fsm.rb:124:in `call'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/fsm.rb:105:in `transition_with_callbacks!'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/fsm.rb:72:in `transition'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/listen-3.7.1/lib/listen/listener.rb:92:in `start'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/lookbook-0.8.1/lib/lookbook/engine.rb:95:in `block in <class:Engine>'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/lazy_load_hooks.rb:79:in `block in execute_hook'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/lazy_load_hooks.rb:72:in `with_execution_control'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/lazy_load_hooks.rb:77:in `execute_hook'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/lazy_load_hooks.rb:63:in `block in run_load_hooks'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/lazy_load_hooks.rb:62:in `each'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/lazy_load_hooks.rb:62:in `run_load_hooks'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/application/finisher.rb:87:in `block in <module:Finisher>'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/initializable.rb:32:in `instance_exec'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/initializable.rb:32:in `run'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:347:in `each'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:347:in `call'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
    from /opt/bitnami/ruby/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/initializable.rb:60:in `run_initializers'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/application.rb:372:in `initialize!'
    from /opt/app-root/src/config/environment.rb:5:in `<main>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:36:in `start'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:143:in `block in perform'
    from <internal:kernel>:90:in `tap'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:134:in `perform'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/command/base.rb:87:in `perform'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/command.rb:48:in `invoke'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands.rb:18:in `<main>'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /opt/bitnami/ruby/lib/ruby/gems/3.1.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from bin/rails:4:in `<main>'
@allmarkedup
Copy link
Collaborator

Hey @tripptuttle - thanks for the report! I don't use Docker myself so I've not run into this.

Lookbook uses Listen under the hood to handle the file watching, it doesn't implement anything directly. I've had a poke about and there is a (closed) issue that may be related: guard/listen#539 - they suggest trying to manually update rb-fsevent gem (bundle update rb-fsevent) although I have no idea if that will help you at all.

I'll have a bit more of a dig into Listen and see if there is anything else I can do to mitigate it at the Lookbook end. To be honest I was aware of ActiveSupport::FileUpdateChecker and as it's really a very simple use-case it might well be better just to switch to that and save an extra dependency.

Appreciate the detailed info and I'll post an update here as and when I have anything more to share.

@allmarkedup allmarkedup added the needs investigation Requires some exploratory work or research before it can be started on label Jun 13, 2022
@allmarkedup allmarkedup added the bug Something isn't working label Sep 3, 2022
@allmarkedup
Copy link
Collaborator

Hey @tripptuttle I just wanted to check in to see if this is still an issue for you? I've not been able to replicate this and as there hasn't been any other activity on this issue for a while I'm going to close it down in a day or two, unless you confirm you are still having problems. Thanks!

@allmarkedup
Copy link
Collaborator

@tripptuttle i'm going to close this issue down now, if you are still having issues please feel free to comment and open it back up again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation Requires some exploratory work or research before it can be started on
Projects
None yet
Development

No branches or pull requests

2 participants