Seafevent not starting

I’m having an issue with seafevents not starting properly. The process gets started and the pid file is created but then removed right away.

Version seafile pro: 10.0.11, docker installation

controller.log
2024-02-24 17:37:08 seafile-controller.c(585): pid file /opt/seafile/pids/seafevents.pid does not exist
2024-02-24 17:37:08 seafile-controller.c(661): seafevents need restart…
2024-02-24 17:37:08 seafile-controller.c(97): spawn_process: /usr/bin/python3 -m seafevents.main --config-file /opt/seafile/conf/seafevents.conf --logfile /opt/seafile/logs/seafevents.log -P /opt/seafile/pids/seafevents.pid
2024-02-24 17:37:08 seafile-controller.c(131): spawned /usr/bin/python3, pid 1756610

seafevents.log
[2024-02-24 17:37:29,867] [INFO] [seafevents] database: mysql, name: seahub_db
[2024-02-24 17:37:29,869] [WARNING] Unknown database backend:
[2024-02-24 17:37:29,870] [INFO] [seafevents] database: mysql, name: seahub_db
[2024-02-24 17:37:29,875] [INFO] remove pidfile /opt/seafile/pids/seafevents.pid

executing command as shown in controller.log
/usr/bin/python3 -m seafevents.main --config-file /opt/seafile/conf/seafevents.conf --logfile /opt/seafile/logs/seafevents.log -P /opt/seafile/pids/seafevents.pid

/usr/bin/python3: Error while finding module specification for ‘seafevents.main’ (ModuleNotFoundError: No module named ‘seafevents’)

seafevents.conf
[DATABASE]
type = mysql
host = db
port = 3306
username = seafile
password =
name = seahub_db

Since it looks like there is an issue with seafevents.main would appreciate if someone from seafile could look into this.

Best Regards
Alex Frankenhauser

Hello I did a bit more investigation and I confirmed access to the database is working as well as the tables are in the seahub_db

docker exec -it seafile-mysql-10.0.11 /bin/bash

mysql --host=“db” --user=“seafile” --password=“PW”

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 76399
Server version: 10.11.6-MariaDB-1:10.11.6+maria~ubu2204 mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use seahub_db;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [seahub_db]>
MariaDB [seahub_db]> show tables;
±------------------------------------------+
| Tables_in_seahub_db |
±------------------------------------------+
| Activity |
| ContentScanRecord |
| ContentScanResult |
| Event |
| FileAudit |
| FileHistory |
| FileOpsStat |
| FileUpdate |
| GroupIdLDAPUuidPair |
| MonthlySysTraffic |
| MonthlyUserTraffic |
| PermAudit |
| SysTraffic |
| TotalStorageStat |
| UserActivity |
| UserActivityStat |
| UserEvent |
| UserTraffic |
| UserTrafficStat |
| VirusFile |
| VirusScanRecord |
| abuse_reports_abusereport |
| admin_log_adminlog |
| api2_token |
| api2_tokenv2 |
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| avatar_avatar |
| avatar_groupavatar |
| base_clientlogintoken |
| base_commandslastcheck |
| base_devicetoken |
| base_filecomment |
| base_filediscuss |
| base_groupenabledmodule |
| base_innerpubmsg |
| base_innerpubmsgreply |
| base_reposecretkey |
| base_userenabledmodule |
| base_userlastlogin |
| base_usermonitoredrepos |
| base_userstarredfiles |
| captcha_captchastore |
| constance_config |
| contacts_contact |
| custom_share_permission |
| django_cas_ng_proxygrantingticket |
| django_cas_ng_sessionticket |
| django_content_type |
| django_migrations |
| django_session |
| drafts_draft |
| drafts_draftreviewer |
| external_department |
| file_participants_fileparticipant |
| file_tags_filetags |
| group_groupmessage |
| group_messageattachment |
| group_messagereply |
| group_publicgroup |
| institutions_institution |
| institutions_institutionadmin |
| institutions_institutionquota |
| invitations_invitation |
| notifications_notification |
| notifications_usernotification |
| ocm_share |
| ocm_share_received |
| ocm_via_webdav_received_shares |
| onlyoffice_onlyofficedockey |
| options_useroptions |
| org_saml_config |
| organizations_orgadminsettings |
| organizations_orgmemberquota |
| organizations_orgsettings |
| post_office_attachment |
| post_office_attachment_emails |
| post_office_email |
| post_office_emailtemplate |
| post_office_log |
| profile_detailedprofile |
| profile_profile |
| registration_registrationprofile |
| related_files_relatedfiles |
| repo_api_tokens |
| repo_auto_delete |
| repo_share_invitation |
| repo_tags_repotags |
| revision_tag_revisiontags |
| revision_tag_tags |
| role_permissions_adminrole |
| share_anonymousshare |
| share_extragroupssharepermission |
| share_extrasharepermission |
| share_fileshare |
| share_orgfileshare |
| share_privatefiledirshare |
| share_uploadlinkshare |
| social_auth_association |
| social_auth_code |
| social_auth_nonce |
| social_auth_partial |
| social_auth_usersocialauth |
| sysadmin_extra_userloginlog |
| tags_filetag |
| tags_fileuuidmap |
| tags_tags |
| termsandconditions_termsandconditions |
| termsandconditions_usertermsandconditions |
| trusted_ip_trustedip |
| two_factor_phonedevice |
| two_factor_staticdevice |
| two_factor_statictoken |
| two_factor_totpdevice |
| wiki_groupwiki |
| wiki_personalwiki |
| wiki_wiki |
±------------------------------------------+
121 rows in set (0.001 sec)

MariaDB [seahub_db]>

So I do not think this is a database issue.

Can someone look into why the command that is executed:

/usr/bin/python3 -m seafevents.main --config-file /opt/seafile/conf/seafevents.conf --logfile /opt/seafile/logs/seafevents.log -P /opt/seafile/pids/seafevents.pid

gives the following error:

/usr/bin/python3: Error while finding module specification for ‘seafevents.main’ (ModuleNotFoundError: No module named ‘seafevents’)

check here

Hello,
thank you for pointing out the previous post about seafevents not working. However I think my issue is different since I have the correct tables in the seahub_db, please see output below.

Is there any other direction you can point me to.


MariaDB [(none)]> use seahub_db
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [seahub_db]> show tables;
±------------------------------------------+
| Tables_in_seahub_db |
±------------------------------------------+
| Activity |
| ContentScanRecord |
| ContentScanResult |
| Event |
| FileAudit |
| FileHistory |
| FileOpsStat |
| FileUpdate |
| GroupIdLDAPUuidPair |
| MonthlySysTraffic |
| MonthlyUserTraffic |
| PermAudit |
| SysTraffic |
| TotalStorageStat |
| UserActivity |
| UserActivityStat |
| UserEvent |
| UserTraffic |
| UserTrafficStat |
| VirusFile |
| VirusScanRecord |
| abuse_reports_abusereport |
| admin_log_adminlog |
| api2_token |
| api2_tokenv2 |
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| avatar_avatar |
| avatar_groupavatar |
| base_clientlogintoken |
| base_commandslastcheck |
| base_devicetoken |
| base_filecomment |
| base_filediscuss |
| base_groupenabledmodule |
| base_innerpubmsg |
| base_innerpubmsgreply |
| base_reposecretkey |
| base_userenabledmodule |
| base_userlastlogin |
| base_usermonitoredrepos |
| base_userstarredfiles |
| captcha_captchastore |
| constance_config |
| contacts_contact |
| custom_share_permission |
| django_cas_ng_proxygrantingticket |
| django_cas_ng_sessionticket |
| django_content_type |
| django_migrations |
| django_session |
| drafts_draft |
| drafts_draftreviewer |
| external_department |
| file_participants_fileparticipant |
| file_tags_filetags |
| group_groupmessage |
| group_messageattachment |
| group_messagereply |
| group_publicgroup |
| institutions_institution |
| institutions_institutionadmin |
| institutions_institutionquota |
| invitations_invitation |
| notifications_notification |
| notifications_usernotification |
| ocm_share |
| ocm_share_received |
| ocm_via_webdav_received_shares |
| onlyoffice_onlyofficedockey |
| options_useroptions |
| org_saml_config |
| organizations_orgadminsettings |
| organizations_orgmemberquota |
| organizations_orgsettings |
| post_office_attachment |
| post_office_attachment_emails |
| post_office_email |
| post_office_emailtemplate |
| post_office_log |
| profile_detailedprofile |
| profile_profile |
| registration_registrationprofile |
| related_files_relatedfiles |
| repo_api_tokens |
| repo_auto_delete |
| repo_share_invitation |
| repo_tags_repotags |
| revision_tag_revisiontags |
| revision_tag_tags |
| role_permissions_adminrole |
| share_anonymousshare |
| share_extragroupssharepermission |
| share_extrasharepermission |
| share_fileshare |
| share_orgfileshare |
| share_privatefiledirshare |
| share_uploadlinkshare |
| social_auth_association |
| social_auth_code |
| social_auth_nonce |
| social_auth_partial |
| social_auth_usersocialauth |
| sysadmin_extra_userloginlog |
| tags_filetag |
| tags_fileuuidmap |
| tags_tags |
| termsandconditions_termsandconditions |
| termsandconditions_usertermsandconditions |
| trusted_ip_trustedip |
| two_factor_phonedevice |
| two_factor_staticdevice |
| two_factor_statictoken |
| two_factor_totpdevice |
| wiki_groupwiki |
| wiki_personalwiki |
| wiki_wiki |
±------------------------------------------+
121 rows in set (0.001 sec)

