-
Notifications
You must be signed in to change notification settings - Fork 515
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
ValueError: I/O operation on closed file #2375
Comments
Hey @dakotahorstman ! Could you by any chance come up with a minimal project where I can reproduce this? This would greatly help debugging this. |
It will take me a bit of time to create an MRE, but I think I've narrowed it down to something with Daphne/Channels. I just tested with 'runserver_plus', provided by django-extensions, which does not have ASGI support--therefore no channels--and the issue does not occur. Since my ASGI server in the dev environment is daphne, perhaps something internal in it is causing this (such as prematurely closing the temporary file; not sure). Also, when I access the request body in my views, I can see that it is a bytes string ( I use django-cookiecutter as my project starting point should you want to try and reproduce this while you wait for me to get you an example. |
Just tried testing with |
Thanks for the update! As we are a little bit swamped right it will take some time until we can have a look at this. |
@dakotahorstman finally have some time to look at this. It seems the ASGI support was broken since Django 4.2. I have a PR ready, still need to fix some tests but then it should be ready to merge and thus fixed! Thanks again for reporting this! |
Perfect! Thanks for looking into this. Apologies for not getting you an MRE, this issue doesn't seem to affect operations, so I completely forgot about it after, like yourself, drowning in my own workload. Please let me know if there is anything else I can provide :) |
Thanks, but now everything is solved, the fix should be released soon. |
How do you use Sentry?
Self-hosted/on-premise
Version
1.31.0
Steps to Reproduce
I use sentry in a Python 3.11, Django/Channels/Celery/Docker application. This issue pops up when I refresh my web pages. These pages may or may not have a websocket connection (channels) and do not kick off any celery task when loaded. The application runs in a docker container using the system (container) python interpreter. (It does not matter if the interpreter is in a venv or the system). I use poetry to manage my dependencies, which are listed below.
Weirdly enough, I have another identical setup for another project and I do not encounter this issue. In fact, I copy-pasted the sentry settings from that project to this one and have not modified them except for the DSN. The only real difference between that one and this one is the other is using Django 4.0.x, whereas this project is using Django 4.2.x.
This is a development environment, so therefore I am using
python manage.py runserver 0.0.0.0:8000
through VSCode's debugger in a devcontainer.(My application is also listed here as an editable install, I removed it for ease of copy-paste)
Expected Result
Not an error.
Actual Result
Here is the stacktrace, graciously provided by loguru, from the start of the request until it finishes:
My sentry configuration:
Note that this error is NOT logged by sentry.
The text was updated successfully, but these errors were encountered: