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

fix: async callback run multiple times in fPutObject #1048

Merged
merged 4 commits into from Aug 3, 2022

Conversation

nomagick
Copy link
Contributor

@nomagick nomagick commented Jul 2, 2022

In some error cases, the async cb function is called multiple(2) times in fPutObject.

minio-js/src/main/minio.js

Lines 1023 to 1033 in 06e4081

pipesetup(fs.createReadStream(filePath, options), hash)
.on('data', data => {
var md5sum = data.md5sum
var sha256sum = data.sha256sum
var stream = fs.createReadStream(filePath, options)
uploader(stream, size, sha256sum, md5sum, (err, objInfo) => {
callback(err, objInfo)
cb(true)
})
})
.on('error', e => cb(e))

This causes the async library to generate an exception Error: Callback was already called., crashing the process.

This PR is to fix this issue.

harshavardhana
harshavardhana previously approved these changes Jul 2, 2022
Copy link
Member

@prakashsvmx prakashsvmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nomagick , Thank you. i ran tests locally and looks good.
Please add some details on steps if any to replicate the specific error faced .

@harshavardhana harshavardhana merged commit 728336b into minio:master Aug 3, 2022
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 this pull request may close these issues.

None yet

3 participants