Trying to launch thumbor with a unix socket ends with "No such device or address"
See original GitHub issueHi,
I’m trying to make thumbor listen to an Unix socket instead of port (and to automate this via systemd but that’s another story).
$ ls -al /run/thumbor/
total 0
drwxr-xr-x 2 root root 60 Feb 23 15:51 .
drwxr-xr-x 27 root root 880 Feb 23 15:18 ..
srw-rw-rw- 1 thumbor www-data 0 Feb 23 15:18 thumbor.sock
$ sudo -u thumbor /usr/local/bin/thumbor --fd /run/thumbor/thumbor.sock
Traceback (most recent call last):
File "/usr/local/bin/thumbor", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/thumbor/server.py", line 147, in main
server = run_server(application, context)
File "/usr/local/lib/python2.7/dist-packages/thumbor/server.py", line 118, in run_server
with open(context.server.fd, 'r') as sock:
IOError: [Errno 6] No such device or address: '/run/thumbor/thumbor.sock'
A simple /usr/local/bin/thumbor --fd /run/thumbor/thumbor.sock
ends the same, so I don’t think it’s a permission problem.
Expected behaviour
The --fd
option is announced to accept either a file descriptor or a path but it seems paths are not handled correctly.
I tried to use a simple file instead of a socket and ended with a “Bad file descriptor” error so I suppose the file has to be a socket. The /run/thumbor/thumbor.sock
in my example has been created by systemd so I bet it’s a valid Unix socket that should be supported out of the box.
I can see a similar problems have been reported in the past but I can’t use the same workaround as I’m not using Supervisor and the file descriptor for my socket will neither be 0 nor be predictible.
Am I missing something?
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (12 by maintainers)
I opened an issue in tornadoweb/tornado to ask for more details but also discovered that
bind_unix_socket
already accepts amode
parameter. The default value is0o600
but do you think it can be changed via a command line option?This way, even if Tornado keeps on rebuilding sockets on startup, with more open permissions thumbor can be runned with a dedicated user instead of the same user as the frontend web server.
I think that would be a good idea!