question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to launch thumbor with a unix socket ends with "No such device or address"

See original GitHub issue

Hi,

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:closed
  • Created 4 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
gael-iancommented, Mar 9, 2020

I opened an issue in tornadoweb/tornado to ask for more details but also discovered that bind_unix_socket already accepts a mode parameter. The default value is 0o600 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.

1reaction
heynemanncommented, Mar 9, 2020

I think that would be a good idea!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calling open() on a Unix domain socket failed with error "No ...
So the error code is ENXIO whose corresponding error message is No such device or address . Bash is just calling standard C...
Read more >
cat: /tmp/st.socket No such device or address - Super User
1 Answer 1 ... You (via cat ) are trying to open and read a UNIX domain socket and that is not how...
Read more >
Who's got the other end of this unix socketpair?
Basically, I can see the two sockets, and everything about them, but cannot tell that they are connected. I am trying to determine...
Read more >
Introduction to Computer Information Systems/Print version
Application software are the programs and applications that are developed to carry out desired functions by the user. The way an application works...
Read more >
Oracle® Server X6-2 Service Manual
and modifications of such programs) and Oracle computer documentation or other Oracle ... UNIX is a registered trademark of The Open Group.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found