<div dir="ltr">Source: matrix-synapse<br>Version: 1.128.0-1<div>Severity: serious<br>Tags: FTBFS, patch</div><div><div>User: <a href="mailto:debian-riscv@lists.debian.org" target="_blank">debian-riscv@lists.debian.org</a></div><div>Usertags: riscv64</div></div><div><br></div><div>Dear matrix-synapse maintainer,</div><div>The package matrix-synapse build failed on riscv64.The crucial buildd log below:</div><div>```</div><div><pre style="color:rgb(0,0,0)">=================================== FAILURES ===================================
___________________ WorkerLockTestCase.test_lock_contention ____________________

self = <tests.handlers.test_worker_lock.WorkerLockTestCase testMethod=test_lock_contention>

    def test_lock_contention(self) -> None:
        """Test lock contention when a lot of locks wait on a single worker"""
    
        # It takes around 0.5s on a 5+ years old laptop
        with test_timeout(5):
            nb_locks = 500
            d = self._take_locks(nb_locks)
>           self.assertEqual(self.get_success(d), nb_locks)

/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/tests/handlers/test_worker_lock.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/tests/unittest.py:692: in get_success
    self.pump(by=by)
/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/tests/unittest.py:688: in pump
    self.reactor.pump([by] * 100)
/usr/lib/python3/dist-packages/twisted/internet/task.py:838: in pump
    self.advance(amount)
/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/tests/server.py:642: in advance
    super().advance(0)
/usr/lib/python3/dist-packages/twisted/internet/task.py:830: in advance
    call.func(*call.args, **<a href="http://call.kw">call.kw</a>)
/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/synapse/util/__init__.py:201: in wrapped_callback
    callback(*args, **kwargs)
/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/synapse/handlers/worker_lock.py:191: in _wake_all_locks
    if not deferred.called:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.utils.test_timeout object at 0x3f9e3e74d0>, signum = 14
frame = <frame at 0x3f9bda9560, file '/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/synapse/handlers/worker_lock.py', line 191, code _wake_all_locks>

    def handle_timeout(self, signum: int, frame: Optional[FrameType]) -> None:
>       raise TestTimeout(self.error_message)
E       tests.utils.TestTimeout: Test timed out after 5s

/build/reproducible-path/matrix-synapse-1.128.0/.pybuild/cpython3_3.13_matrix-synapse/build/tests/utils.py:424: TestTimeout</pre></div><div>```</div><div>The full buildd log is here:</div><div><a href="https://buildd.debian.org/status/fetch.php?pkg=matrix-synapse&arch=riscv64&ver=1.128.0-1&stamp=1746950558&raw=0">https://buildd.debian.org/status/fetch.php?pkg=matrix-synapse&arch=riscv64&ver=1.128.0-1&stamp=1746950558&raw=0</a></div><div><br></div><div>My solution to this issue:</div><div>The `test_lock_contention` test, which simulates high lock contention, is timing out on RISC-V systems likely due to inherent performance differences of the architecture compared to more established platforms like x86_64, for which the current 5-second timeout is calibrated.<br><br>To address this without masking potential regressions on other architectures, I propose to conditionally adjust the timeout duration for the RISC-V architecture. This is achieved by detecting the architecture using `platform.machine()` within the test case and applying a more lenient timeout (e.g., 15 seconds)  specifically for RISC-V.The debdiff patch is in the attachment.I have tested that locally,and it works well.Please let me know whether this solution can be accepted.</div><div><br></div><div>Gui-Yue</div><div>Best Regards</div></div>