Gitaly: FAIL: 14:Connect Failed

Gitaly cannot work.

# gitlab-rake gitlab:check --trace
** Invoke gitlab:check (first_time)
** Invoke gitlab_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute gitlab_environment
** Execute gitlab:check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 9.0.0 ? ... OK (9.0.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... FAIL: 14:Connect Failed

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ... 
... all are yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.5.3 ? ... yes (2.5.3)
Git version >= 2.18.0 ? ... yes (2.18.1)
Git user has default SSH configuration? ... yes
Active users: ... 21

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

and

# tail /var/log/gitlab/gitaly/current
2019-05-05_08:00:22.25207 time="2019-05-05T08:00:22Z" level=fatal msg="find gitaly" error="strconv.Atoi: parsing \"\": invalid syntax" wrapper=32516
2019-05-05_08:00:23.30272 time="2019-05-05T08:00:23Z" level=info msg="Wrapper started" wrapper=32525
2019-05-05_08:00:23.30280 time="2019-05-05T08:00:23Z" level=info msg="finding gitaly" pid_file=/var/opt/gitlab/gitaly/gitaly.pid wrapper=32525
2019-05-05_08:00:23.30301 time="2019-05-05T08:00:23Z" level=fatal msg="find gitaly" error="strconv.Atoi: parsing \"\": invalid syntax" wrapper=32525
2019-05-05_08:00:26.50803 time="2019-05-05T08:00:26Z" level=info msg="Wrapper started" wrapper=32536
2019-05-05_08:00:26.50813 time="2019-05-05T08:00:26Z" level=info msg="finding gitaly" pid_file=/var/opt/gitlab/gitaly/gitaly.pid wrapper=32536
2019-05-05_08:00:26.50833 time="2019-05-05T08:00:26Z" level=fatal msg="find gitaly" error="strconv.Atoi: parsing \"\": invalid syntax" wrapper=32536
2019-05-05_08:00:30.07322 time="2019-05-05T08:00:30Z" level=info msg="Wrapper started" wrapper=32551
2019-05-05_08:00:30.07328 time="2019-05-05T08:00:30Z" level=info msg="finding gitaly" pid_file=/var/opt/gitlab/gitaly/gitaly.pid wrapper=32551
2019-05-05_08:00:30.07343 time="2019-05-05T08:00:30Z" level=fatal msg="find gitaly" error="strconv.Atoi: parsing \"\": invalid syntax" wrapper=32551

Works again after rm /var/opt/gitlab/gitaly/gitaly.pid, which is empty.