Closed bachya closed 2 weeks ago
This seems to be related to future cancellation. Gonna open up a PR for this later today. It would be quite helpful if you'll be able to test that branch directly building Granian from source.
I didn't get a chance to review before this was merged, but I was able to test the master
branch:
granian[reload] @ git+https://github.com/emmett-framework/granian@master
Unfortunately, the issue persists—after a single HTTP request (with a streaming response), I see the same message:
thread '<unnamed>' panicked at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ptr/mod.rs:514:1:
Cannot drop pointer into Python heap without the GIL being held.
stack backtrace:
0: 0xffffa7be26fc - <unknown>
1: 0xffffa7b22b9c - <unknown>
2: 0xffffa7bc0364 - <unknown>
3: 0xffffa7be3900 - <unknown>
4: 0xffffa7be3258 - <unknown>
5: 0xffffa7be4218 - <unknown>
6: 0xffffa7be3c00 - <unknown>
7: 0xffffa7be3b98 - <unknown>
8: 0xffffa7be3b8c - <unknown>
9: 0xffffa7684c70 - <unknown>
10: 0xffffa795a180 - <unknown>
11: 0xffffa783a7cc - <unknown>
12: 0xffffa76c54a8 - <unknown>
13: 0xffffa76ee5c4 - <unknown>
14: 0xffffa7be4da0 - <unknown>
15: 0xffffa843ee58 - <unknown>
16: 0xffffa84a7f9c - <unknown>
17: 0x0 - <unknown>
[ERROR] Unexpected exit from worker-1
[INFO] Shutting down granian
@bachya can you provide a MRE so I can test it locally with the debug build?
@bachya I was able to reproduce this locally and just pushed 8332f65. If you can confirm this is fixed I'll close the issue and release a patch version.
@gi0baro Looks like https://github.com/emmett-framework/granian/commit/8332f65ccf1add5713a7509ae6c9f8ef6a695582 worked: I ran my streaming response request 10 times in a row and didn't see the previous crash. Thank you!
@bachya thank you for your patience! 1.5.1 release on the way ;)
I have a FastAPI app that returns a streaming response. I instantiate the app via this CLI command:
Irregularly (i.e., once every 2-3 tries), I get the following stacktrace:
Unfortunately, that's all. Happy to provide more info with some guidance.