Coder Social home page Coder Social logo

Multipart Upload Issue(s) about oci-go-sdk HOT 10 CLOSED

oracle avatar oracle commented on June 14, 2024
Multipart Upload Issue(s)

from oci-go-sdk.

Comments (10)

jasonyin avatar jasonyin commented on June 14, 2024

Thanks for reporting the issue. Is it for uploadPart API? Are you using a proxy server? Do you have same issue for PutObject API (single upload).

from oci-go-sdk.

gcstang avatar gcstang commented on June 14, 2024

from oci-go-sdk.

jasonyin avatar jasonyin commented on June 14, 2024

For your first timeout error, you can either change the clientTimeout, but for larger object or unreliable network which takes un-predictable time to upload (wait for responseHeader come back). You could also set the http.Transport.ResponseHeaderTimeout to 0.

BTW, for "latest version of oci-go-sdk", were you referring to V1.2.0?

Looks like you are not using the default httpClient or http.Transport? If yes, could you pls share the code so I can try to repro the issue you have?

from oci-go-sdk.

gcstang avatar gcstang commented on June 14, 2024

I'm using the Latest version of Master and whatever httpClient is built into the code pkgs
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/example/helpers"
"github.com/oracle/oci-go-sdk/objectstorage"

from oci-go-sdk.

jasonyin avatar jasonyin commented on June 14, 2024

I need more information to debug the issue, especially how you split the file into multi-parts. Sharing the code would be helpful, however, with limited information here, I noticed that the http.ContentLength is different than the body length which will cause golang http transport through error. Could be an bug around 'UploadPartBody' for UploadPartRequest. I would try to set it as

UploadPartBody: ioutil.NopCloser(bytes.NewReader(buffer)),

net/http: HTTP/1.x transport connection broken: http: ContentLength=104857600 with Body length 385447926

After Change to smaller split size:
net/http: HTTP/1.x transport connection broken: http: ContentLength=20971520 with Body length 385447926

from oci-go-sdk.

gcstang avatar gcstang commented on June 14, 2024

@jasonyin I'll put something together and add it to the ticket but this is part of a larger application so it will take me a little while.

Not sure this small part will help, otherwise I'll work on the attachment.

`func (o *ObjStore) UploadPart(bucketName, objectName, uploadId string, partNo, contentLength int, content io.ReadCloser) *string {
namespace := o.GetNamespace()
request := objectstorage.UploadPartRequest{
NamespaceName:&namespace,
BucketName:&bucketName,
ObjectName:&objectName,
UploadId:&uploadId,
UploadPartNum:&partNo,
ContentLength:&contentLength,
UploadPartBody:content,
}

r, err := o.client.UploadPart(*o.context, request)
helpers.LogIfError(err)

return r.ETag

}`

from oci-go-sdk.

jasonyin avatar jasonyin commented on June 14, 2024

Thanks for sharing the info!

There are two key input parameters here, contentLength and content (in your sample code):

  1. The contentLength is the length of the part you are uploading (100M or 20M in your error trace) which is correct;

  2. Body length (shows in the error trace) is 368M fixed which looks wrong to me, it should be same as the part size you are uploading (i.e. 20M or 100M depends on the size of part), it's not the size of the file you are uploading (368M). The body length in the error trace comes from your content parameter( io.ReaderCloser), I suspect that the content parameter you are using was wrong. Here is a sample code, hoping it helps to debug the issue:

// make a buffer with partSize (i.e. 20M or 100M)
buffer := make([]byte, partSize)

// load content from the file you are uploading into a buffer
_, err := file.ReadAt(buffer, offset)

// try to update your code with following line, I think it most likely would fix the issue
content := ioutil.NopCloser(bytes.NewReader(buffer))

Please let me know if you have any questions/issues, thanks!


net/http: HTTP/1.x transport connection broken: http: ContentLength=104857600 with Body length 385447926

After Change to smaller split size:
net/http: HTTP/1.x transport connection broken: http: ContentLength=20971520 with Body length 385447926

from oci-go-sdk.

gcstang avatar gcstang commented on June 14, 2024

I found the issue with this particular piece.

Thank you for your time.

from oci-go-sdk.

jasonyin avatar jasonyin commented on June 14, 2024

glad you got the issue resolved, could you pls share the root cause for the issue? is it because the upload part stream you were using was entire file not the split part?

from oci-go-sdk.

gcstang avatar gcstang commented on June 14, 2024

@jasonyin yes I had a typo in there (wrong var)

from oci-go-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.