igniterealtime / openfire-httpFileUpload-plugin

Adds XEP-0363 functionality to Openfire that allows compliant clients to exchange files
Apache License 2.0
9 stars 10 forks source link

Server returns 500 error on upload. Fixed by restarting openfire service but problem keeps appearing later. #26

Open hakakou opened 3 years ago

hakakou commented 3 years ago

Using OpenFire 4.6.4, HTTP File Upload 1,1.3, on Windows Server 2016. I'm using a converse.js client to upload files in the chat. Almost always it's succesful, however sometimes the response from the server is a 500 error. In the openfile logs, under the "All" tab, I see lines like:

2021.09.06 02:03:37 nl.goodbytes.xmpp.xep0363.Component - Entity 'xic.support@chat.xxx.com/converse.js-44692399' tries to obtain slot.
2021.09.06 02:03:37 nl.goodbytes.xmpp.xep0363.Component - Entity 'xic.support@chat.xxx.com/converse.js-44692399' obtained slot for 'DSC5659.jpg' (1741635 bytes). PUT-URL: https://chat.xxx.com:7443/httpfileupload/0f341d6d-564e-45d3-b0a2-1648f6f25450/DSC5659.jpg GET-URL: https://chat.xxx.com:7443/httpfileupload/0f341d6d-564e-45d3-b0a2-1648f6f25450/DSC5659.jpg
2021.09.06 02:03:37 nl.goodbytes.xmpp.xep0363.Servlet - Processing PUT request... (XX.XX.112.23 submitting to /httpfileupload/0f341d6d-564e-45d3-b0a2-1648f6f25450/DSC5659.jpg)
--- nothing else after about the upload

In the "Warn Tab"

2021.09.06 02:03:37 org.eclipse.jetty.server.HttpChannel - handleException /httpfileupload/0f341d6d-564e-45d3-b0a2-1648f6f25450/DSC5659.jpg java.nio.file.NoSuchFileException: C:\Windows\TEMP\xmppfileupload3257014815371578219\0f341d6d-564e-45d3-b0a2-1648f6f25450

The problem is that if I start getting these errors, then they appear indefinitely on every upload. However problem is fixed immediately if I restart the openfire service.

For example, if I restart the service, the upload works fine, and the logs are instead:

2021.09.06 02:08:13 nl.goodbytes.xmpp.xep0363.Servlet - Processing PUT request... (XX.XX.112.23 submitting to /httpfileupload/8c8018b8-1e1b-4ad3-bb68-4fa95a9293ec/DSC5659.jpg)
2021.09.06 02:08:14 nl.goodbytes.xmpp.xep0363.Servlet - ... responded with CREATED. Stored data from the request body in the repository.
2021.09.06 02:08:15 nl.goodbytes.xmpp.xep0363.Servlet - Processing GET request... (XX.XX.112.23 requesting from /httpfileupload/8c8018b8-1e1b-4ad3-bb68-4fa95a9293ec/DSC5659.jpg)
2021.09.06 02:08:15 org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Sequences
2021.09.06 02:08:15 nl.goodbytes.xmpp.xep0363.Servlet - ... responded with OK and included the data in the response body.

Any hints on how to fix this problem? After each service restart, the uploads work again for perhaps 24 hours, until this problem starts appearing again. I have checked permissions on c:\windows\temp, and this is not the problem.

guusdk commented 3 years ago

Hmm... I wonder if this is caused by your operating system automatically purging the temp folder that is being used.

You could try to use a different directory by adding this system property to Openfire plugin.httpfileupload.fileRepo (you will need to restart the plugin afterwards).