An exception “The Content-MD5 you specified did not match what we received”

后端 未结 5 1627
谎友^
谎友^ 2021-01-17 17:14

I got an exception, I never got before when testing my application that uploads a file from ec2 to s3. The content is:

Exception in thread \"Thread-1\" com.a         


        
5条回答
  •  Happy的楠姐
    2021-01-17 17:44

    I think I have solved my problem. I finally found that some of my files actually changed during the uploading. Because the file is generated by another thread, the uploading and generating is done at the same time. The file can not be generated immediately, and during the generating of a file, it may be uploading at the same time, the file actually changed during the uploading.

    The md5 of file is created at the beginning of uploading by the AmazonS3Client, then the whole file is uploaded to the S3, at this time, the file is different from the file uploaded at beginning, so the md5 actually changed. I modified my program to a single-threading program, and the problem never turned up again.

提交回复
热议问题