[
https://issues.apache.org/jira/browse/HADOOP-10496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chris Nauroth updated HADOOP-10496:
-----------------------------------
Attachment: HADOOP-10496.1.patch
I found this bug during runs of {{TestFileSink}} on Windows. The test
concludes by trying to delete the output file. On Windows, the delete fails,
because the file is still held open and locked.
Here is a patch that fixes it. {{MetricsSink}} is public, and there can be
custom implementations in the wild. I didn't want to introduce a
backwards-incompatibility by defining a {{close}} method right on the
{{MetricsSink}} interface. Instead, this patch adds JavaDocs to
{{MetricsSink}} stating that implementations also may optionally implement
{{Closeable}}, and then {{MetricsSinkAdapter}} does an instanceof check and
calls close.
I verified on Mac and Windows.
> Metrics system FileSink can leak file descriptor.
> -------------------------------------------------
>
> Key: HADOOP-10496
> URL: https://issues.apache.org/jira/browse/HADOOP-10496
> Project: Hadoop Common
> Issue Type: Bug
> Components: metrics
> Affects Versions: 3.0.0, 2.4.0
> Reporter: Chris Nauroth
> Assignee: Chris Nauroth
> Attachments: HADOOP-10496.1.patch
>
>
> {{FileSink}} opens a file. If the {{MetricsSystem}} is shutdown, then the
> sink is discarded and the file is never closed, causing a file descriptor
> leak.
--
This message was sent by Atlassian JIRA
(v6.2#6252)