https://bz.mercurial-scm.org/show_bug.cgi?id=6846
Bug ID: 6846 Summary: hg serve with lsprof enabled throws exceptions on cpython 3.12 Product: Mercurial Version: stable branch Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: hgweb Assignee: bugzi...@mercurial-scm.org Reporter: coral.p...@disr.it CC: mercurial-de...@mercurial-scm.org Python Version: --- Due to changes in python 3.12 in _lsprof module (https://github.com/python/cpython/issues/103533) multiple profiling contexts no longer work - at least that's what I think. The first profiler starts in mercurial.dispatch on start up, and the second one fails to start in mercurial.hgweb on WSGI request, which crashes request handling. Removing profiling contexts in mercurial.hgweb makes error go away. This also causes test-profile.t to fail. To reproduce: > hg init > hg serve --profile --config profiling.type=ls & listening at http://127.0.0.1:8000/ (bound to *:8000) > hg clone 'http://127.0.0.1:8000' 127.0.0.1 - - [11/Oct/2023 18:37:08] Exception happened during processing request '/?cmd=capabilities': Traceback (most recent call last): File "/usr/lib/python3.12/site-packages/mercurial/hgweb/server.py", line 123, in do_POST self.do_write() File "/usr/lib/python3.12/site-packages/mercurial/hgweb/server.py", line 117, in do_write self.do_hgweb() File "/usr/lib/python3.12/site-packages/mercurial/hgweb/server.py", line 232, in do_hgweb for chunk in self.server.application(env, self._start_response): File "/usr/lib/python3.12/site-packages/mercurial/hgweb/hgweb_mod.py", line 364, in run_wsgi with profiling.profile(repo.ui, enabled=profile): File "/usr/lib/python3.12/site-packages/mercurial/profiling.py", line 197, in __enter__ self.start() File "/usr/lib/python3.12/site-packages/mercurial/profiling.py", line 262, in start self._profiler.__enter__() File "/usr/lib/python3.12/contextlib.py", line 137, in __enter__ return next(self.gen) ^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/mercurial/profiling.py", line 58, in lsprofile p.enable(subcalls=True) ValueError: Another profiling tool is already active 127.0.0.1 - - [11/Oct/2023 18:37:08] "GET /?cmd=capabilities HTTP/1.1" 500 - abort: HTTP Error 500: Internal Server Error -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel