Re: Using APR with tomcat leaves port 8009 bound when tomcat is terminated?

2006-02-24 Thread Jim Jagielski


On Feb 24, 2006, at 11:15 AM, Jim Jagielski wrote:



On Feb 23, 2006, at 11:53 AM, Remy Maucherat wrote:


Jim Jagielski wrote:

I agree that the change is a big benefit, and for
most OSs we care about, SO_REUSEADDR is available.
The APR call should gracefully fail...
I'll plug this in later on today after some edge-case tests.


In AprEndpoint, there are a lot of Socket.optSet(serverSock,  
Socket.APR_SO_REUSEADDR, 1);




Yes, the only rub is that for reasons I'm trying to remind myself
why, we do the setting before the bind under non-Windows, and
afterwards on Windows...



Anyway, while I research this, I went the safe route
and adjusted the ordering to match httpd.

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



Re: Using APR with tomcat leaves port 8009 bound when tomcat is terminated?

2006-02-24 Thread William A. Rowe, Jr.

Jim Jagielski wrote:


On Feb 23, 2006, at 11:53 AM, Remy Maucherat wrote:


Jim Jagielski wrote:


I agree that the change is a big benefit, and for
most OSs we care about, SO_REUSEADDR is available.
The APR call should gracefully fail...
I'll plug this in later on today after some edge-case tests.



In AprEndpoint, there are a lot of Socket.optSet(serverSock,  
Socket.APR_SO_REUSEADDR, 1);




Yes, the only rub is that for reasons I'm trying to remind myself
why, we do the setting before the bind under non-Windows, and
afterwards on Windows...


If you SO_REUSEADDR before on win32, you will share any existing port
that's previously opened by any other application.  Not cool :)

Bill

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



Re: Using APR with tomcat leaves port 8009 bound when tomcat is terminated?

2006-02-24 Thread William A. Rowe, Jr.

D'OH!!!

Why doesn't this become an apr_sockattr element to the apr_socket_create
or apr_socket_bind call, so that APR determines the before/after thingy?

One side note, you setopt *after* the bind if you want to know you are
the absolute owner of the socket.  you setopt *before* the bind on win32
if you know your app owns the socket and now you want to add additional
listeners (processes) to pay attention to it.  Dunno how we could map this
all that cleanly.

Bill

William A. Rowe, Jr. wrote:

Jim Jagielski wrote:


On Feb 23, 2006, at 11:53 AM, Remy Maucherat wrote:


Jim Jagielski wrote:


I agree that the change is a big benefit, and for
most OSs we care about, SO_REUSEADDR is available.
The APR call should gracefully fail...
I'll plug this in later on today after some edge-case tests.




In AprEndpoint, there are a lot of Socket.optSet(serverSock,  
Socket.APR_SO_REUSEADDR, 1);




Yes, the only rub is that for reasons I'm trying to remind myself
why, we do the setting before the bind under non-Windows, and
afterwards on Windows...



If you SO_REUSEADDR before on win32, you will share any existing port
that's previously opened by any other application.  Not cool :)

Bill

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


.




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



RE: Using APR with tomcat leaves port 8009 bound when tomcat is terminated?

2006-02-23 Thread Fenlason, Josh
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 not?  Thanks in advance. 
, 
Josh.

 -Original Message-
 From: Sean Neeley [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, February 22, 2006 10:59 AM
 To: Tomcat Users List
 Subject: RE: Using APR with tomcat leaves port 8009 bound 
 when tomcat is terminated?
 
 
 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]
 

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



Re: Using APR with tomcat leaves port 8009 bound when tomcat is terminated?

2006-02-23 Thread Remy Maucherat

Jim Jagielski wrote:

I agree that the change is a big benefit, and for
most OSs we care about, SO_REUSEADDR is available.
The APR call should gracefully fail...

I'll plug this in later on today after some edge-case tests.


In AprEndpoint, there are a lot of Socket.optSet(serverSock, 
Socket.APR_SO_REUSEADDR, 1);


Rémy

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