pygfx / wgpu-py

The next generation GPU API for Python
https://wgpu-py.readthedocs.io
BSD 2-Clause "Simplified" License
391 stars 31 forks source link

Windows fatal exception: stack overflow during passing tests #494

Closed Vipitis closed 1 week ago

Vipitis commented 2 months ago

I was running the tests from wgpu-shadertoy and saw a Windows fatal exception: stack overflow followed by a stacktrace originating from this line: https://github.com/pygfx/wgpu-py/blob/12544872f178860e1b9d7fd4344818188da0c1c6/wgpu/backends/wgpu_native/_helpers.py#L90 I managed to get the same behaviour during the tests in wgpu-py

Here is the crazy bit: the tests actually passed just fine. And it doesn't seem like running any examples triggers this. Leading me to believe it's due to pytest. Not sure if this is an issue with wgpu-py even.

To Reproduce

pytest tests -vvsk "backends" (also happens without those flags)

Observed behavior

error trace but pass during test_diagnostics.py::test_diagnostics_with_backends

Screenshots

image

You Environment

I synced my fork, reinstalled it in pip, run download-wgpu-native.py and even installed dev requirements with -U; not sure what actually changed - maybe my Intel GPU drivers which are now 5444. Issue persist after system reboot

Korijn commented 2 months ago

You can rule out pytest by calling the test function directly in a throwaway script?

Vipitis commented 2 months ago

I run a script like this

import wgpu.backends.wgpu_native

text = wgpu.diagnostics.get_report()

assert "Device" in text
assert "RenderPipeline" in text
assert "ShaderModule" in text

(copy and pasted the body of that test) and get no such error.

Additionally running pytest examples will also print the same trace during the second test examples/tests/test_examples.py::test_examples_screenshots[cube]. Which actually gets skipped on my system. This error also traces back to this same line. But subsequent tests, which also create an instance - do not trigger this.

So I think it's a combination of pytest and my system. Nothing actually breaks - but this seems concerning. And I am not sure how to dig deeper.

Vipitis commented 2 months ago

I did not observe this on my windows laptop. This might be GPU specific. I will try to dig a little deeper and raise it with Intel

Vipitis commented 1 week ago

I have since updated to driver 5594 and this no longer shows up. So I assume it has been fixed on the intel side and we will likely never know why that was an issue with pytest - closing.

Korijn commented 1 week ago

That's crazy! 🤣 Happy to hear the driver update resolved the issue.