Closed
Description
clickhouse-server unlink --pid-file before checking /status file and it leads to that exception:
Cannot lock file .../status. Another server instance in same directory is already running.
test case:
$ killall clickhouse-server
$ clickhouse-server --daemon --config-file=/etc/clickhouse-server/config.xml --pid-file=/tmp/test_pid.pid
$ cat /tmp/test_pid.pid
22867
$ cat /var/lib/clickhouse/status
PID: 22867
Started at: 2018-10-30 18:29:23
Revision: 54409
# till now everything's ok
# now let's try to run second time:
$ clickhouse-server --daemon --config-file=/etc/clickhouse-server/config.xml --pid-file=/tmp/test_pid.pid
# status file is still there
$ cat /var/lib/clickhouse/status
PID: 22867
Started at: 2018-10-30 18:29:23
Revision: 54409
# but pid file disappeared :\
$ cat /tmp/test_pid.pid
cat: /tmp/test_pid.pid: No such file or directory
# server is still running...
$ pidof clickhouse-server
22867