-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Media upload fails with ValueError: seek of closed file
#6192
Comments
I'm also running into this problem. Also running Ubuntu 18.04 and behind an nginx reverse proxy inside a VM (Hyper-V). Has anyone been able to get more information on this? |
I found the fix. Uncomment the max upload line in the homeserver.yaml settings and change the limit to something like 25M or whatever you'd like. Go to the reverse proxy and open the config file for your site (/etc/nginx/sites-available) add client_max_body_size 25M; parameter somewhere in the server block. Can make the size whatever you'd like. Then lastly, add the same parameter for the nginx config on the server that is hosting matrix-synapse. |
it's expected that an upload will fail if you try to upload a file larger than the limit. But it sounds like the error message could be clearer, and synapse shouldn't spit exceptions into its logs. |
keywords: Related: #1610 |
This doesn't appear to be the issue in my configuration. |
@jonaharagon well something is different because I get a nice error message. What is your |
I'm having the same issue, with very similar errors to the OP, both in the server logs and the client. It happens to me for files at around 400MB+, but uploading the same exact file sometimes succeeds, sometimes fails. I'm not using a reverse proxy, files of any type fail, and I get the same "Upload Failed" error as OP. |
ValueError: seek of closed file
The error seen appears to happen as a result of a client (or proxy) closing an upload connection after sending all the data but before Synapse has responded. It looks like Twisted does some buffering, so turning off request buffering in the reverse proxy doesn't change the timings. Steps to reproduce the error
Perhaps one cause is Synapse taking too long to process the upload and clients timing out? |
Synapse may take a long time to process the upload if all threads in the default thread pool are busy (see #11049). Can people confirm whether they were running Synapse in single process or worker mode when they saw these failures? |
@squahtx single process for me. I didn't know workers were a thing, my homeserver has 3 users. if CPU usage is of any value, I'll note I've never seen above 2%. my load averages are all 0.00.
I don't know whether my problem is still related to this issue. |
@retrotails Do you have a reverse proxy in front of Synapse, such as nginx? If you do, could you test the |
1.46.0rc1 (to be released within the next day) may reduce the frequency of upload failures thanks to the fix for #11049. The race condition still needs to be fixed. |
@squahtx when I made my comment 20 months ago and had nearly an identical error to the OP, I was not using a reverse proxy. I am now using nginx, so I set |
@retrotails The timeout could be originating from anything in between your client and Synapse. From inspecting the code, Synapse ought to not time anything out while it's continually receiving data and I think the same applies to nginx. Could you clarify which client(s) you're seeing the issue on, plus their versions? Are there any proxies in between your client and Synapse, apart from nginx? |
@squahtx no proxy aside from nginx, I have the issue with both element android (the latest on fdroid, reports as |
Any updates? I can send jpegs but a larger file (>10mb) fails with the same error message of op. |
I'm wholly unable to reproduce the issue. The error in the OP means that the client, reverse proxy, or anything in between aborted the request before Synapse received all the data and saved it. If you're having issues with a self-hosted instance of Synapse, it'd be extremely helpful to provide:
|
Hey sorry. I fixed the problem with the solution of Jukong (Go to the reverse proxy and open the config file for your site (/etc/nginx/ ...) add client_max_body_size 25M;) |
I'm running into what I imagine is the same issue as well.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
(have hidden comments unrelated to this issue. Please note we're unable to provide general user support via the issue tracker.) |
Any updates on this issue? |
For large files (>100MiB), we suspect #13009 to be the cause. |
I was having this problem too. No file, no matter how big or small, could be uploaded. |
Description
Media uploads are failing.
Steps to reproduce
Uploading any file in Riot (any platform) results in the upload failing.
I also see similar errors ending in
ValueError: I/O operation on closed file.
on some uploads. I can upload the homeserver.log if needed.Version information
If not matrix.org:
Version: 1.4.0
Install method: apt
The text was updated successfully, but these errors were encountered: