"seafevents need restart..." if seafile is started by systemd

Seafile pro 7.0.4
After some server maintenance (kernel update, seafile update, general yum update) seafile doesn’t start correctly after startup. If I am starting seafile by commands

systemctl stop seafile
systemctl start seafile

seafile starts normally.
Log files:
Controller.log:

[07/18/19 07:08:08] seafile-controller.c(94): spawn_process: /usr/bin/python2.7 -m seafevents.main --config-file /mnt/D/Documents/seafile/conf/seafevents.conf --logfile /mnt/D/Documents/seafile/logs/seafevents.log -P /mnt/D/Documents/seafile/pids/seafevents.pid
[07/18/19 07:08:08] seafile-controller.c(109): spawned /usr/bin/python2.7, pid 3534
[07/18/19 07:08:18] seafile-controller.c(605): path /proc/3534 doesn’t exist, restart progress [3]
[07/18/19 07:08:18] seafile-controller.c(625): seafevents need restart…
[07/18/19 07:08:18] seafile-controller.c(94): spawn_process: /usr/bin/python2.7 -m seafevents.main --config-file /mnt/D/Documents/seafile/conf/seafevents.conf --logfile /mnt/D/Documents/seafile/logs/seafevents.log -P /mnt/D/Documents/seafile/pids/seafevents.pid
[07/18/19 07:08:18] seafile-controller.c(109): spawned /usr/bin/python2.7, pid 3546
[07/18/19 07:08:28] seafile-controller.c(605): path /proc/3546 doesn’t exist, restart progress [3]
[07/18/19 07:08:28] seafile-controller.c(625): seafevents need restart…
[07/18/19 07:08:28] seafile-controller.c(94): spawn_process: /usr/bin/python2.7 -m seafevents.main --config-file /mnt/D/Documents/seafile/conf/seafevents.conf --logfile /mnt/D/Documents/seafile/logs/seafevents.log -P /mnt/D/Documents/seafile/pids/seafevents.pid
[07/18/19 07:08:28] seafile-controller.c(109): spawned /usr/bin/python2.7, pid 3559
[07/18/19 07:08:38] seafile-controller.c(605): path /proc/3559 doesn’t exist, restart progress [3]
[07/18/19 07:08:38] seafile-controller.c(625): seafevents need restart…
[07/18/19 07:08:38] seafile-controller.c(94): spawn_process: /usr/bin/python2.7 -m seafevents.main --config-file /mnt/D/Documents/seafile/conf/seafevents.conf --logfile /mnt/D/Documents/seafile/logs/seafevents.log -P /mnt/D/Documents/seafile/pids/seafevents.pid
[07/18/19 07:08:38] seafile-controller.c(109): spawned /usr/bin/python2.7, pid 3570
[07/18/19 07:08:48] seafile-controller.c(605): path /proc/3570 doesn’t exist, restart progress [3]
[07/18/19 07:08:48] seafile-controller.c(625): seafevents need restart…
[07/18/19 07:08:48] seafile-controller.c(94): spawn_process: /usr/bin/python2.7 -m seafevents.main --config-file /mnt/D/Documents/seafile/conf/seafevents.conf --logfile /mnt/D/Documents/seafile/logs/seafevents.log -P /mnt/D/Documents/seafile/pids/seafevents.pid
[07/18/19 07:08:48] seafile-controller.c(109): spawned /usr/bin/python2.7, pid 3601
[07/18/19 07:08:58] seafile-controller.c(605): path /proc/3601 doesn’t exist, restart progress [3]
[07/18/19 07:08:58] seafile-controller.c(625): seafevents need restart…
[07/18/19 07:08:58] seafile-controller.c(94): spawn_process: /usr/bin/python2.7 -m seafevents.main --config-file /mnt/D/Documents/seafile/conf/seafevents.conf --logfile /mnt/D/Documents/seafile/logs/seafevents.log -P /mnt/D/Documents/seafile/pids/seafevents.pid
[07/18/19 07:08:58] seafile-controller.c(109): spawned /usr/bin/python2.7, pid 3622

seafevents.log:

