-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RecursionError in pluggy #1794
Comments
@The-Compiler, thanks, I plan to start investigating this tomorrow. It seems related to the new Meanwhile, if you have the time, could you try to bisect this from 2.9.2 and try to find the culprit commit? |
Trying to bisect, but I ran into some trouble with this not being reproducible anymore first (not sure why). I think things are looking better now, but it'll still take me a bit. |
Bisected to 7751008 ("Implement invocation-scoped fixtures"). @nicoddemus, your turn 😉 |
Thanks for the bisect! 😁 I will try to tackle this tonight. Is there a simple non-obvious command to reproduce the error in |
Here's roughly what I did:
I initially tried running a subset but then the error went away, so I guess better save than sorry. Still takes around 1min 40s per run though... |
On this for some hours now, made some progress but still no idea what's the problem. 😭 I'll just dump some information here in the hope that sparks some heureka moment in someone. I could not reproduce the problem on my Windows computer because of Anyways, I've tried to reduce the number of tests one had to run to find the issue, and I managed to remove quite a few test files until I had a small enough set of tests that still manifested the problem, reducing the test suite time to 8 seconds. I pushed a branch to my fork in order to continue this tomorrow or if others want to take a look. Some facts:
Well that's what I can remember now with my tired brain at this late hour. I plan to continue debugging this tomorrow, but any comments or insights are welcome. 😅 |
I can confirm that subset reproduces it for me. I could also get rid of When I comment out
So it sounds like it's - pure speculation - something with the stack getting bigger with more test items, and then at some point too big? By the way: I also tried uninstalling When I catch that
I then tried finding out what diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py
index 383e41b..6d3a8d9 100644
--- a/_pytest/fixtures.py
+++ b/_pytest/fixtures.py
@@ -748,7 +748,11 @@ class FixtureDef:
try:
while self._finalizer:
func = self._finalizer.pop()
- func()
+ try:
+ func()
+ except RecursionError:
+ sys.setrecursionlimit(sys.getrecursionlimit() + 100)
+ import pdb; pdb.set_trace()
finally:
ihook = self._fixturemanager.session.ihook
ihook.pytest_fixture_post_finalizer(fixturedef=self) Turns out it's indeed the finalizer of
So I placed a breakpoint in the fixture after
Okay, the
No finalizers left. Let's continue stepping:
Inside some hook stuff I don't understand, so I started using
Oh, we ended up here again. Now how does
😱 I have no idea how this happens, but I have a @pytest.fixture(scope='session')
def qapp(qapp):
"""Change the name of the QApplication instance."""
qapp.setApplicationName('qute_test')
return qapp If I don't override from PyQt5.QtWidgets import QApplication
early_qapp = QApplication([]) things work fine again. |
FYI: I edited the post above multiple times to provide more and more information - so don't view it via email 😉 |
@The-Compiler thanks a lot for the debugging help! I will continue this tonight. 😅 Me this morning: "Hmm if only I knew of a project which used PyQt5 and QtWebKit on Windows, so I can see which package they use to install it hassle-free..."... duh. I face-palmed so hard I almost knocked myself out. 😆 |
Installing Python 3.4 and PyQt 5.5.1 (e.g. from here, or probably still available on sourceforge) might be the easiest way. |
Yep, the face-palm moment was due to the fact that I could just have seen how qutebrowser did it. 😁 |
Right - seems like we both need more ☕ 😉 |
Quick update: I've made some progress and I understood what the problem is, but I'm still in the process of reproducing this in an isolated test. 😬 |
Due to a serious regression found in pytest-dev#1794, it was decided to pull off invocation features from 3.0 so it can be (hopefully) re-introduced in 3.1
As discussed in pytest-dev/pytest#1794, it was decided to postpone this until 3.1
Due to a serious regression found in pytest-dev#1794, it was decided to pull off invocation features from 3.0 so it can be (hopefully) re-introduced in 3.1
(@The-Compiler I changed the title of this issue, I hope that's OK) |
When this is tackled, make sure to revert the fix for #1872 |
What's the state of this? |
No progress, unfortunately. There were two approaches that were discussed/implemented:
I gave it another try right after 3.0 was out but I'm not sure it is possible with the current architecture. We would probably have to rethink how things are implemented in order to support this in all the possible use cases. In summary, I don't think this will land in 3.1 unless someone else gives it a shot. 😞 |
Too bad, but don't feel 😞! :) Is there some WIP branch somewhere? I've came back to this because I've started for at least the 2nd time to have some |
@blueyed main reason there is no wip is, that the current internals of fixtures make multi scoped fixtures on top of them a mess that can easily break apart my current suspicion is that we need to rewrite the internals from ground up to enable it :( |
We have reverted invocation scoped fixtures and I've reopened the original issue in #1681, so I'm closing this for now. |
Fix an issue in our PyTest wrapper, that caused this recursion error: ``` File "shibokensupport/signature/loader.py", line 61, in feature_importedgc File "shibokensupport/feature.py", line 137, in feature_importedgc File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc lines, lnum = getsourcelines(object)gc File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc lines, lnum = findsource(object)gc File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc lines = linecache.getlines(file, module.__dict__)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc self.__makeattr(name)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc result = importobj(modpath, attrname)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc module = __import__(modpath, None, None, ["__doc__"])gc File "shibokensupport/signature/loader.py", line 54, in feature_importgc RecursionError: maximum recursion depth exceededgc ``` This error seems to be related to pytest-dev/pytest#1794. By not importing `pytest` in our test wrapper, and instead executing directly, we can avoid it.
Fix an issue in our PyTest wrapper, that caused this recursion error: ``` File "shibokensupport/signature/loader.py", line 61, in feature_importedgc File "shibokensupport/feature.py", line 137, in feature_importedgc File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc lines, lnum = getsourcelines(object)gc File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc lines, lnum = findsource(object)gc File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc lines = linecache.getlines(file, module.__dict__)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc self.__makeattr(name)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc result = importobj(modpath, attrname)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc module = __import__(modpath, None, None, ["__doc__"])gc File "shibokensupport/signature/loader.py", line 54, in feature_importgc RecursionError: maximum recursion depth exceededgc ``` This error seems to be related to pytest-dev/pytest#1794. By not importing `pytest` in our test wrapper, and instead executing directly, we can avoid it. Note that this seems to be triggered only by Shiboken6, which is why we hadn't previously encountered it.
Fix an issue in our PyTest wrapper, that caused this recursion error: ``` File "shibokensupport/signature/loader.py", line 61, in feature_importedgc File "shibokensupport/feature.py", line 137, in feature_importedgc File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc lines, lnum = getsourcelines(object)gc File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc lines, lnum = findsource(object)gc File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc lines = linecache.getlines(file, module.__dict__)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc self.__makeattr(name)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc result = importobj(modpath, attrname)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc module = __import__(modpath, None, None, ["__doc__"])gc File "shibokensupport/signature/loader.py", line 54, in feature_importgc RecursionError: maximum recursion depth exceededgc ``` This error seems to be related to pytest-dev/pytest#1794. By not importing `pytest` in our test wrapper, and instead executing directly, we can avoid it. Note that this seems to be triggered only by Shiboken6, which is why we hadn't previously encountered it.
Fix an issue in our PyTest wrapper, that caused this recursion error: ``` File "shibokensupport/signature/loader.py", line 61, in feature_importedgc File "shibokensupport/feature.py", line 137, in feature_importedgc File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc lines, lnum = getsourcelines(object)gc File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc lines, lnum = findsource(object)gc File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc lines = linecache.getlines(file, module.__dict__)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc self.__makeattr(name)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc result = importobj(modpath, attrname)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc module = __import__(modpath, None, None, ["__doc__"])gc File "shibokensupport/signature/loader.py", line 54, in feature_importgc RecursionError: maximum recursion depth exceededgc ``` This error seems to be related to pytest-dev/pytest#1794. By not importing `pytest` in our test wrapper, and instead executing directly, we can avoid it. Note that this seems to be triggered only by Shiboken6, which is why we hadn't previously encountered it.
Fix an issue in our PyTest wrapper, that caused this recursion error: ``` File "shibokensupport/signature/loader.py", line 61, in feature_importedgc File "shibokensupport/feature.py", line 137, in feature_importedgc File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc lines, lnum = getsourcelines(object)gc File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc lines, lnum = findsource(object)gc File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc lines = linecache.getlines(file, module.__dict__)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc self.__makeattr(name)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc result = importobj(modpath, attrname)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc module = __import__(modpath, None, None, ["__doc__"])gc File "shibokensupport/signature/loader.py", line 54, in feature_importgc RecursionError: maximum recursion depth exceededgc ``` This error seems to be related to pytest-dev/pytest#1794. By not importing `pytest` in our test wrapper, and instead executing directly, we can avoid it. Note that this seems to be triggered only by Shiboken6, which is why we hadn't previously encountered it.
Fix an issue in our PyTest wrapper, that caused this recursion error: ``` File "shibokensupport/signature/loader.py", line 61, in feature_importedgc File "shibokensupport/feature.py", line 137, in feature_importedgc File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc lines, lnum = getsourcelines(object)gc File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc lines, lnum = findsource(object)gc File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc lines = linecache.getlines(file, module.__dict__)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc self.__makeattr(name)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc result = importobj(modpath, attrname)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc module = __import__(modpath, None, None, ["__doc__"])gc File "shibokensupport/signature/loader.py", line 54, in feature_importgc RecursionError: maximum recursion depth exceededgc ``` This error seems to be related to pytest-dev/pytest#1794. By not importing `pytest` in our test wrapper, and instead executing directly, we can avoid it. Note that this seems to be triggered only by Shiboken6, which is why we hadn't previously encountered it.
Fix an issue in our PyTest wrapper, that caused this recursion error: ``` File "shibokensupport/signature/loader.py", line 61, in feature_importedgc File "shibokensupport/feature.py", line 137, in feature_importedgc File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc lines, lnum = getsourcelines(object)gc File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc lines, lnum = findsource(object)gc File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc lines = linecache.getlines(file, module.__dict__)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc self.__makeattr(name)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc result = importobj(modpath, attrname)gc File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc module = __import__(modpath, None, None, ["__doc__"])gc File "shibokensupport/signature/loader.py", line 54, in feature_importgc RecursionError: maximum recursion depth exceededgc ``` This error seems to be related to pytest-dev/pytest#1794. By not importing `pytest` in our test wrapper, and instead executing directly, we can avoid it. Note that this seems to be triggered only by Shiboken6, which is why we hadn't previously encountered it.
When I try to run the qutebrowser testsuite with the current git
features
branch, I get:test_timeout_set_interval
seems unrelated, as this is just the teardown of a session-scoped fixture. However, when I only run pytest ontests/end2end
I can't reproduce this...The
httpbin
fixture is defined here.I have no idea what's happening though... Taking the freedom to mark this as critical as it might be a serious 3.0 regression for other testsuites too.
The text was updated successfully, but these errors were encountered: