I built the native connector myself.  The platform is Red Hat linux 8.0,
kernel 2.4.32.  Many, many thanks for the patch.  The socket option used
in the patch is also what the APR team recommended.  I hope someone adds
this change permanently in the tomcat source.

- Sean

-----Original Message-----
From: Fenlason, Josh [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 10:35 AM
To: Tomcat Users List
Subject: RE: Using APR with tomcat leaves port 8009 bound when tomcat is
terminated?

I had the same problem and submitted a patch (with help from Bill
Barker).  The patch is below and I attached the thread Bill and I had to
come to it in case your curious.  You'll have to rebuild the native
connector, but this should solve your problem.  What platform are you
on?  Did you build the native connector yourself?  Or where did you get
the binary from?

Remy or anyone else working on the native connector,
I'm not the only one who has seen this problem and obviously the Java
code isn't doing what you expected.  Any chance you of this patch
getting accepted now?  If not, would you be able to explain why?  Thanks
in advance.
,
Josh.

bash-2.03$ diff -c network.c network.c.orig
*** network.c   Mon Feb  6 12:50:54 2006
--- network.c.orig      Mon Feb  6 12:50:11 2006
***************
*** 385,391 ****
      UNREFERENCED_STDARGS;
      TCN_ASSERT(sock != 0);
      TCN_ASSERT(s->sock != NULL);
+     apr_socket_opt_set( s->sock, APR_SO_REUSEADDR, 1 );
      return (jint)apr_socket_bind(s->sock, a);
  }

> -----Original Message-----
> From: Sean Neeley [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, February 22, 2006 10:06 AM
> To: users@tomcat.apache.org
> Subject: Using APR with tomcat leaves port 8009 bound when 
> tomcat is terminated?
> 
> 
> Hi, 
> 
>  
> 
> I'm using APR 1.2.2 with Tomcat 5.5.15.  Occasionally I need 
> to restart the JVM, and so I have one of my servlets call 
> System.exit(0).  When using the APR libraries with tomcat, 
> exiting the JVM in this manor leaves port 8009 in the 
> FIN_WAIT2 state (see netstat man page).  This prevents me 
> from starting tomcat back up immediately.  I receive an error 
> saying that the tomcat port is already bound.  If I remove 
> the APR libraries so that tomcat does not use them, I no 
> longer encounter this problem.  Can someone help?  I would 
> like to use APR, but this problem prevents me.  I have 
> already posted this issue to the APR mailing list, and they 
> say that the problem is with tomcat. Thanks.
> 
>  
> 
> - Sean
> 
>  
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to