Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Synapse won't start if no package metadata is found for "matrix-synapse" #12565

Closed
MTRNord opened this issue Apr 27, 2022 · 12 comments
Closed

Synapse won't start if no package metadata is found for "matrix-synapse" #12565

MTRNord opened this issue Apr 27, 2022 · 12 comments

Comments

@MTRNord
Copy link
Contributor

MTRNord commented Apr 27, 2022

Description

The workers all fail wit this error while the main process works:

pr 27 15:06:08 nordgedanken.dev systemd[1]: Starting Synapse background_worker...
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]: Traceback (most recent call last):
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:   File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:     mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:   File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:     __import__(pkg_name)
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:   File "/usr/lib/python3.9/site-packages/synapse/app/__init__.py", line 18, in <module>
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:     from synapse.util import check_dependencies
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:   File "/usr/lib/python3.9/site-packages/synapse/util/check_dependencies.py", line 58, in <module>
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]:     set(metadata.metadata(DISTRIBUTION_NAME).get_all("Provides-Extra")) - DEV_EXTRAS
Apr 27 15:06:09 nordgedanken.dev matrix-synapse-background_worker[186827]: TypeError: 'NoneType' object is not iterable

Steps to reproduce

  • Install synapse?

Version information

  • Homeserver:

If not matrix.org:

  • Version:v1.58.0rc2

  • Install method:
    gentoo ebuild

  • Platform:
    Gentoo "bare-metal"/on host

@DMRobertson DMRobertson self-assigned this Apr 27, 2022
@DMRobertson
Copy link
Contributor

The workers all fail wit this error while the main process works:

Is there a difference between how the main process and the workers are started?

@DMRobertson DMRobertson added this to To do in Poetry in Synapse via automation Apr 27, 2022
@DMRobertson DMRobertson added A-Sync defects related to /sync S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Apr 27, 2022
@DMRobertson
Copy link
Contributor

Sounds like it's related to #12223, except this time it applies to the matrix-synapse package rather than a dependency.

@MTRNord what does ls /usr/lib/python3.9/site-packages/matrix* yield?

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 27, 2022

This:

➜  matrix-synapse git:(main) ✗ ls /usr/lib/python3.9/site-packages/matrix* 
/usr/lib/python3.9/site-packages/matrix_common:
__init__.py  __pycache__  py.typed  regex.py  versionstring.py

/usr/lib/python3.9/site-packages/matrix_common-1.1.0-py3.9.egg-info:
dependency_links.txt  not-zip-safe  PKG-INFO  requires.txt  SOURCES.txt  top_level.txt

/usr/lib/python3.9/site-packages/matrix_synapse-1.58.0rc2-py3.9.egg-info:
dependency_links.txt  entry_points.txt  not-zip-safe  PKG-INFO  SOURCES.txt  top_level.txt

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 27, 2022

The workers all fail wit this error while the main process works:

Is there a difference between how the main process and the workers are started?

there shouldnt be. I am just using the systemd target based setup from the contrib folder. didnt check if that changed though since I did set it up.

(well it moved to https://github.com/matrix-org/synapse/tree/develop/docs/systemd-with-workers/system it seems)

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 27, 2022

Just to make sure the start command for workers is python -m synapse.app.generic_worker and the main process python -m synapse.app.homeserver. rest is the same on both.

@DMRobertson
Copy link
Contributor

I have no idea how Synapse is installed in the gentoo ecosystem, but it looks like matrix_synapse-1.58.0rc2-py3.9.egg-info doesn't contain a METADATA file.

To confirm this: what happens if you run the following in the same environment that synapse would run in?

import importlib.metadata as m
d = m.distribution("matrix-synapse")
print(d)
print(d.metadata)

I'm really surprised that you don't see this on the main process, because AFAICS they should both import synapse.util.check_dependencies. This logic was present in Synapse 1.57 too, so I suspect this is a packaging artifact in the light of the poetry changes, rather than a Synapse bug per-se.

@deepbluev7
Copy link
Contributor

@MTRNord, your ebuild is broken. Don't use the deprecated method of converting poetry to a setup.py, use this: https://gitlab.com/deepbluev7/neko/-/blob/master/net-im/matrix-synapse/matrix-synapse-1.58.0_rc2.ebuild#L7

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 27, 2022

@MTRNord, your ebuild is broken. Don't use the deprecated method of converting poetry to a setup.py, use this: https://gitlab.com/deepbluev7/neko/-/blob/master/net-im/matrix-synapse/matrix-synapse-1.58.0_rc2.ebuild#L7

Ah oh. Google suggested the line 6 of yours but not line 7. :o yeah that seems like the cause.

@DMRobertson DMRobertson removed S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. A-Sync defects related to /sync labels Apr 27, 2022
@DMRobertson DMRobertson changed the title Workers fail to startup on 1.58-rc2 Synapse won't start if no package metadata is found for "matrix-synapse" Apr 27, 2022
@DMRobertson
Copy link
Contributor

I have no idea how Synapse is installed in the gentoo ecosystem, but it looks like matrix_synapse-1.58.0rc2-py3.9.egg-info doesn't contain a METADATA file.

Having said that, there is a PKG-INFO file which should also be considered as a metadata source, judging by the source code of importlib.metadata. I'd suggest looking at that file to see if its contents are sensible.

I'm reluctant to disable the checks that the dependencies have appropriate versions, because they're meant to help admins who've installed from source but missed necessary dependency upgrades. If the proposed ebuild fix doesn't work then maybe we can have some kind of opt-out mechanism, but I'd like to see if it's possible to fix the packaging first.

@DMRobertson DMRobertson added the X-Needs-Info This issue is blocked awaiting information from the reporter label Apr 27, 2022
@DMRobertson DMRobertson added this to the Revisit: Next Week milestone Apr 27, 2022
@DMRobertson DMRobertson removed their assignment Apr 27, 2022
@DMRobertson
Copy link
Contributor

DMRobertson commented Apr 27, 2022

(Could do something like the change proposed in bdb00ee)

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 27, 2022

I have no idea how Synapse is installed in the gentoo ecosystem, but it looks like matrix_synapse-1.58.0rc2-py3.9.egg-info doesn't contain a METADATA file.

Having said that, there is a PKG-INFO file which should also be considered as a metadata source, judging by the source code of importlib.metadata. I'd suggest looking at that file to see if its contents are sensible.

I'm reluctant to disable the checks that the dependencies have appropriate versions, because they're meant to help admins who've installed from source but missed necessary dependency upgrades. If the proposed ebuild fix doesn't work then maybe we can have some kind of opt-out mechanism, but I'd like to see if it's possible to fix the packaging first.

The issue indeed was the packaging. Nico helped me to get it working. :) Issue is fixed with that.

@MTRNord MTRNord closed this as completed Apr 27, 2022
Poetry in Synapse automation moved this from To do to Done Apr 27, 2022
@DMRobertson
Copy link
Contributor

Great stuff, thanks for confirming @MTRNord!

@DMRobertson DMRobertson removed this from the Revisit: Next Week milestone Apr 27, 2022
@DMRobertson DMRobertson removed the X-Needs-Info This issue is blocked awaiting information from the reporter label Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

No branches or pull requests

3 participants