Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.53k stars 1.25k forks source link

Fix crash when fcgi-program socket is already bound #1568

Open 0xbad0c0d3 opened 1 year ago

0xbad0c0d3 commented 1 year ago

fixes issue #1567

mnaberez commented 1 year ago

Description from #1567:

How to reproduce

example program config:

[fcgi-program:test]
command=/bin/true
socket=tcp://0.0.0.0:8000

# socat tcp4-l:8000 stdio

# supervisord -n 
2023-01-27 12:49:46,946 INFO Set uid to user 11 succeeded
2023-01-27 12:49:46,947 INFO Creating socket tcp://0.0.0.0:8000
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/supervisor/process.py", line 839, in __init__
    self.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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/supervisord", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/supervisor/supervisord.py", line 361, in main
    go(options)
  File "/usr/local/lib/python3.10/site-packages/supervisor/supervisord.py", line 371, in go
    d.main()
  File "/usr/local/lib/python3.10/site-packages/supervisor/supervisord.py", line 78, in main
    self.run()
  File "/usr/local/lib/python3.10/site-packages/supervisor/supervisord.py", line 86, in run
    self.add_process_group(config)
  File "/usr/local/lib/python3.10/site-packages/supervisor/supervisord.py", line 119, in add_process_group
    self.process_groups[name] = config.make_group()
  File "/usr/local/lib/python3.10/site-packages/supervisor/options.py", line 2046, in make_group
    return FastCGIProcessGroup(self)
  File "/usr/local/lib/python3.10/site-packages/supervisor/process.py", line 841, in __init__
    raise ValueError(
ValueError: Could not create FastCGI socket tcp://0.0.0.0:8000: [Errno 98] Address in use
# 
val-melev commented 6 months ago

Hi, is there any plans to merge & release this? Would be very helpful to lots of people, I'm sure!