Search code examples
openstackopenstack-swift

OpenStack Swift: PID files don't correspond to running processes' PIDs; can't restart services - port already bound


I am running a Docker container with Swift ("Swift all-in-one") on a CentOS 7 host. I noticed that the PIDs in /var/run/swift/*.pid files differ from the actual PIDs running in the system:

root@5293f4890016:/var/run/swift# for pidfile in `ls`; do echo $pidfile: `cat $pidfile`; done
account-auditor.pid: 219
account-reaper.pid: 285
account-replicator.pid: 291
account-server.pid: 274
container-auditor.pid: 264
container-replicator.pid: 256
container-server.pid: 267
container-sync.pid: 288
container-updater.pid: 216
object-auditor.pid: 259
object-replicator.pid: 222
object-server.pid: 297
object-updater.pid: 294
proxy-server.pid: 225

root@5293f4890016:/var/run/swift# ps ax | egrep "account|container|object|proxy"
   21 ?        S      0:00 /usr/bin/python /usr/bin/swift-container-server /etc/swift/container-server.conf
   22 ?        S      0:00 /usr/bin/python /usr/bin/swift-account-reaper /etc/swift/account-server.conf
   23 ?        Sl     0:00 /usr/bin/python /usr/bin/swift-object-replicator /etc/swift/object-server.conf
   24 ?        S      0:00 /usr/bin/python /usr/bin/swift-account-auditor /etc/swift/account-server.conf
   25 ?        S      0:00 /usr/bin/python /usr/bin/swift-object-server /etc/swift/object-server.conf
   27 ?        S      0:00 /usr/bin/python /usr/bin/swift-account-replicator /etc/swift/account-server.conf
   28 ?        S      0:00 /usr/bin/python /usr/bin/swift-account-server /etc/swift/account-server.conf
   30 ?        S      0:00 /usr/bin/python /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
   31 ?        S      0:00 /usr/bin/python /usr/bin/swift-object-updater /etc/swift/object-server.conf
   81 ?        S      0:00 /usr/bin/python /usr/bin/swift-object-server /etc/swift/object-server.conf
   82 ?        S      0:00 /usr/bin/python /usr/bin/swift-container-server /etc/swift/container-server.conf
   83 ?        S      0:00 /usr/bin/python /usr/bin/swift-account-server /etc/swift/account-server.conf
   84 ?        S      0:00 /usr/bin/python /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
  114 ?        S      0:00 /usr/bin/python /usr/bin/swift-container-sync /etc/swift/container-server.conf
  135 ?        S+     0:00 egrep account|container|object|proxy

I am having problems trying to (re)configure the Swift proxy server and restarting it due to that. It seems that swift-init looks for PID 225 (see the output above) and it can't find it (since that is not the actual PID) and then tries to start the proxy server but the port is obviously already bound.

Am I missing something, or is there maybe something wrong with my setup?

root@5293f4890016:/# swift-init proxy-server restart
Signal proxy-server  pid: 225  signal: 15
No proxy-server running
WARNING: Unable to modify file descriptor limit.  Running as non-root?
Starting proxy-server...(/etc/swift/proxy-server.conf)
Traceback (most recent call last):
  File "/usr/bin/swift-proxy-server", line 23, in <module>
    sys.exit(run_wsgi(conf_file, 'proxy-server', default_port=8080, **options))
  File "/usr/lib/python2.7/dist-packages/swift/common/wsgi.py", line 381, in run_wsgi
    sock = get_socket(conf, default_port=kwargs.get('default_port', 8080))
  File "/usr/lib/python2.7/dist-packages/swift/common/wsgi.py", line 173, in get_socket
    bind_addr[0], bind_addr[1], bind_timeout))
Exception: Could not bind to 0.0.0.0:8080 after trying for 30 seconds

Solution

  • I am not sure what was wrong with my Swift installation, but I reinstalled it and everything worked fine. If you hit the same issue, try reinstalling Swift.