You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
file blocking call in async sendFile(). Can sendFile() be executed in worker thread executeBlocking()? I searched and found the answer is no.
Version
4.4.9
Context
Http1xServerResponse.sendFile() should be an async call and executed in event loop thread. However, I observed it calls raf = new RandomAccessFile(file, "r"); inside doSendFile():
we will support in 5.0.1 a sendFile version that accepts a FileChannel leaving you the ability to avoid this and handle yourself the creation of the FileChannel
Hello @lllxin037, I am currently working on a PR that might fix that (#5558)
This PR is in progress but the idea is to give the possibility to have a new version of sendFile that accept a FileChannel for HttpServerResponse
This will let you manage the FileChannel on your own and pass it to HttpServerResponse. The ownership of FileChannel closing will be on the caller side
Uh oh!
There was an error while loading. Please reload this page.
Questions
file blocking call in async sendFile(). Can sendFile() be executed in worker thread executeBlocking()? I searched and found the answer is no.
Version
4.4.9
Context
Http1xServerResponse.sendFile() should be an async call and executed in event loop thread. However, I observed it calls raf = new RandomAccessFile(file, "r"); inside doSendFile():
vert.x/src/main/java/io/vertx/core/http/impl/Http1xServerResponse.java
Line 574 in 23e921c
new RandomAccessFile() internally calls RandomAccessFile.open() which is a blocking IO operation.
Why sendFile() behave in such way ? In a high pressure workload, I saw thread has been blocked due to this.
Should I call sendFile() in executeBlocking() or not ? If not, what I can do ?
Do you have a reproducer?
No
Extra
Linux + JDK 17.
The text was updated successfully, but these errors were encountered: