You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Felix Knecht (JIRA)" <se...@james.apache.org> on 2011/03/22 07:26:05 UTC
[jira] [Created] (JAMES-1207) Avoid file descriptor leaks
Avoid file descriptor leaks
---------------------------
Key: JAMES-1207
URL: https://issues.apache.org/jira/browse/JAMES-1207
Project: JAMES Server
Issue Type: Task
Affects Versions: Trunk
Environment: All
Reporter: Felix Knecht
Make sure, created streams get closed at least in a finally block to avoid file descriptor leaks. E.g. in code below it's not known if LineNumberReader closed the given created stream
try {
LineNumberReader counter;
if (getEncoding() != null) {
counter = new LineNumberReader(new InputStreamReader(in, getEncoding()));
} else {
counter = new LineNumberReader(new InputStreamReader(in));
}
//Read through all the data
char[] block = new char[4096];
while (counter.read(block) > -1) {
//Just keep reading
}
return counter.getLineNumber();
} catch (IOException ioe) {
return -1;
} finally {
IOUtils.closeQuietly(in);
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[jira] [Commented] (JAMES-1207) Avoid file descriptor leaks
Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/JAMES-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13098700#comment-13098700 ]
Norman Maurer commented on JAMES-1207:
--------------------------------------
@Felix:
Do you have time to review and fix ?
> Avoid file descriptor leaks
> ---------------------------
>
> Key: JAMES-1207
> URL: https://issues.apache.org/jira/browse/JAMES-1207
> Project: JAMES Server
> Issue Type: Task
> Affects Versions: Trunk
> Environment: All
> Reporter: Felix Knecht
>
> Make sure, created streams get closed at least in a finally block to avoid file descriptor leaks. E.g. in code below it's not known if LineNumberReader closed the given created stream
> try {
> LineNumberReader counter;
> if (getEncoding() != null) {
> counter = new LineNumberReader(new InputStreamReader(in, getEncoding()));
> } else {
> counter = new LineNumberReader(new InputStreamReader(in));
> }
> //Read through all the data
> char[] block = new char[4096];
> while (counter.read(block) > -1) {
> //Just keep reading
> }
> return counter.getLineNumber();
> } catch (IOException ioe) {
> return -1;
> } finally {
> IOUtils.closeQuietly(in);
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[jira] [Commented] (JAMES-1207) Avoid file descriptor leaks
Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/JAMES-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13098762#comment-13098762 ]
Norman Maurer commented on JAMES-1207:
--------------------------------------
Yeah just close them..
> Avoid file descriptor leaks
> ---------------------------
>
> Key: JAMES-1207
> URL: https://issues.apache.org/jira/browse/JAMES-1207
> Project: JAMES Server
> Issue Type: Task
> Affects Versions: Trunk
> Environment: All
> Reporter: Felix Knecht
> Assignee: Felix Knecht
>
> Make sure, created streams get closed at least in a finally block to avoid file descriptor leaks. E.g. in code below it's not known if LineNumberReader closed the given created stream
> try {
> LineNumberReader counter;
> if (getEncoding() != null) {
> counter = new LineNumberReader(new InputStreamReader(in, getEncoding()));
> } else {
> counter = new LineNumberReader(new InputStreamReader(in));
> }
> //Read through all the data
> char[] block = new char[4096];
> while (counter.read(block) > -1) {
> //Just keep reading
> }
> return counter.getLineNumber();
> } catch (IOException ioe) {
> return -1;
> } finally {
> IOUtils.closeQuietly(in);
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[jira] [Closed] (JAMES-1207) Avoid file descriptor leaks
Posted by "Felix Knecht (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/JAMES-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Felix Knecht closed JAMES-1207.
-------------------------------
> Avoid file descriptor leaks
> ---------------------------
>
> Key: JAMES-1207
> URL: https://issues.apache.org/jira/browse/JAMES-1207
> Project: JAMES Server
> Issue Type: Task
> Affects Versions: Trunk
> Environment: All
> Reporter: Felix Knecht
> Assignee: Felix Knecht
> Fix For: 3.0-beta4
>
>
> Make sure, created streams get closed at least in a finally block to avoid file descriptor leaks. E.g. in code below it's not known if LineNumberReader closed the given created stream
> try {
> LineNumberReader counter;
> if (getEncoding() != null) {
> counter = new LineNumberReader(new InputStreamReader(in, getEncoding()));
> } else {
> counter = new LineNumberReader(new InputStreamReader(in));
> }
> //Read through all the data
> char[] block = new char[4096];
> while (counter.read(block) > -1) {
> //Just keep reading
> }
> return counter.getLineNumber();
> } catch (IOException ioe) {
> return -1;
> } finally {
> IOUtils.closeQuietly(in);
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[jira] [Resolved] (JAMES-1207) Avoid file descriptor leaks
Posted by "Felix Knecht (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/JAMES-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Felix Knecht resolved JAMES-1207.
---------------------------------
Resolution: Fixed
Fix Version/s: 3.0-beta4
Fixed all I found
> Avoid file descriptor leaks
> ---------------------------
>
> Key: JAMES-1207
> URL: https://issues.apache.org/jira/browse/JAMES-1207
> Project: JAMES Server
> Issue Type: Task
> Affects Versions: Trunk
> Environment: All
> Reporter: Felix Knecht
> Assignee: Felix Knecht
> Fix For: 3.0-beta4
>
>
> Make sure, created streams get closed at least in a finally block to avoid file descriptor leaks. E.g. in code below it's not known if LineNumberReader closed the given created stream
> try {
> LineNumberReader counter;
> if (getEncoding() != null) {
> counter = new LineNumberReader(new InputStreamReader(in, getEncoding()));
> } else {
> counter = new LineNumberReader(new InputStreamReader(in));
> }
> //Read through all the data
> char[] block = new char[4096];
> while (counter.read(block) > -1) {
> //Just keep reading
> }
> return counter.getLineNumber();
> } catch (IOException ioe) {
> return -1;
> } finally {
> IOUtils.closeQuietly(in);
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[jira] [Commented] (JAMES-1207) Avoid file descriptor leaks
Posted by "Felix Knecht (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/JAMES-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13098714#comment-13098714 ]
Felix Knecht commented on JAMES-1207:
-------------------------------------
Yes, I have the time. If questions will come up I'll ask. Is it ok to close them quietly without logging potentially errors when closing?
> Avoid file descriptor leaks
> ---------------------------
>
> Key: JAMES-1207
> URL: https://issues.apache.org/jira/browse/JAMES-1207
> Project: JAMES Server
> Issue Type: Task
> Affects Versions: Trunk
> Environment: All
> Reporter: Felix Knecht
>
> Make sure, created streams get closed at least in a finally block to avoid file descriptor leaks. E.g. in code below it's not known if LineNumberReader closed the given created stream
> try {
> LineNumberReader counter;
> if (getEncoding() != null) {
> counter = new LineNumberReader(new InputStreamReader(in, getEncoding()));
> } else {
> counter = new LineNumberReader(new InputStreamReader(in));
> }
> //Read through all the data
> char[] block = new char[4096];
> while (counter.read(block) > -1) {
> //Just keep reading
> }
> return counter.getLineNumber();
> } catch (IOException ioe) {
> return -1;
> } finally {
> IOUtils.closeQuietly(in);
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[jira] [Assigned] (JAMES-1207) Avoid file descriptor leaks
Posted by "Felix Knecht (JIRA)" <se...@james.apache.org>.
[ https://issues.apache.org/jira/browse/JAMES-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Felix Knecht reassigned JAMES-1207:
-----------------------------------
Assignee: Felix Knecht
> Avoid file descriptor leaks
> ---------------------------
>
> Key: JAMES-1207
> URL: https://issues.apache.org/jira/browse/JAMES-1207
> Project: JAMES Server
> Issue Type: Task
> Affects Versions: Trunk
> Environment: All
> Reporter: Felix Knecht
> Assignee: Felix Knecht
>
> Make sure, created streams get closed at least in a finally block to avoid file descriptor leaks. E.g. in code below it's not known if LineNumberReader closed the given created stream
> try {
> LineNumberReader counter;
> if (getEncoding() != null) {
> counter = new LineNumberReader(new InputStreamReader(in, getEncoding()));
> } else {
> counter = new LineNumberReader(new InputStreamReader(in));
> }
> //Read through all the data
> char[] block = new char[4096];
> while (counter.read(block) > -1) {
> //Just keep reading
> }
> return counter.getLineNumber();
> } catch (IOException ioe) {
> return -1;
> } finally {
> IOUtils.closeQuietly(in);
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org