matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
164 stars 147 forks source link

build failed due to aioapns dependency version #293

Closed laurent-treeb closed 2 years ago

laurent-treeb commented 2 years ago

https://github.com/matrix-org/sygnal/blob/bd1c408902988c624ee6c87e97ec6af454698156/setup.py#L25

aioapns 2.1 introduced a breaking change. (remove loop on APNS instantiation).

to fix it, set the dep to :

"aioapns==2.0.2",
DMRobertson commented 2 years ago

Hi @laurent-dol, could you explain what the breakage is here---which build failed, and how?

laurent-treeb commented 2 years ago

The build with the Dockerfile. It doesn't failed, but the created image fails to run with a script error introduced by the new aioapns version (when an apns app id is configured).

DMRobertson commented 2 years ago

the created image fails to run with a script error

Interesting---could you share traceback from the error message?

laurent-treeb commented 2 years ago

2022-01-27 16:20:19,618 [1] INFO main Importing pushkin module: sygnal.apnspushkin 2022-01-27 16:20:19,657 [1] INFO main Creating pushkin: ApnsPushkin 2022-01-27 16:20:19,659 [1] ERROR main Failed to load and create pushkin for kind 'apns' Error during startup: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/sygnal/sygnal.py", line 228, in start yield ensureDeferred(self.make_pushkins_then_start()) File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1130, in ensureDeferred return Deferred.fromCoroutine(coro) File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1106, in fromCoroutine return _cancellableInlineCallbacks(coro) File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1816, in _cancellableInlineCallbacks _inlineCallbacks(None, gen, status) --- --- File "/usr/local/lib/python3.7/site-packages/sygnal/sygnal.py", line 228, in start yield ensureDeferred(self.make_pushkins_then_start()) File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1661, in _inlineCallbacks result = current_context.run(gen.send, result) File "/usr/local/lib/python3.7/site-packages/sygnal/sygnal.py", line 200, in make_pushkins_then_start self.pushkins[app_id] = await self._make_pushkin(app_id, app_cfg) File "/usr/local/lib/python3.7/site-packages/sygnal/sygnal.py", line 195, in _make_pushkin return await clarse.create(app_name, self, app_config) File "/usr/local/lib/python3.7/site-packages/sygnal/notifications.py", line 169, in create return cls(name, sygnal, config) File "/usr/local/lib/python3.7/site-packages/sygnal/apnspushkin.py", line 188, in init loop=loop, builtins.TypeError: init() got an unexpected keyword argument 'loop'

DMRobertson commented 2 years ago

Ahh, I see! I thought when you said "remove loop" you meant the change here to limit the number of times aioapns will repeat a retry loop. But instead the loop argument was removed in https://github.com/Fatal1ty/aioapns/pull/32. I'm not sure what the reason for that was, but I'd guess it's related to this note from the Python 3.10 changelog:

asyncio.get_event_loop() now emits a deprecation warning if there is no running event loop. In the future it will be an alias of get_running_loop(). asyncio functions which implicitly create Future or Task objects now emit a deprecation warning if there is no running event loop and no explicit loop argument is passed: ensure_future(), wrap_future(), gather(), shield(), as_completed() and constructors of Future, Task, StreamReader, StreamReaderProtocol. (Contributed by Serhiy Storchaka in bpo-39529.)

Pinning the dependency sounds like the best way to go. Thank you for reporting!