[2019-07-18 07:10:34,381] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:34,833] [INFO] audit is not enabled
[2019-07-18 07:10:34,845] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:34,872] [INFO] [seafevents] database: mysql, name: seafile-db
[2019-07-18 07:10:36,853] [INFO] The file with the following suffix will be recorded into the file history: md,txt,doc,docx,xls,xlsx,ppt,pptx
[2019-07-18 07:10:36,861] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:36,866] [INFO] Events publish to redis is disabled.
[2019-07-18 07:10:36,876] [INFO] LDAP section is not set, disable ldap sync.
[2019-07-18 07:10:36,880] [INFO] [virus_scan] scan_command option is not found in /mnt/D/Documents/seafile/conf/seafile.conf, disable virus scan.
[2019-07-18 07:10:36,894] [INFO] try to connect to ccnet-server…
[2019-07-18 07:10:36,896] [INFO] connected to ccnet server
[2019-07-18 07:10:36,908] [ERROR] Another instance is already running
Traceback (most recent call last):
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/pro/python/seafevents/app/app.py”, line 79, in connect_ccnet
self._sync_client.register_service_sync(‘seafevents-events-dummy-service’, ‘rpc-inner’)
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/seafile/lib64/python2.7/site-packages/ccnet/sync_client.py”, line 94, in register_service_sync
self.send_cmd(cmd)
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/seafile/lib64/python2.7/site-packages/ccnet/sync_client.py”, line 49, in send_cmd
raise RuntimeError(‘Failed to send-cmd: %s %s’ % (resp.code, resp.code_msg))
RuntimeError: Failed to send-cmd: 516 The service existed
[2019-07-18 07:10:36,912] [INFO] exit with code 1
[2019-07-18 07:10:44,094] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:44,456] [INFO] audit is not enabled
[2019-07-18 07:10:44,465] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:44,480] [INFO] [seafevents] database: mysql, name: seafile-db
[2019-07-18 07:10:46,118] [INFO] The file with the following suffix will be recorded into the file history: md,txt,doc,docx,xls,xlsx,ppt,pptx
[2019-07-18 07:10:46,125] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:46,130] [INFO] Events publish to redis is disabled.
[2019-07-18 07:10:46,141] [INFO] LDAP section is not set, disable ldap sync.
[2019-07-18 07:10:46,144] [INFO] [virus_scan] scan_command option is not found in /mnt/D/Documents/seafile/conf/seafile.conf, disable virus scan.
[2019-07-18 07:10:46,158] [INFO] try to connect to ccnet-server…
[2019-07-18 07:10:46,159] [INFO] connected to ccnet server
[2019-07-18 07:10:46,168] [ERROR] Another instance is already running
Traceback (most recent call last):
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/pro/python/seafevents/app/app.py”, line 79, in connect_ccnet
self._sync_client.register_service_sync(‘seafevents-events-dummy-service’, ‘rpc-inner’)
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/seafile/lib64/python2.7/site-packages/ccnet/sync_client.py”, line 94, in register_service_sync
self.send_cmd(cmd)
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/seafile/lib64/python2.7/site-packages/ccnet/sync_client.py”, line 49, in send_cmd
raise RuntimeError(‘Failed to send-cmd: %s %s’ % (resp.code, resp.code_msg))
RuntimeError: Failed to send-cmd: 516 The service existed
[2019-07-18 07:10:46,172] [INFO] exit with code 1
[2019-07-18 07:10:53,536] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:53,929] [INFO] audit is not enabled
[2019-07-18 07:10:53,939] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:53,953] [INFO] [seafevents] database: mysql, name: seafile-db
[2019-07-18 07:10:55,542] [INFO] The file with the following suffix will be recorded into the file history: md,txt,doc,docx,xls,xlsx,ppt,pptx
[2019-07-18 07:10:55,547] [INFO] [seafevents] database: mysql, name: seahub-db
[2019-07-18 07:10:55,550] [INFO] Events publish to redis is disabled.
[2019-07-18 07:10:55,560] [INFO] LDAP section is not set, disable ldap sync.
[2019-07-18 07:10:55,563] [INFO] [virus_scan] scan_command option is not found in /mnt/D/Documents/seafile/conf/seafile.conf, disable virus scan.
[2019-07-18 07:10:55,573] [INFO] try to connect to ccnet-server…
[2019-07-18 07:10:55,574] [INFO] connected to ccnet server
[2019-07-18 07:10:55,579] [ERROR] Another instance is already running
Traceback (most recent call last):
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/pro/python/seafevents/app/app.py”, line 79, in connect_ccnet
self._sync_client.register_service_sync(‘seafevents-events-dummy-service’, ‘rpc-inner’)
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/seafile/lib64/python2.7/site-packages/ccnet/sync_client.py”, line 94, in register_service_sync
self.send_cmd(cmd)
File “/mnt/D/Documents/seafile/seafile-pro-server-7.0.4/seafile/lib64/python2.7/site-packages/ccnet/sync_client.py”, line 49, in send_cmd
raise RuntimeError(‘Failed to send-cmd: %s %s’ % (resp.code, resp.code_msg))
RuntimeError: Failed to send-cmd: 516 The service existed
[2019-07-18 07:10:55,581] [INFO] exit with code 1

