Skip to content

Improving exception handling for fcgi-program socket creation #1569

Closed
@0xbad0c0d3

Description

@0xbad0c0d3

How to reproduce

  1. Supervisord must already be started
  2. Add such a config:
[fcgi-program:test]
command=/bin/true
socket=tcp://0.0.0.0:8000
  1. start a program which listen to the port # socat tcp4-l:8000 stdio

  2. # supervisorctl update test

You'll see such an error in the supervisord console

2023-01-27 13:03:20,563 INFO Creating socket tcp://0.0.0.0:8000
2023-01-27 13:03:20,564 ERRO XML-RPC response callback error:Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/supervisor/xmlrpc.py", line 78, in more
    value = self.callback()
  File "/usr/local/lib/python3.10/site-packages/supervisor/rpcinterface.py", line 947, in allfunc
    callback = func(name, **extra_kwargs)
  File "/usr/local/lib/python3.10/site-packages/supervisor/rpcinterface.py", line 301, in startProcess
    process.spawn()
  File "/usr/local/lib/python3.10/site-packages/supervisor/process.py", line 717, in spawn
    self.before_spawn()
  File "/usr/local/lib/python3.10/site-packages/supervisor/process.py", line 711, in before_spawn
    self.fcgi_sock = self.group.socket_manager.get_socket()
  File "/usr/local/lib/python3.10/site-packages/supervisor/socket_manager.py", line 74, in get_socket
    self.ref_ctr.increment()
  File "/usr/local/lib/python3.10/site-packages/supervisor/socket_manager.py", line 36, in increment
    self.on_non_zero()
  File "/usr/local/lib/python3.10/site-packages/supervisor/socket_manager.py", line 90, in _prepare_socket
    self.socket = self.socket_config.create_and_bind()
  File "/usr/local/lib/python3.10/site-packages/supervisor/datatypes.py", line 210, in create_and_bind
    sock.bind(self.addr())
OSError: [Errno 98] Address in use

as a result supervisord would not even add the program, and no status would be shown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions