You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Geoff Cadien (JIRA)" <ji...@apache.org> on 2008/06/05 23:56:45 UTC
[jira] Commented: (DIRMINA-584) Using apr-transport crashes jvm on
Linux
[ https://issues.apache.org/jira/browse/DIRMINA-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602805#action_12602805 ]
Geoff Cadien commented on DIRMINA-584:
--------------------------------------
Just for completeness here is a small patch that manually sets the file descriptor in AprSession to 0 when it is destroyed. It's probably not the best solution but it does work.
Index: src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
===================================================================
--- src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java (revision 656872)
+++ src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java (working copy)
@@ -43,7 +43,6 @@
* @author The Apache MINA Project (dev@mina.apache.org)
* @version $Rev$, $Date$
*/
-
public final class AprIoProcessor extends AbstractPollingIoProcessor<AprSession> {
private static final int POLLSET_SIZE = 1024;
@@ -239,6 +238,11 @@
}
} finally {
ret = Socket.close(session.getDescriptor());
+ // I think socket needs to be destroyed. When a connection is accepted
+ // a pool is allocated for the socket and I don't see how else it will
+ // get destroyed.
+ Socket.destroy(session.getDescriptor());
+ session.setDescriptor(0);
if (ret != Status.APR_SUCCESS) {
throwException(ret);
}
Index: src/main/java/org/apache/mina/transport/socket/apr/AprSession.java
===================================================================
--- src/main/java/org/apache/mina/transport/socket/apr/AprSession.java (revision 656872)
+++ src/main/java/org/apache/mina/transport/socket/apr/AprSession.java (working copy)
@@ -38,7 +38,7 @@
* @version $Rev$, $Date$
*/
public abstract class AprSession extends AbstractIoSession {
- private final long descriptor;
+ private long descriptor;
private final IoService service;
private final IoProcessor<AprSession> processor;
@@ -89,6 +89,10 @@
return descriptor;
}
+ void setDescriptor(long desc) {
+ this.descriptor = desc;
+ }
+
@Override
protected IoProcessor<AprSession> getProcessor() {
return processor;
> Using apr-transport crashes jvm on Linux
> ----------------------------------------
>
> Key: DIRMINA-584
> URL: https://issues.apache.org/jira/browse/DIRMINA-584
> Project: MINA
> Issue Type: Bug
> Components: Transport
> Affects Versions: 2.0.0-M1
> Environment: Linux jellikit 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux
> java version "1.6.0_06"
> Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
> Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)
> tomcat-native-1.1.13
> apr-1.2.11
> Reporter: Geoff Cadien
> Assignee: Trustin Lee
> Fix For: 2.0.0-M2
>
>
> To reproduce you can simply run the EchoServer from mina-example and use AprIoAcceptor instead of NioAcceptor. I used the EchoClient from Julien Vermillard's sandbox here: https://svn.apache.org/repos/asf/mina/sandbox/jvermillard/ and used 20 or 30 concurrent connections.
> AprIoProcessor.destroy() is called multiple times when an exception is generated in AbstractPollingIoProcessor (RST, etc.) and either epoll or apr doesn't like to remove a closed fd from the pollset. I believe that destroy is called twice because AprIoProcessor.state() returns SessionState.OPEN when the native fd is > 0. I don't believe once open it will ever be 0 again.
> I was able to fix the problem by explicitly settion AprSession.descriptor to 0 after the socket was closed although I'm not sure this is the correct solution.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.