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

Fixed issue with closing files in fPutObject() function #1112

Merged
merged 2 commits into from Apr 26, 2023
Merged

Fixed issue with closing files in fPutObject() function #1112

merged 2 commits into from Apr 26, 2023

Conversation

meefik
Copy link
Contributor

@meefik meefik commented Mar 27, 2023

When using the fPutObject() function, in case of an error, the file opened for reading is not closed.

How to reproduce

  1. Make a test file /tmp/test
touch /tmp/test
  1. Create test.js
const Minio = require('minio')

const client = new Minio.Client({
  useSSL: false,
  endPoint: '127.0.0.1',
  port: 9000,
  accessKey: 'minioadmin',
  secretKey: 'minioadmin'
})

setInterval(() => {
  client.fPutObject('test', 'test', '/tmp/test')
    .then(() => console.log('ok'))
    .catch(err => console.log(err))
}, 1000)
  1. Run test.js
node test.js
  1. Check open files for the process
lsof -p $(pgrep node)

...
node    52282 user   94r      REG                9,0        0 47450575 /tmp/test
node    52282 user   95r      REG                9,0        0 47450575 /tmp/test
node    52282 user   96r      REG                9,0        0 47450575 /tmp/test

When files are correctly closed they should not be in this list.

@prakashsvmx
Copy link
Member

@meefik Thank you for the contribution.

I have not been able to replicate this . could you share versions of node, os etc to troubleshoot further and verify it?

@meefik
Copy link
Contributor Author

meefik commented Apr 4, 2023

@prakashsvmx

  • Linux - Debian 11 (amd64)
  • node - 18.15.0
  • minio-js - 7.0.33

MinIO server is not required, the problem is reproduced when the connection to the server fails.

@harshavardhana harshavardhana merged commit 832ac71 into minio:master Apr 26, 2023
14 checks passed
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