kunwp1 opened a new issue, #9350:
URL: https://github.com/apache/texera/issues/9350

   Part of #9347.
   
   ### What happened?
   
   `LakeFSFileDocument` opens presigned URLs with `new URL(url).openStream()`. 
When the connection is closed before the declared `Content-Length` (for 
example, by a gateway timeout on a multi-GB download), `HttpURLConnection` 
reports an ordinary end of stream: `read` returns -1 and no exception is 
thrown. So `asInputStream()` callers get a short body with no error, and 
`asFile()` saves it as the file. The failure then surfaces later as a 
misleading format error, such as Arrow's `missing Magic number` with different 
bytes on every attempt. A failed copy in `asFile()` also leaves its partial 
`versionedFile*.tmp` on disk.
   
   Expected: a download that ends short of its `Content-Length` fails with an 
error saying it was cut off, and leaves no partial temp file.
   
   ### How to reproduce?
   
   1. Serve a presigned object from an `HttpServer` stub that declares the full 
`Content-Length` and closes after sending half the body.
   2. Read it through `LakeFSFileDocument.asInputStream()` or `asFile()`.
   3. The read completes normally with half the bytes. No exception is thrown, 
and `asFile()` returns the truncated file.
   
   Against a real deployment, reading a 1.3 GB presigned object with `new 
URL(url).openStream()` and a slow consumer behind a 15s gateway timeout ends 
normally at about 356 MB.
   
   ### Version/Branch
   
   1.4.0-incubating-SNAPSHOT (main)
   
   ### Commit Hash (Optional)
   
   bb6136d
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to