You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "xcx1r3 (via GitHub)" <gi...@apache.org> on 2025/06/05 03:23:11 UTC

[I] Fix potential resource leak [iceberg]

xcx1r3 opened a new issue, #13243:
URL: https://github.com/apache/iceberg/issues/13243

   ### Proposed Change
   
   Resource leaks are a critical concern in software development and system design. A resource leak occurs when a program allocates a system or limited resource (such as memory, file handles, network connections, or database connections) but fails to release it after its use is complete. Over time, these unreleased resources accumulate, leading to serious performance degradation, instability, and even system failure.
   
   I found some code that may be leaking resources.
   # leak1 
   `org.apache.iceberg.avro.AvroEncoderUtil#encode`  DataOutputStream dataOut 
   
   ![Image](https://github.com/user-attachments/assets/6efb8acb-11f8-4f36-a0c7-9048ebcb40fa)
   While the underlying stream out (the ByteArrayOutputStream) will be closed automatically by the try-with-resources statement, this does not trigger the close() method of the DataOutputStream (dataOut) that wraps it
   
   # leak2
   `org.apache.iceberg.flink.sink.shuffle.DataStatisticsSerializer#deserialize`   Memory sketchMemory
   
   ![Image](https://github.com/user-attachments/assets/1c4fbd47-a917-4b45-8a6f-1a5018a09ac3)
   
   no sketchMemory.close() call
   
   # leak3
   `org.apache.iceberg.hadoop.HadoopFileIO#deleteFile`  FileSystem fs
   
   ![Image](https://github.com/user-attachments/assets/ad94b3fc-0d0f-4af5-87f8-c229033f16d4)
   no close call
   
   # leak 4
   `org.apache.iceberg.hadoop.HadoopFileIO#deletePrefix`  FileSystem fs
   
   ![Image](https://github.com/user-attachments/assets/32d9f2b8-dd69-4170-84af-f688628b4916)
   no close call
   
   # leak 5
   `org.apache.iceberg.hadoop.Util#blockLocations`  FileSystem fs
   
   ![Image](https://github.com/user-attachments/assets/7cbf6322-d400-4f1a-98d4-7a451fd8ef07)
   no close call
   
   # Fix
   Use a `try-with-resources` statement to ensure the resource object is automatically closed
   
   ### Proposal document
   
   _No response_
   
   ### Specifications
   
   - [ ] Table
   - [ ] View
   - [ ] REST
   - [ ] Puffin
   - [ ] Encryption
   - [x] Other


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #13243: Fix potential resource leak
URL: https://github.com/apache/iceberg/issues/13243


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2943004726

   @xcx1r3 are you a real person, or is this an AI generated issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "xcx1r3 (via GitHub)" <gi...@apache.org>.
xcx1r3 commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2944133610

   > I’d be happy to work on this, if the maintainers are open to the idea.
   
   Sure you could do this, thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-4248280916

   This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-4340085893

   This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "JeonDaehong (via GitHub)" <gi...@apache.org>.
JeonDaehong commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2942682247

   I’d be happy to work on this, if the maintainers are open to the idea.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "sclee01 (via GitHub)" <gi...@apache.org>.
sclee01 commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2943394114

   I don't believe this is the actual cause of the memory leak


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "JeonDaehong (via GitHub)" <gi...@apache.org>.
JeonDaehong commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2942679361

   Hello,
   
   I'm a contributor with a strong interest in Apache Iceberg.
   If you’re not planning to make the changes yourself, would it be okay if I work on addressing these issues?
   
   Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "psantos-denodo (via GitHub)" <gi...@apache.org>.
psantos-denodo commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-3411489793

   Hi,
   
   I confirm this is causing a problem because when you use the FileSystems to access data in S3 using latest version of hadoop-aws 3.4.2 each FileSystem creates several threads called "sdk-ScheduledExecutor" (I believe they are 4 each time) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "xcx1r3 (via GitHub)" <gi...@apache.org>.
xcx1r3 commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2944131825

   > I don't believe this is the actual cause of the memory leak
   
   You are right, I agree usually it would not cause mem leak, you could check this article  https://arxiv.org/pdf/1810.00101#page=5.13 for their difference and its impact.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "JeonDaehong (via GitHub)" <gi...@apache.org>.
JeonDaehong commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2944846181

   If it's not causing a memory leak, is it really necessary to fix this? I'm happy to make the changes depending on the maintainers' decision.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] Fix potential resource leak [iceberg]

Posted by "xcx1r3 (via GitHub)" <gi...@apache.org>.
xcx1r3 commented on issue #13243:
URL: https://github.com/apache/iceberg/issues/13243#issuecomment-2944048366

   > [@xcx1r3](https://github.com/xcx1r3) are you a real person, or is this an AI generated issue?
   
   I'm a real person


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org