Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

putObject does not work when a stream contains multiple chunks #255

Closed
rtimush opened this issue Sep 7, 2021 · 4 comments · Fixed by #256
Closed

putObject does not work when a stream contains multiple chunks #255

rtimush opened this issue Sep 7, 2021 · 4 comments · Fixed by #256

Comments

@rtimush
Copy link

rtimush commented Sep 7, 2021

It tries to upload every chunk with putObject and fails with the following error because the chunk size is not equal to the content length:

software.amazon.awssdk.services.s3.model.S3Exception: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

This seems to be introduced in #251 when .toPublisher has been removed. Version 0.3.5 works fine in this regard.

@regis-leray
Copy link
Member

Hello thank you for the report.

Can you please provide a test use case to reproduce this error, if you have any.

i will look into it

@regis-leray
Copy link
Member

can you also provide the fullstacktrace

@rtimush
Copy link
Author

rtimush commented Sep 7, 2021

Here is the test case, it's the same as https://github.com/zio/zio-s3/blob/master/src/test/scala/zio/s3/S3Test.scala#L205 just with .chunkN added:

      testM("put object") {
        val c             = Chunk.fromArray("Hello F World".getBytes)
        val contentLength = c.length.toLong
        // chunkN ensures that the stream has multiple chunks
        val data          = ZStream.fromChunks(c).chunkN(5)
        val tmpKey        = Random.alphanumeric.take(10).mkString

        for {
          _                   <- putObject(bucketName, tmpKey, contentLength, data)
          objectContentLength <- getObjectMetadata(bucketName, tmpKey).map(_.contentLength) <*
                                   ZFiles.delete(root / bucketName / tmpKey)
        } yield assert(objectContentLength)(equalTo(contentLength))

      },

@regis-leray
Copy link
Member

thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants