Skip to content

clickhouse-server unlinks --pid-file before checking /status file #3501

Closed
@filimonov

Description

@filimonov

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

Relates to #1498, cc @proller

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed user-visible misbehaviour in official releasest-need-infoWe need extra data to continue (waiting for response)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions