Open scrmtrey91 opened 1 year ago
I have the same problem in my app...
Transferred the issue to Flow. It might also be related to Payara, there are multiple similar issues reported online.
It looks like it is the problem with payara server. The same problem occurs on payara 6 aswell.
We tried wildfly for testing purposes and multi upload works no problem.
Is this fixable for payara server ?
We might be forced to use wildfly in the future because more and more problems with payara server.
If you can already pin point the problem to payara, why aren't you opening an issue there as well?
We didnt think it is payara issue until mentioned here.
We cant just change server in production thats why we didnt think is payara fault and that is another reason why we did not check with wildfly for example.
i did not even imagine that server can impac an UI component from vaadin.
So i did a little reasearch.
And here is the "solution".
In payara i disable HTTP2 and only use HTTP1. Multi upload started working.
Also download file with special charachters start working again with http2 disabled.
Sometimes resources does not load (icon png images on dashboard in our app) Disable http2 and boom all good..
So it looks like combination payara + vaadin23 + http2 = bad experience
We also check vaadin 8 application and vaadin 8 also use http2 but we did not have problems like this.
Trying to debug this issue it seems that when we are in http2 the issue is that instead of the upload requests coming in in parts everything comes up at once for all files overwhelming the server which the blocks and timeouts.
A small help was making the HTTP/2 Max Concurrent Streams:
larger from the default 100 to for instance 1000, but much bigger and it didn't make a difference.
A better, but not complete fix was to add a sleep to upload when adding multiple files at once so anything calling addFile(file)
having a small timeout for each file e.g. (file, i) => { setTimeout(()=>{this._addFile(file);},i*50); }
Which basically fixed the issue when running on http2, but still fails on the blocking function when pushing big files (40+ megs)
Framework 8 didn't have the same style of multifile upload so thats probably why it didn't have the same issue.
This is to part the same problem that the client opens too many connections (as in vaadin/web-components#6698) due to the possibility of multiplexing in HTTP/2 sending all request concurrently.
I would claim that this is a bug in our Upload component, not in Payara or Flow(framework part). It is by no means sane to fire unlimited amount of XHRs to upload each file separately. Either it should queue all files in one multipart requests or throttle the amount of concurrent connections as suggested by @caalador.
I was recently fiddling with other (only slightly related) upload issues and renewed the UploadFileHandler component in Viritin quite throughly. That is essentially Upload with better Java API. That component now (since version 2.5.1), in addition to making the API much simpler, limits the amount of concurrent uploads to one by default. Give it a shot and let me know if it don't work!
Description
We have form that user can upload files to a document.
If we use MemoryBuffer and only 1 file upload max, it is working no problem.
When we use MultiFileMemoryBuffer and multiple files upload at once, then the we encounter a problem.
Sometimes it doesnt rise immediatly but lets say after 10-15s (even if user close the form). So probably something broken in the background of MultiFileMemoryBuffer (probably with thread safety related).
We also use automatic PUSH websocket xhr.
The problem occur in dev and production.
Also the other problem is that application after this upload error the whole server is unusable, all web services, UI throw "read timeout exceptions", all stop working.
We also pay for PRO subscription which is not cheap 130 EUR per month for broken components.
Expected outcome
Multi file upload should work out of the box with no errors and broken the whole server.
Minimal reproducible example
Empty app with push and upload component with no listeners.
Steps to reproduce
1) Deploy app 2) Mutli file upload (mix of pdf, png etc)... 3) Sometimes works, 90% time is broken
Environment
Vaadin version(s): 23 (latets, but present in early realeases also) Browser: Chrome latest / Edge latest Server: Payara 5.2022.5 JDK: Java 17 latest
Browsers
Chrome, Edge