Title: Message
Here's a patch for the native APR connector so that fixes problems binding on restart (see attached thread for more details).  Thanks go out to Bill Barker for coming up with this.  I've tested this on Windows, Solaris, and AIX and it works fine.  It would be great if this could be included in the 1.1.2 native connector.  Thanks.
,
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);
  }
 
--- 385,390 ----
--- Begin Message ---
Title: Re: Re: Re: APR Connector Shutdown Problem

I was doing a cut-and paste from the code in Httpd.  In tcnative, 's' is
it's internal socket structure, and the APR socket is s->sock.

"Fenlason, Josh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
I added the following line to
tomcat-native.1.1.1/jni/native/src/network.c (added at line 388):
apr_socket_opt_set( s, APR_SO_REUSEADDR, 1 );
But I'm still running into the same problem.

Does anyone who works on the APR Connector have any input on this?  Or
do I need to post this issue on the dev list?  Thanks.
,
Josh.

> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED]] On Behalf Of Bill Barker
> Sent: Monday, January 30, 2006 10:07 PM
> To: users@tomcat.apache.org
> Subject: Re: Re: APR Connector Shutdown Problem
>
>
> Not by me, I don't really work on the APR Connector ;-).
>
> In the bind method in network.c is probably easiest.  If you
> want your patch
> to be accepted by the dev team, then you should probably wrap it in a
> '#ifndef WIN32' like httpd does (don't know why, and care
> even less :).
>
> "Fenlason, Josh" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> Is there no intent to fix this issue?  Where would I need to
> make that patch?  Thanks. , Josh.
>
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED]] On Behalf Of Bill Barker
> > Sent: Friday, January 27, 2006 8:59 PM
> > To: users@tomcat.apache.org
> > Subject: Re: APR Connector Shutdown Problem
> >
> >
> > Yeah, the difference is that Httpd calls:
> >   apr_socket_opt_set(s, APR_SO_REUSEADDR, one);
> > on the Socket before binding it.  That allows it to bind
> even though
> > there are still half-closed sockets on systems like Solaris.
> >
> > About the only work-around is to hack the tcnative code,
> and recompile
> > it.
> >
> > "Fenlason, Josh" <[EMAIL PROTECTED]> wrote in message
> >
> news:[EMAIL PROTECTED]...
> > I added the Listener you mentioned to server.xml, but I'm
> still seeing
> > the issue.  The problem is happening when run the
> shutdown.sh.  I can
> > understand if things aren't all clean and tidy if Tomcat
> crashed, but
> > you shouldn't have to wait 4 minutes to restart Tomcat
> after a planned
> > shutdown.  Apache doesn't work like that.  Any other suggestions on
> > how to get this to shutdown properly?  Thanks in advance. , Josh.
> >
> > > -----Original Message-----
> > > From: Mladen Turk [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, January 27, 2006 1:24 AM
> > > To: Tomcat Users List
> > > Subject: Re: APR Connector Shutdown Problem
> > >
> > >
> > > Fenlason, Josh wrote:
> > > > I'm running into a problem with the APR connector not
> > shutting down
> > > > properly.  Tomcat runs fine and there are no errors on
> > > shutdown, but if
> > > > I shut Tomcat down and start it up again I get a socket
> > bind failed
> > > > error in the catalina log (attached).  I have to wait
> for several
> > > > minutes between shutdown and startup for Tomcat to be able
> > > to startup
> > > > correctly.  If I run Tomcat without the APR connector, I
> > > don't have this
> > > > issue.  This does not occur on Windows, but does on
> > Solaris and AIX.
> > > > Has anyone else seen this? One thing I noticed is that
> the first
> > > > thing logged on
> > > shutdown is an
> > > > "AjpAprProtocol pause" entry, but there is no shutdown,
> > > stop or destroy.
> > > > Is there any chance the APR connector is just getting
> > > paused and nothing
> > > > is actually stopping it?
> > > > Any help would be greatly appreciated.  Thanks in advance.
> > >
> > >
> > > I suppose you have:
> > > <Listener
> > className="org.apache.catalina.core.AprLifecycleListener" />
> > > in your server.xml
> > >
> > > But of course it doesn't guarantee it will be executed in
> > all cases,
> > > if the JVM crashes for example. On Solaris it can take up
> > to 4 minutes
> > > until the OS recycles the zombie socket.
> > > You can use:
> > > ndd -set /dev/tcp tcp_time_wait_interval 60000
> > > To lower that value.
> > >
> > > APR does not try to fool the OS like JVM, but rather behaves like
> > > Apache httpd.
> > >
> > > Regards,
> > > Mladen.
> > >
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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]
> >
>
>
>
>
> ---------------------------------------------------------------------
> 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]


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

Reply via email to