ccnet.log:

[07/18/19 07:11:43] …/common/peer.c(950): Local peer down
[07/18/19 07:11:43] …/common/peer.c(950): Local peer down
[07/18/19 07:11:53] …/common/session.c(409): Accepted a local client
[07/18/19 07:11:53] …/common/session.c(409): Accepted a local client
[07/18/19 07:11:53] …/common/peer.c(950): Local peer down
[07/18/19 07:11:53] …/common/peer.c(950): Local peer down
[07/18/19 07:12:03] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:03] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:03] …/common/peer.c(950): Local peer down
[07/18/19 07:12:03] …/common/peer.c(950): Local peer down
[07/18/19 07:12:13] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:13] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:13] …/common/peer.c(950): Local peer down
[07/18/19 07:12:13] …/common/peer.c(950): Local peer down
[07/18/19 07:12:23] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:23] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:23] …/common/peer.c(950): Local peer down
[07/18/19 07:12:23] …/common/peer.c(950): Local peer down
[07/18/19 07:12:33] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:33] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:33] …/common/peer.c(950): Local peer down
[07/18/19 07:12:33] …/common/peer.c(950): Local peer down
[07/18/19 07:12:44] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:44] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:44] …/common/peer.c(950): Local peer down
[07/18/19 07:12:44] …/common/peer.c(950): Local peer down
[07/18/19 07:12:53] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:53] …/common/session.c(409): Accepted a local client
[07/18/19 07:12:53] …/common/peer.c(950): Local peer down
[07/18/19 07:12:53] …/common/peer.c(950): Local peer down
[07/18/19 07:13:03] …/common/session.c(409): Accepted a local client
[07/18/19 07:13:03] …/common/session.c(409): Accepted a local client
[07/18/19 07:13:03] …/common/peer.c(950): Local peer down
[07/18/19 07:13:03] …/common/peer.c(950): Local peer down

Configs:

ccnet.conf:

[General]
USER_NAME = SweetHome
ID = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NAME = SweetHome
SERVICE_URL = https://xxxxx.yyyyy.zzzzz

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = seafile
DB = ccnet-db
CONNECTION_CHARSET = utf8

seafile.conf

[fileserver]
port = 8082
# bind address for fileserver
# default to 0.0.0.0, if deployed without proxy: no access restriction
# set to 127.0.0.1, if used with local proxy: only access by local
host = 127.0.0.1

[database]
type = mysql
host = 127.0.0.1
port = 3306
user = seafile
password = seafile
db_name = seafile-db
connection_charset = utf8

seafevents.conf

[DATABASE]
type = mysql
host = 127.0.0.1
port = 3306
username = seafile
password = seafile
name = seahub-db

[Audit]
enabled = false

[STATISTICS]
## must be "true" to enable statistics
enabled = false

[INDEX FILES]
enabled = false
interval = 10m

## If true, indexes the contents of office/pdf files while updating search index
## Note: If you change this option from "false" to "true", then you need to clear the search index and update the index again. See the FAQ for details.
index_office_pdf = false

[OFFICE CONVERTER]

## must be "true" to enable office/pdf online preview
#enabled = true

## how many libreoffice worker processes should run concurrenlty
#workers = 1

## where to store the converted office/pdf files. Deafult is /tmp/.
#outputdir = /tmp/

[SEAHUB EMAIL]
enabled = true

## interval of sending Seahub email. Can be s(seconds), m(minutes), h(hours), d(days)
interval = 30m

/etc/systemd/system/seafile.service

[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target mariadb.service

[Service]
Type=forking
ExecStart=/mnt/D/Documents/seafile/seafile-server-latest/seafile.sh start
ExecStop=/mnt/D/Documents/seafile/seafile-server-latest/seafile.sh stop
#RemainAfterExit=yes
User=seafile
Group=seafile

[Install]
WantedBy=multi-user.target

I tried to replace
Type=forking
To
Type=oneshot
In this configuration seafile starting correctly, no errors in logs.
But in seafile documentation type of systemd seafile service is forking.
What could be the error?

Your answer is already in your logs

I see, that “another instance is already running”, but why this error appears only if
type=forking
in systemd file?
Moreover, if i am starting seafile and seahub (not changing type, e.g. type=forking) by
systemctl restart seafile && systemctl restart seahub
I don’t see any errors in logs and behavior…

Seafile tries to fork some process that already exists, and then both crash. I would try to reinstall, there seems to be some problem in your installation.