question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uploading files using the Java SDK results in a Resetting to invalid mark error when part size is more than 2gb.

See original GitHub issue

We are building the Put objects argument builder as follows:

PutObjectArgs.builder() .bucket("test-bucket") .object("test-identifier") .stream(stream, -1, 3000000000) .contentType("application/octet-stream") .build();

This works well for both Minio server and Amazon S3 but we noticed that when we set the part size to more than 2gb, in this case its 3000000000 it throws an error when uploading.

Part sizes lesser than or equal to 2gb works.

The stream we are passing is a bufferedinputstream.

Uploading via presigned urls works even if the part size is more than 2gb.

This happens whether the file size we are uploading is greater than or lesser than the part size.

Expected Behavior

Should be able to upload a file in Minio/S3

Current Behavior

Upload fails with the error:

Caused by: java.io.IOException: Resetting to invalid mark at java.base/java.io.BufferedInputStream.reset(BufferedInputStream.java:454) at io.minio.S3Base.getAvailableSize(S3Base.java:1230) at io.minio.S3Base.putObject(S3Base.java:1134) at io.minio.MinioClient.putObject(MinioClient.java:1666)

Possible Solution

Steps to Reproduce (for bugs)

Context

Regression

Your Environment

Minio 8.2.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
klauspostcommented, Jun 24, 2021

@balamurugana I am not java expert, but it would seem to me that you are overflowing the int conversion when > 2G here:

https://github.com/minio/minio-java/blob/836359242f62c5add495a873d26a7c071f182a02/api/src/main/java/io/minio/S3Base.java#L1218

So sending negative size?

0reactions
balamuruganacommented, Jun 24, 2021

@balamurugana Is the buffer essential to have the same size as the part size?

@klauspost FYI https://github.com/minio/minio-java/issues/1204

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception stating " Resetting to invalid mark " comes while ...
I'm going to assume you are using a BufferedInputStream because its source code for reset() method is public synchronized void reset() ...
Read more >
TransferManager multipart upload from a FileInputStream ...
If the stream does not support mark and reset, then the SDK throws ResetException when there are any transient failures and retries are...
Read more >
java.io.IOException: Resetting to invalid mark in ...
Hi Vincenzo, I think your issue is related to the input fileInputStream: somehow it's not able to be reset. Maybe the underlying file...
Read more >
File upload and download troubleshooting FAQs - Pega
This article provides answers to frequently asked questions about the file upload and download functionality of the Pega engine.
Read more >
Resolve issues with uploading large files in Amazon S3
To upload a file that is larger than 160 GB, use the AWS CLI, AWS SDK, or Amazon S3 REST API. AWS CLI....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found