MariaDB [seahub_db]>


For good measures I ensured user seafile has all privileges on all databases. But this this not fix the issue.

MariaDB [seahub_db]> show grants for ‘seafile’@‘%’;
±----------------------------------------------------------------------------------------------------------------+
| Grants for seafile@% |
±----------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON . TO seafile@% IDENTIFIED BY PASSWORD '9B5AEE5D53B9C59F594389F89D66BEF2CD01135D’ |
| GRANT ALL PRIVILEGES ON ccnet_db.
TO seafile@% |
| GRANT ALL PRIVILEGES ON seahub_db.* TO seafile@% |
| GRANT ALL PRIVILEGES ON seafile_db.* TO seafile@% |
±----------------------------------------------------------------------------------------------------------------+

Hello,
I was finally able to fix this issue. The issue is not related to any seafevents PIDs or database issues.

The issues was that in my ccnet.conf I had a password for my LDAP user that contained a “%”. The Phyton configuration parser reading the ccnet.conf treats the % character differently, when part of the contents of a string and can cause this issue.

root@0092c5e79ed3:/opt/seafile/seafile-server-latest# ./seahub.sh python-env python3 /optr/seafile/seafile-server-latest/pro/python/seafevents/main.py --config-file=/opt/seafile/conf/seafevents.conf --loglevel=debug

[08/08/2024 14:44:39] [INFO] [seafevents] database: mysql, name: seahub_db
[08/08/2024 14:44:39] [WARNING] Unknown database backend:
[08/08/2024 14:44:39] [DEBUG] seafes enabled: True
[08/08/2024 14:44:39] [DEBUG] seafes dir: /opt/seafile/seafile-pro-server-10.0.11/pro/python/seafes
[08/08/2024 14:44:39] [DEBUG] seafes logfile: index.log
[08/08/2024 14:44:39] [DEBUG] seafes index interval: 600 sec
[08/08/2024 14:44:39] [DEBUG] seafes index office/pdf: True
[08/08/2024 14:44:39] [DEBUG] elasticsearch host: seafile-elasticsearch-10.0.11
[08/08/2024 14:44:39] [DEBUG] elasticsearch port: 9200
[08/08/2024 14:44:39] [DEBUG] seahub email enabled: True
[08/08/2024 14:44:39] [DEBUG] send seahub email interval: 1800 sec
[08/08/2024 14:44:39] [INFO] [seafevents] database: mysql, name: seahub_db
Traceback (most recent call last):
File “/opt/seafile/seafile-server-latest/pro/python/seafevents/main.py”, line 75, in
main()
File “/opt/seafile/seafile-server-latest/pro/python/seafevents/main.py”, line 63, in main
app = App(config, ccnet_config, seafile_config, foreground_tasks_enabled=foreground_tasks_enabled,
File “/opt/seafile/seafile-pro-server-10.0.11/pro/python/seafevents/app/app.py”, line 23, in init
self._ldap_syncer = LdapSyncer(config, ccnet_config)
File “/opt/seafile/seafile-pro-server-10.0.11/pro/python/seafevents/tasks/ldap_syncer.py”, line 10, in init
self.settings = Settings(config, ccnet_config)
File “/opt/seafile/seafile-pro-server-10.0.11/pro/python/seafevents/ldap_syncer/ldap_settings.py”, line 98, in init
self.read_multi_server_configs(is_test, has_sync_section)
File “/opt/seafile/seafile-pro-server-10.0.11/pro/python/seafevents/ldap_syncer/ldap_settings.py”, line 129, in read_multi_server_configs
if self.read_base_config(ldap_config, ldap_sec, sync_sec, is_test, has_sync_section) == -1:
File “/opt/seafile/seafile-pro-server-10.0.11/pro/python/seafevents/ldap_syncer/ldap_settings.py”, line 153, in read_base_config
ldap_config.passwd = self.get_option(ldap_sec, ‘PASSWORD’)
File “/opt/seafile/seafile-pro-server-10.0.11/pro/python/seafevents/ldap_syncer/ldap_settings.py”, line 251, in get_option
val = self.ccnet_config.get(section, key)
File “/usr/lib/python3.8/configparser.py”, line 799, in get
return self._interpolation.before_get(self, section, option, value,
File “/usr/lib/python3.8/configparser.py”, line 395, in before_get
self._interpolate_some(parser, option, L, value, section, defaults, 1)
File “/usr/lib/python3.8/configparser.py”, line 442, in _interpolate_some
raise InterpolationSyntaxError(
configparser.InterpolationSyntaxError: ‘%’ must be followed by ‘%’ or ‘(’, found: ‘%23456789’
Done.

Therefore, the fix was to change the password for the LDAP user in ccnet.conf to not contain a “%” for example from:

PASSWORD = 1%23456789
to
PASSWORD = 1#23456789