nickjj / docker-rails-example

A production ready example Rails app that's using Docker and Docker Compose.
MIT License
941 stars 185 forks source link

Cable - Operation not permitted - bs_fetch:atomic_write_cache_file:chmod (Errno::EPERM) #1

Closed PabloC closed 3 years ago

PabloC commented 3 years ago

Hi Nick, first of all, thank you so much for sharing this excellent piece of code.

I am testing it, a fresh install, and during the build I'am getting an error in the Cable part of the docker-compose.

"Operation not permitted - bs_fetch:atomic_write_cache_file:chmod (Errno::EPERM)"

Captura de pantalla 2021-01-09 a las 4 52 51

Any idea on what is going on? I believe Cable is looking for a temporary directory but cannot find exactly which is and why can't be used.

nickjj commented 3 years ago

Hi,

I just freshly cloned this repo and upped everything but I don't see this error. What's the full stack trace?

Did you make any changes to the code, even something minor like doing a find / replace to swap the project name? Did the other services such as the web and worker start successfully?

Have you tried stopping the project and doing a run clean to clear your cache and other tmp files?

PabloC commented 3 years ago

Hi Nick, I did a run clean and now it is working great. Thank you so much for your fast help!

nickjj commented 3 years ago

The question now is what caused you to need to clean things manually.

Can you give an order of operations of what you did starting from cloning the repo to producing that error?

PabloC commented 3 years ago

I tried again in a new mac, and it's giving the same error the first time it stgarts.

this are the commands I used:

and the log output

https://pastebin.com/ctVJjG54

nickjj commented 3 years ago

It looks like it's happening on the web service too.

After the first upping, what is the output of running these commands from the root of the project:

PabloC commented 3 years ago

Sure, this is the output: https://pastebin.com/9xmXEEd4

to replicate it again, y removed the images and volumes and started again. And still happens.

/usr/local/bundle/gems/bootsnap-1.5.1/lib/bootsnap/compile_cache/iseq.rb:30:in `fetch': Operation not permitted - bs_fetch:atomic_write_cache_file:chmod (Errno::EPERM)

Using docker for Mac

Screenshot 2021-01-09 at 21 00 51

Maybe it's related to this bug: https://github.com/Shopify/bootsnap/issues/262

What about this? https://github.com/Shopify/bootsnap/issues/262#issuecomment-586552500

nickjj commented 3 years ago

Thanks, and what's the output of running id on your dev box?

Also for total clarity, everything works as long as you stop + clear + up everything as normal with docker-compose up? Do any of the file permissions change on your host OS after the 2nd up?

As for those issues it's not impossible, but I run Docker Desktop here on Windows with WSL 2 and I haven't seen it pop up. That would mean it could be specific to macOS which seems even more strange.

I wonder if it has to do with your user and group not being the same. In my dev env everything is owned by nick:nick with a uid:gid of 1000. The image is configured to run things without root.

Another possible thing to test would be to comment out all of the volume lines in the docker-compose.yml file related to the web, worker and cable services just to see if it's related to file permissions between the container and host.

PabloC commented 3 years ago

id on my dev box:

uid=501(pibefision) gid=20(staff) groups=20(staff),701(com.apple.sharepoint.group.2),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae)

The errors appears only on a cold docker-compose, just the first time. The second time I launch it does not appear. I've tested in two different macs.

nickjj commented 3 years ago

Is that a fresh install of macOS without doing anything out of the ordinary with your user / groups?

Is the 2nd launch tied into clearing the cache in between or can you launch it a 2nd time directly after the first and it works?

PabloC commented 3 years ago

fresh install.

2nd lauch without clearing anything.

nickjj commented 3 years ago

Thanks, what version of macOS are you using btw? That'll help anyone else who gets the same issue. Maybe I can call out the error in the docs until it's officially fixed by Bootsnap.

Also speaking of which, would you mind trying to do a first launch test again, but this time with Bootsnap disabled before you start everything up? You can goto config/boot.rb and comment out the require "bootsnap/setup" line to disable it quickly. If it works then we know for sure it's related to Bootsnap.

PabloC commented 3 years ago

Yes sir, after a clean install, I disabled Bootsnap with a comment in config/boot.rb and now works. It seems an issue related to Bootsnap.