You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Laurent Petit <lp...@yseop.com> on 2012/06/21 22:45:40 UTC

Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21 juin 2012 00:07 Can you verify your 2 threads (reading input an error) are launched ? Yes they are. Verified. Can you confirm you are getting the problem only on Windows ? Yes sir, we're unable to reproduce it on Ubuntu. Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <lp...@yseop.com> wrote: > Hello, > > I have a problem with keep-alive connections, when starting a subprocess > (via JDK's default ProcessBuilder/Process API), while also having > started Tomcat with the APR HTTP/1.1 Connector. > > The problem symptom is with Keep-Alive connection, as follows: > > - the client (browser, jmeter, etc.) sends a first request > - the servlet starts a Process for e.g. wordpad.exe > - the servlet returns an acknowledgment html content, sets the content > length, flushes the writer, and returns > - the client displays the received acknowledgement html content, sends > the second request to the server. > - the server doesn't answer. No Tomcat log ever reports the start of > something received. > - Then when on the server you close the wordpad.exe instance, the server > finally handles the second request. > > I have created a small servlet code which reproduces the problem. > For the demo, it suffices to have the started subprocess be > "wordpad.exe". Of course my real process is more interesting than > that :-). > > You can find the servlet code for reproducing the test here: > > https://www.refheap.com/paste/3254 > > > To reproduce the problem deterministically, the ConnectionTimeout for > the APR HTTP Connector in servlet.xml must be set sufficiently low. > With my boxes, I get a 100% error hit when set at 200 ms. > > You can find here the jmeter script which hits the same page again and > again with "keep-alive" option set on: > > https://www.refheap.com/paste/3255 > > > So far, the only reliable solution we have found to work around this > problem is to not use the HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US std R2 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > > Same issue has been observed on Windows 7 32 bits. > > Was not able to reproduce the issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for your support, ideas, solutions, etc. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY "Legacy code" often differs from its suggested alternative by actually working and scaling. - Bjarne Stroustrup http://www.jeffmaury.com http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury

Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/6/22 Laurent Petit <lp...@yseop.com>:
> Hello,
>
> On Thu, 2012-06-21 at 22:53 +0200, Jeff MAURY wrote:
>> Is it specific to Wordpad or any launched process will do the trick ?
>> Do you tried with a non UI process (console) ?
>
>
> I did an additional test, as you suggested, with a non UI process (a
> small java executable launched in headless mode, whose purpose was just
> to wait for 20 seconds before exiting).
>
> I can reproduce the problem with this headless executable: the HTTP
> client is blocked until the 20 seconds elapse and the process is killed.
>
>
> Here is the modified servlet code I used:
>
> https://www.refheap.com/paste/3285
>
>
> and here is the code for the small java program:
>
> https://www.refheap.com/paste/3286
>

I wonder what will happen if you would start another program from the
one that you are launching.

E.g. create a *.bat file and use "start" command to launch other
process from it.

Something like this:
cmd.exe /C start wordpad.exe

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
On Fri, 2012-06-29 at 17:18 +0200, Jeff MAURY wrote:
> Hello,
> 
> I found the correct code to look at:
> http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/src/network.c
> It does not set the inherit flag but it is using the apr library that maybe
> set the flag under Windows.
> If this is the case and according to your references, it is likely the
> client will not receive the ack and this is a problem with APR and
> Runtime.exec

Hello,

Seems like it's function apr_socket_create, defined in this APR file:

http://svn.apache.org/repos/asf/apr/apr/trunk/network_io/win32/sockets.c


which apparently already tries to create a non-inherited handle.

The code, for reasons beyond my current understanding, relies at compile
time on the flags APR_HAS_UNICODE_FS and _WIN32_WCE.

It also relies at runtime on IF_WIN_OS_IS_UNICODE, which may (?) be an
indirect indication that the underlying OS needs SetHandleInformation to
be explicitly called.


Jeff, do you have ideas/indications on how I could help push the issue
resolution forward ? We're reaching the limits of my current abilities
to help, not having a windows box with C compiler to do tests, etc.  :-(




You'll find below the relevant code:

#ifdef WIN32
    /* Socket handles are never truly inheritable, there are too many
     * bugs associated.  WSADuplicateSocket will copy them, but for our
     * purposes, always transform the socket() created as a
non-inherited
     * handle
     */
#if APR_HAS_UNICODE_FS && !defined(_WIN32_WCE)
    IF_WIN_OS_IS_UNICODE {
        /* A different approach.  Many users report errors such as 
         * (32538)An operation was attempted on something that is not 
         * a socket.  : Parent: WSADuplicateSocket failed...
         *
         * This appears that the duplicated handle is no longer
recognized
         * as a socket handle.  SetHandleInformation should overcome
that
         * problem by not altering the handle identifier.  But this
won't
         * work on 9x - it's unsupported.
         */
        SetHandleInformation((HANDLE) (*new)->socketdes, 
                             HANDLE_FLAG_INHERIT, 0);
    }
#if APR_HAS_ANSI_FS
    /* only if APR_HAS_ANSI_FS && APR_HAS_UNICODE_FS */
    ELSE_WIN_OS_IS_ANSI
#endif
#endif
#if APR_HAS_ANSI_FS || defined(_WIN32_WCE)
    {
        HANDLE hProcess = GetCurrentProcess();
        HANDLE dup;
        if (DuplicateHandle(hProcess, (HANDLE) (*new)->socketdes,
hProcess, 
                            &dup, 0, FALSE, DUPLICATE_SAME_ACCESS)) {
            closesocket((*new)->socketdes);
            (*new)->socketdes = (SOCKET) dup;
        }
    }
#endif

#endif /* def WIN32 */




> 
> Jeff
> 
> 
> On Fri, Jun 29, 2012 at 4:38 PM, Laurent Petit <lp...@yseop.com> wrote:
> 
> > On Fri, 2012-06-29 at 15:27 +0200, Jeff MAURY wrote:
> > > No,
> > >
> > > it does not (yet) make sense because one piece of the puzzle is missing.
> > > The Local socket is not a TCP socket, it is created from a path rather
> > than
> > > from an IP address.
> > > So this socket is in no way linked to the browser, at least directly, and
> > > the missing piece is what is the relation from this socket to the
> > browser.
> >
> > You're right, so the question is still open.
> >
> > In the mean time, I'm come across interesting google search results,
> > among which the first one seems really interesting:
> >
> >
> > Oracle Bug 6428742
> > ==================
> >
> > "Currently, on Windows, Runtime.exec is implemented by calling
> > CreateProcess with the bInheritHandles argument set to TRUE,
> > which causes open handles to not be closed if they are not
> > explicitly set to be non-inherited.  This is the underlying cause
> > of many subtle bugs, such as
> >
> > 6347873: (so) Ports opened with ServerSocketChannel blocks when using
> > Runtime.exec
> > http://monaco.sfbay/detail.jsf?cr=6347873"
> >
> >
> >
> > ==> Note the "if they are not explicitly set to be non-inherited" =>
> > this seems like a game changer, since our implicit assumption was that
> > we would just look for code which would have accidentally set the handle
> > to be inherited, not the other way around.
> >
> > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6428742
> >
> >
> >
> > QT Project
> > ==========
> >
> > "When using spawned processes, sockets opened by the client remain in
> > CLOSE_WAIT state after closing the connection. Sockets on the remote
> > side would be in FIN_WAIT_2 state and waiting for ACK.
> > When the spawned (child) process is closed, then ACK is sent and sockets
> > are finally moved to CLOSE state on both sides.
> > This seems to be caused by the default handle inheritance on Windows by
> > child processes."
> >
> > https://bugreports.qt-project.org/browse/QTBUG-4465
> >
> >
> >
> > Zeromq2 project
> > ===============
> >
> > "On Windows platform, in order to prevent child processes to inherit
> > parent sockets, SetHandleInformation
> > (
> > http://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx)
> > should be called on the socket handle.
> >
> > This patch comes out from discussion at:
> > https://github.com/zeromq/clrzmq/issues/60"
> >
> > https://github.com/zeromq/zeromq2-x/pull/51
> > and
> > https://zeromq.jira.com/browse/LIBZMQ-366
> >
> >
> > I found way more interesting results, but I'll spare space and won't
> > paste them all in this thread
> > ( google search criteria : "windows inheriting socket handles" )
> >
> >
> > >
> > > Jeff
> > >
> > >
> > > On Fri, Jun 29, 2012 at 2:40 PM, Laurent Petit <lp...@yseop.com> wrote:
> > >
> > > > Hello,
> > > >
> > > > On Fri, 2012-06-29 at 11:45 +0200, Jeff MAURY wrote:
> > > >
> > > > > That what I guessed but I don't understand everything.
> > > > > The code you are referencing is related to NTPipes and not sockets.
> > > >
> > > >
> > > > I'm not a C expert, but my bet is that the file name is misleading.
> > > >
> > > > Indeed, the
> > > >
> > > > con->sa.bInheritHandle = TRUE;
> > > >
> > > > statement appears in the definition driven by the following macro
> > > > expansion:
> > > >
> > > > TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,
> > > >
> > > >                                         jlong pool)
> > > >
> > > > And when the macro call TCN_IMPLEMENT_CALL(jlong, Local, create) is
> > > > preprocessed, it gives:
> > > >
> > > >
> > > > JNIEXPORT RT JNICALL Java_org_apache_tomcat_jni_##Local##_##create
> > > >
> > > > , thus the bInheritHandle = TRUE statement is defined in the following
> > > > function signature:
> > > >
> > > > JNIEXPORT RT JNICALL
> > > > Java_org_apache_tomcat_jni_##Local##_##create(TCN_STDARGS, jstring
> > name,
> > > >                                         jlong pool)
> > > >
> > > > which is a function called by JNDI, and as I guess, by class
> > > > org.apache.tomcat.ini.Local, method create() :
> > > >
> > > >
> > > >
> > http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/java/org/apache/tomcat/jni/Local.java
> > > >
> > > > And the javadoc for class Local is: "Local socket"
> > > > And for methode create :
> > > > /**
> > > >
> > > >  * Create a socket.
> > > >  * @param path The address of the new socket.
> > > >  * @param cont The parent pool to use
> > > >  * @return The new socket that has been set up.
> > > >  */
> > > >
> > > >
> > > > It seems like the native code uses a pool, and my bet is that the pool
> > > > is responsible for trying to reuse the socket.
> > > >
> > > > And something like this may happen: the socket handle, inherited by the
> > > > child process, puts the socket in such a state that the pool either
> > > > can't, either doesn't want to reuse it.
> > > >
> > > > And then what happens is that on the other side of the socket, the
> > > > client continues to write HTTP requests, and nobody is listening.
> > > >
> > > > And then when the Tomcat's child process is killed, the socket is
> > > > finally closed somehow, the client browser notices it and creates a new
> > > > connection to the server and retries the HTTP request.
> > > >
> > > >
> > > > Does that make sense ?
> > > >
> > > >
> > > >
> > > > > So I'm
> > > > > not familiar with Tomcat Native implementation, but do you know the
> > > > global
> > > > > architecture ?
> > > > > What I guessed is that the Tomcat native stuff created with the
> > inherit
> > > > > flag, but even if it does, I don't see why it should not work if the
> > > > socket
> > > > > is closed after a timeout.
> > > > >
> > > > > Regards
> > > > > Jeff
> > > > >
> > > > >
> > > > >
> > > > > On Fri, Jun 29, 2012 at 11:22 AM, Laurent Petit <lp...@yseop.com>
> > > > wrote:
> > > > >
> > > > > > Hello Jeff, Konstantin & all,
> > > > > >
> > > > > > On Mon, 2012-06-25 at 20:52 +0200, verlag.preisser@t-online.dewrote:
> > > > > > > Hello Jeff & all,
> > > > > > >
> > > > > > > > Von: Jeff MAURY <je...@jeffmaury.com>
> > > > > > > > Datum: Mon, 25 Jun 2012 18:46:02 +0200
> > > > > > >
> > > > > > > > Konstantin,
> > > > > > > >
> > > > > > > > your explanations are very interesting but unclear to me: what
> > do
> > > > you
> > > > > > > > call the inactivity timer ? When it is started ? After the
> > request
> > > > has
> > > > > > > > been processed by the servlet ? In that case, I see no
> > difference
> > > > > > > > between a servlet that launch a process and another one.
> > > > > > > > It seems to me that a process that is launched does not
> > inhererits
> > > > > > > > handles from its parent process but it's possible that under
> > > > Windows,
> > > > > > > > it's an option so it would be interesting to watch.
> > > > > > > >
> > > > > > > > Jeff
> > > > > > > >
> > > > > > >
> > > > > > > Sorry, I'm just a normal Tomcat user, and I don't know how
> > exactly
> > > > the
> > > > > > APR connector and its Timeout works, so I am unable to answer that.
> > > > > > >
> > > > > > >
> > > > > > > Howewer, I did some further observations:
> > > > > > >
> > > > > > > -When I perform a request to the servlet that opens wordpad.exe,
> > the
> > > > TCP
> > > > > > connection from Tomcat does not close after the timeout - even
> > when I
> > > > kill
> > > > > > the Tomcat process (java.exe), the TCP connection is still open.
> > If I
> > > > kill
> > > > > > wordpad.exe, then finally the connection is closed/aborted.
> > > > > > > -When I have 1 TCP connection open to Tomcat and the servlet
> > starts
> > > > the
> > > > > > little C program, Task manager shows that it has 11 handles.
> > > > > > > However, when I have 5 TCP connections open to Tomcat, and do the
> > > > > > request on one of them, Task maanger shows that the C program has
> > 15
> > > > > > handles - so four more handles when there are four more
> > connections to
> > > > > > Tomcat. All of that 5 TCP connections don't close until I kill that
> > > > process.
> > > > > > >
> > > > > > > That seems to me to be an indication that socket handles could be
> > > > > > inherited by the child processes that are startet by ProcessBuilder
> > > > from
> > > > > > tomcat.
> > > > > > >
> > > > > > > A msdn article mentions how to create a new process using
> > > > > > CreateProcess(); it also mentions that socket handles can be
> > inherited:
> > > > > >
> > http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx
> > > > > > >
> > > > > > > However, as I don't have much knowledge about programming with
> > > > WinAPIs,
> > > > > > I don't know why those handles are inherited (the MSDN article
> > mentions
> > > > > > that a handle must be specified as inheritable when created, to
> > allow a
> > > > > > child process to inherit it). Maybe someone with more WinAPI/Tomcat
> > > > Native
> > > > > > knowledge can help here.
> > > > > >
> > > > > >
> > > > > > I also had the vague intuition that this related to handles
> > > > inheritence.
> > > > > > Your recent tests & research tend to make this hypothesis even more
> > > > > > appealing.
> > > > > >
> > > > > > I know nothing about tomcat-native implementation, but I was able
> > to
> > > > see
> > > > > > that the bInheritHandle member is set to true here in tomcat
> > native's C
> > > > > > code:
> > > > > >
> > > > > > lpetit:~/tmp/tomcat-native $ grep "bInheritHandle" -R *
> > > > > > native/os/win32/ntpipe.c:    con->sa.bInheritHandle = TRUE;
> > > > > >
> > > > > > (
> > > > > >
> > > > > >
> > > >
> > http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/os/win32/ntpipe.c
> > > > )
> > > > > >
> > > > > >
> > > > > > Jeff,
> > > > > >
> > > > > > What else could we do to help investigate / fix this issue ?
> > > > > >
> > > > > >
> > > > > > Cheers,
> > > > > >
> > > > > > --
> > > > > > Laurent
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > Regards,
> > > > > > > Konstantin Preißer
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > > > >
> > > > > >
> > > > > > --
> > > > > > Laurent Petit
> > > > > >
> > > > > > Agence +33 (0)4 78 47 07 49
> > > > > >
> > > > > > Email     lpetit@yseop.com
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Yseop apporte une réponse intelligente et individualisée à chacun
> > de
> > > > vos
> > > > > > clients
> > > > > >
> > > > > >
> > > > > >
> > > > > > www.yseop.com
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Laurent Petit
> > > >
> > > > Agence +33 (0)4 78 47 07 49
> > > >
> > > > Email     lpetit@yseop.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Yseop apporte une réponse intelligente et individualisée à chacun de
> > vos
> > > > clients
> > > >
> > > >
> > > >
> > > > www.yseop.com
> > > >
> > > >
> > > >
> > >
> > >
> >
> > --
> > Laurent Petit
> >
> > Agence +33 (0)4 78 47 07 49
> >
> > Email     lpetit@yseop.com
> >
> >
> >
> >
> >
> >
> >
> > Yseop apporte une réponse intelligente et individualisée à chacun de vos
> > clients
> >
> >
> >
> > www.yseop.com
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 
> 

-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Jeff MAURY <je...@jeffmaury.com>.
Hello,

I found the correct code to look at:
http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/src/network.c
It does not set the inherit flag but it is using the apr library that maybe
set the flag under Windows.
If this is the case and according to your references, it is likely the
client will not receive the ack and this is a problem with APR and
Runtime.exec

Jeff


On Fri, Jun 29, 2012 at 4:38 PM, Laurent Petit <lp...@yseop.com> wrote:

> On Fri, 2012-06-29 at 15:27 +0200, Jeff MAURY wrote:
> > No,
> >
> > it does not (yet) make sense because one piece of the puzzle is missing.
> > The Local socket is not a TCP socket, it is created from a path rather
> than
> > from an IP address.
> > So this socket is in no way linked to the browser, at least directly, and
> > the missing piece is what is the relation from this socket to the
> browser.
>
> You're right, so the question is still open.
>
> In the mean time, I'm come across interesting google search results,
> among which the first one seems really interesting:
>
>
> Oracle Bug 6428742
> ==================
>
> "Currently, on Windows, Runtime.exec is implemented by calling
> CreateProcess with the bInheritHandles argument set to TRUE,
> which causes open handles to not be closed if they are not
> explicitly set to be non-inherited.  This is the underlying cause
> of many subtle bugs, such as
>
> 6347873: (so) Ports opened with ServerSocketChannel blocks when using
> Runtime.exec
> http://monaco.sfbay/detail.jsf?cr=6347873"
>
>
>
> ==> Note the "if they are not explicitly set to be non-inherited" =>
> this seems like a game changer, since our implicit assumption was that
> we would just look for code which would have accidentally set the handle
> to be inherited, not the other way around.
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6428742
>
>
>
> QT Project
> ==========
>
> "When using spawned processes, sockets opened by the client remain in
> CLOSE_WAIT state after closing the connection. Sockets on the remote
> side would be in FIN_WAIT_2 state and waiting for ACK.
> When the spawned (child) process is closed, then ACK is sent and sockets
> are finally moved to CLOSE state on both sides.
> This seems to be caused by the default handle inheritance on Windows by
> child processes."
>
> https://bugreports.qt-project.org/browse/QTBUG-4465
>
>
>
> Zeromq2 project
> ===============
>
> "On Windows platform, in order to prevent child processes to inherit
> parent sockets, SetHandleInformation
> (
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx)
> should be called on the socket handle.
>
> This patch comes out from discussion at:
> https://github.com/zeromq/clrzmq/issues/60"
>
> https://github.com/zeromq/zeromq2-x/pull/51
> and
> https://zeromq.jira.com/browse/LIBZMQ-366
>
>
> I found way more interesting results, but I'll spare space and won't
> paste them all in this thread
> ( google search criteria : "windows inheriting socket handles" )
>
>
> >
> > Jeff
> >
> >
> > On Fri, Jun 29, 2012 at 2:40 PM, Laurent Petit <lp...@yseop.com> wrote:
> >
> > > Hello,
> > >
> > > On Fri, 2012-06-29 at 11:45 +0200, Jeff MAURY wrote:
> > >
> > > > That what I guessed but I don't understand everything.
> > > > The code you are referencing is related to NTPipes and not sockets.
> > >
> > >
> > > I'm not a C expert, but my bet is that the file name is misleading.
> > >
> > > Indeed, the
> > >
> > > con->sa.bInheritHandle = TRUE;
> > >
> > > statement appears in the definition driven by the following macro
> > > expansion:
> > >
> > > TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,
> > >
> > >                                         jlong pool)
> > >
> > > And when the macro call TCN_IMPLEMENT_CALL(jlong, Local, create) is
> > > preprocessed, it gives:
> > >
> > >
> > > JNIEXPORT RT JNICALL Java_org_apache_tomcat_jni_##Local##_##create
> > >
> > > , thus the bInheritHandle = TRUE statement is defined in the following
> > > function signature:
> > >
> > > JNIEXPORT RT JNICALL
> > > Java_org_apache_tomcat_jni_##Local##_##create(TCN_STDARGS, jstring
> name,
> > >                                         jlong pool)
> > >
> > > which is a function called by JNDI, and as I guess, by class
> > > org.apache.tomcat.ini.Local, method create() :
> > >
> > >
> > >
> http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/java/org/apache/tomcat/jni/Local.java
> > >
> > > And the javadoc for class Local is: "Local socket"
> > > And for methode create :
> > > /**
> > >
> > >  * Create a socket.
> > >  * @param path The address of the new socket.
> > >  * @param cont The parent pool to use
> > >  * @return The new socket that has been set up.
> > >  */
> > >
> > >
> > > It seems like the native code uses a pool, and my bet is that the pool
> > > is responsible for trying to reuse the socket.
> > >
> > > And something like this may happen: the socket handle, inherited by the
> > > child process, puts the socket in such a state that the pool either
> > > can't, either doesn't want to reuse it.
> > >
> > > And then what happens is that on the other side of the socket, the
> > > client continues to write HTTP requests, and nobody is listening.
> > >
> > > And then when the Tomcat's child process is killed, the socket is
> > > finally closed somehow, the client browser notices it and creates a new
> > > connection to the server and retries the HTTP request.
> > >
> > >
> > > Does that make sense ?
> > >
> > >
> > >
> > > > So I'm
> > > > not familiar with Tomcat Native implementation, but do you know the
> > > global
> > > > architecture ?
> > > > What I guessed is that the Tomcat native stuff created with the
> inherit
> > > > flag, but even if it does, I don't see why it should not work if the
> > > socket
> > > > is closed after a timeout.
> > > >
> > > > Regards
> > > > Jeff
> > > >
> > > >
> > > >
> > > > On Fri, Jun 29, 2012 at 11:22 AM, Laurent Petit <lp...@yseop.com>
> > > wrote:
> > > >
> > > > > Hello Jeff, Konstantin & all,
> > > > >
> > > > > On Mon, 2012-06-25 at 20:52 +0200, verlag.preisser@t-online.dewrote:
> > > > > > Hello Jeff & all,
> > > > > >
> > > > > > > Von: Jeff MAURY <je...@jeffmaury.com>
> > > > > > > Datum: Mon, 25 Jun 2012 18:46:02 +0200
> > > > > >
> > > > > > > Konstantin,
> > > > > > >
> > > > > > > your explanations are very interesting but unclear to me: what
> do
> > > you
> > > > > > > call the inactivity timer ? When it is started ? After the
> request
> > > has
> > > > > > > been processed by the servlet ? In that case, I see no
> difference
> > > > > > > between a servlet that launch a process and another one.
> > > > > > > It seems to me that a process that is launched does not
> inhererits
> > > > > > > handles from its parent process but it's possible that under
> > > Windows,
> > > > > > > it's an option so it would be interesting to watch.
> > > > > > >
> > > > > > > Jeff
> > > > > > >
> > > > > >
> > > > > > Sorry, I'm just a normal Tomcat user, and I don't know how
> exactly
> > > the
> > > > > APR connector and its Timeout works, so I am unable to answer that.
> > > > > >
> > > > > >
> > > > > > Howewer, I did some further observations:
> > > > > >
> > > > > > -When I perform a request to the servlet that opens wordpad.exe,
> the
> > > TCP
> > > > > connection from Tomcat does not close after the timeout - even
> when I
> > > kill
> > > > > the Tomcat process (java.exe), the TCP connection is still open.
> If I
> > > kill
> > > > > wordpad.exe, then finally the connection is closed/aborted.
> > > > > > -When I have 1 TCP connection open to Tomcat and the servlet
> starts
> > > the
> > > > > little C program, Task manager shows that it has 11 handles.
> > > > > > However, when I have 5 TCP connections open to Tomcat, and do the
> > > > > request on one of them, Task maanger shows that the C program has
> 15
> > > > > handles - so four more handles when there are four more
> connections to
> > > > > Tomcat. All of that 5 TCP connections don't close until I kill that
> > > process.
> > > > > >
> > > > > > That seems to me to be an indication that socket handles could be
> > > > > inherited by the child processes that are startet by ProcessBuilder
> > > from
> > > > > tomcat.
> > > > > >
> > > > > > A msdn article mentions how to create a new process using
> > > > > CreateProcess(); it also mentions that socket handles can be
> inherited:
> > > > >
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx
> > > > > >
> > > > > > However, as I don't have much knowledge about programming with
> > > WinAPIs,
> > > > > I don't know why those handles are inherited (the MSDN article
> mentions
> > > > > that a handle must be specified as inheritable when created, to
> allow a
> > > > > child process to inherit it). Maybe someone with more WinAPI/Tomcat
> > > Native
> > > > > knowledge can help here.
> > > > >
> > > > >
> > > > > I also had the vague intuition that this related to handles
> > > inheritence.
> > > > > Your recent tests & research tend to make this hypothesis even more
> > > > > appealing.
> > > > >
> > > > > I know nothing about tomcat-native implementation, but I was able
> to
> > > see
> > > > > that the bInheritHandle member is set to true here in tomcat
> native's C
> > > > > code:
> > > > >
> > > > > lpetit:~/tmp/tomcat-native $ grep "bInheritHandle" -R *
> > > > > native/os/win32/ntpipe.c:    con->sa.bInheritHandle = TRUE;
> > > > >
> > > > > (
> > > > >
> > > > >
> > >
> http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/os/win32/ntpipe.c
> > > )
> > > > >
> > > > >
> > > > > Jeff,
> > > > >
> > > > > What else could we do to help investigate / fix this issue ?
> > > > >
> > > > >
> > > > > Cheers,
> > > > >
> > > > > --
> > > > > Laurent
> > > > >
> > > > >
> > > > > >
> > > > > > Regards,
> > > > > > Konstantin Preißer
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > > >
> > > > >
> > > > > --
> > > > > Laurent Petit
> > > > >
> > > > > Agence +33 (0)4 78 47 07 49
> > > > >
> > > > > Email     lpetit@yseop.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Yseop apporte une réponse intelligente et individualisée à chacun
> de
> > > vos
> > > > > clients
> > > > >
> > > > >
> > > > >
> > > > > www.yseop.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Laurent Petit
> > >
> > > Agence +33 (0)4 78 47 07 49
> > >
> > > Email     lpetit@yseop.com
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Yseop apporte une réponse intelligente et individualisée à chacun de
> vos
> > > clients
> > >
> > >
> > >
> > > www.yseop.com
> > >
> > >
> > >
> >
> >
>
> --
> Laurent Petit
>
> Agence +33 (0)4 78 47 07 49
>
> Email     lpetit@yseop.com
>
>
>
>
>
>
>
> Yseop apporte une réponse intelligente et individualisée à chacun de vos
> clients
>
>
>
> www.yseop.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
On Fri, 2012-06-29 at 15:27 +0200, Jeff MAURY wrote:
> No,
> 
> it does not (yet) make sense because one piece of the puzzle is missing.
> The Local socket is not a TCP socket, it is created from a path rather than
> from an IP address.
> So this socket is in no way linked to the browser, at least directly, and
> the missing piece is what is the relation from this socket to the browser.

You're right, so the question is still open.

In the mean time, I'm come across interesting google search results,
among which the first one seems really interesting:


Oracle Bug 6428742
==================

"Currently, on Windows, Runtime.exec is implemented by calling
CreateProcess with the bInheritHandles argument set to TRUE,
which causes open handles to not be closed if they are not
explicitly set to be non-inherited.  This is the underlying cause
of many subtle bugs, such as

6347873: (so) Ports opened with ServerSocketChannel blocks when using Runtime.exec
http://monaco.sfbay/detail.jsf?cr=6347873"



==> Note the "if they are not explicitly set to be non-inherited" =>
this seems like a game changer, since our implicit assumption was that
we would just look for code which would have accidentally set the handle
to be inherited, not the other way around.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6428742



QT Project
==========

"When using spawned processes, sockets opened by the client remain in
CLOSE_WAIT state after closing the connection. Sockets on the remote
side would be in FIN_WAIT_2 state and waiting for ACK. 
When the spawned (child) process is closed, then ACK is sent and sockets
are finally moved to CLOSE state on both sides. 
This seems to be caused by the default handle inheritance on Windows by
child processes."

https://bugreports.qt-project.org/browse/QTBUG-4465



Zeromq2 project
===============

"On Windows platform, in order to prevent child processes to inherit
parent sockets, SetHandleInformation
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx) should be called on the socket handle.

This patch comes out from discussion at:
https://github.com/zeromq/clrzmq/issues/60"

https://github.com/zeromq/zeromq2-x/pull/51  
and
https://zeromq.jira.com/browse/LIBZMQ-366


I found way more interesting results, but I'll spare space and won't
paste them all in this thread
( google search criteria : "windows inheriting socket handles" )


> 
> Jeff
> 
> 
> On Fri, Jun 29, 2012 at 2:40 PM, Laurent Petit <lp...@yseop.com> wrote:
> 
> > Hello,
> >
> > On Fri, 2012-06-29 at 11:45 +0200, Jeff MAURY wrote:
> >
> > > That what I guessed but I don't understand everything.
> > > The code you are referencing is related to NTPipes and not sockets.
> >
> >
> > I'm not a C expert, but my bet is that the file name is misleading.
> >
> > Indeed, the
> >
> > con->sa.bInheritHandle = TRUE;
> >
> > statement appears in the definition driven by the following macro
> > expansion:
> >
> > TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,
> >
> >                                         jlong pool)
> >
> > And when the macro call TCN_IMPLEMENT_CALL(jlong, Local, create) is
> > preprocessed, it gives:
> >
> >
> > JNIEXPORT RT JNICALL Java_org_apache_tomcat_jni_##Local##_##create
> >
> > , thus the bInheritHandle = TRUE statement is defined in the following
> > function signature:
> >
> > JNIEXPORT RT JNICALL
> > Java_org_apache_tomcat_jni_##Local##_##create(TCN_STDARGS, jstring name,
> >                                         jlong pool)
> >
> > which is a function called by JNDI, and as I guess, by class
> > org.apache.tomcat.ini.Local, method create() :
> >
> >
> > http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/java/org/apache/tomcat/jni/Local.java
> >
> > And the javadoc for class Local is: "Local socket"
> > And for methode create :
> > /**
> >
> >  * Create a socket.
> >  * @param path The address of the new socket.
> >  * @param cont The parent pool to use
> >  * @return The new socket that has been set up.
> >  */
> >
> >
> > It seems like the native code uses a pool, and my bet is that the pool
> > is responsible for trying to reuse the socket.
> >
> > And something like this may happen: the socket handle, inherited by the
> > child process, puts the socket in such a state that the pool either
> > can't, either doesn't want to reuse it.
> >
> > And then what happens is that on the other side of the socket, the
> > client continues to write HTTP requests, and nobody is listening.
> >
> > And then when the Tomcat's child process is killed, the socket is
> > finally closed somehow, the client browser notices it and creates a new
> > connection to the server and retries the HTTP request.
> >
> >
> > Does that make sense ?
> >
> >
> >
> > > So I'm
> > > not familiar with Tomcat Native implementation, but do you know the
> > global
> > > architecture ?
> > > What I guessed is that the Tomcat native stuff created with the inherit
> > > flag, but even if it does, I don't see why it should not work if the
> > socket
> > > is closed after a timeout.
> > >
> > > Regards
> > > Jeff
> > >
> > >
> > >
> > > On Fri, Jun 29, 2012 at 11:22 AM, Laurent Petit <lp...@yseop.com>
> > wrote:
> > >
> > > > Hello Jeff, Konstantin & all,
> > > >
> > > > On Mon, 2012-06-25 at 20:52 +0200, verlag.preisser@t-online.de wrote:
> > > > > Hello Jeff & all,
> > > > >
> > > > > > Von: Jeff MAURY <je...@jeffmaury.com>
> > > > > > Datum: Mon, 25 Jun 2012 18:46:02 +0200
> > > > >
> > > > > > Konstantin,
> > > > > >
> > > > > > your explanations are very interesting but unclear to me: what do
> > you
> > > > > > call the inactivity timer ? When it is started ? After the request
> > has
> > > > > > been processed by the servlet ? In that case, I see no difference
> > > > > > between a servlet that launch a process and another one.
> > > > > > It seems to me that a process that is launched does not inhererits
> > > > > > handles from its parent process but it's possible that under
> > Windows,
> > > > > > it's an option so it would be interesting to watch.
> > > > > >
> > > > > > Jeff
> > > > > >
> > > > >
> > > > > Sorry, I'm just a normal Tomcat user, and I don't know how exactly
> > the
> > > > APR connector and its Timeout works, so I am unable to answer that.
> > > > >
> > > > >
> > > > > Howewer, I did some further observations:
> > > > >
> > > > > -When I perform a request to the servlet that opens wordpad.exe, the
> > TCP
> > > > connection from Tomcat does not close after the timeout - even when I
> > kill
> > > > the Tomcat process (java.exe), the TCP connection is still open. If I
> > kill
> > > > wordpad.exe, then finally the connection is closed/aborted.
> > > > > -When I have 1 TCP connection open to Tomcat and the servlet starts
> > the
> > > > little C program, Task manager shows that it has 11 handles.
> > > > > However, when I have 5 TCP connections open to Tomcat, and do the
> > > > request on one of them, Task maanger shows that the C program has 15
> > > > handles - so four more handles when there are four more connections to
> > > > Tomcat. All of that 5 TCP connections don't close until I kill that
> > process.
> > > > >
> > > > > That seems to me to be an indication that socket handles could be
> > > > inherited by the child processes that are startet by ProcessBuilder
> > from
> > > > tomcat.
> > > > >
> > > > > A msdn article mentions how to create a new process using
> > > > CreateProcess(); it also mentions that socket handles can be inherited:
> > > > http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx
> > > > >
> > > > > However, as I don't have much knowledge about programming with
> > WinAPIs,
> > > > I don't know why those handles are inherited (the MSDN article mentions
> > > > that a handle must be specified as inheritable when created, to allow a
> > > > child process to inherit it). Maybe someone with more WinAPI/Tomcat
> > Native
> > > > knowledge can help here.
> > > >
> > > >
> > > > I also had the vague intuition that this related to handles
> > inheritence.
> > > > Your recent tests & research tend to make this hypothesis even more
> > > > appealing.
> > > >
> > > > I know nothing about tomcat-native implementation, but I was able to
> > see
> > > > that the bInheritHandle member is set to true here in tomcat native's C
> > > > code:
> > > >
> > > > lpetit:~/tmp/tomcat-native $ grep "bInheritHandle" -R *
> > > > native/os/win32/ntpipe.c:    con->sa.bInheritHandle = TRUE;
> > > >
> > > > (
> > > >
> > > >
> > http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/os/win32/ntpipe.c
> > )
> > > >
> > > >
> > > > Jeff,
> > > >
> > > > What else could we do to help investigate / fix this issue ?
> > > >
> > > >
> > > > Cheers,
> > > >
> > > > --
> > > > Laurent
> > > >
> > > >
> > > > >
> > > > > Regards,
> > > > > Konstantin Preißer
> > > > >
> > > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > >
> > > >
> > > > --
> > > > Laurent Petit
> > > >
> > > > Agence +33 (0)4 78 47 07 49
> > > >
> > > > Email     lpetit@yseop.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Yseop apporte une réponse intelligente et individualisée à chacun de
> > vos
> > > > clients
> > > >
> > > >
> > > >
> > > > www.yseop.com
> > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Laurent Petit
> >
> > Agence +33 (0)4 78 47 07 49
> >
> > Email     lpetit@yseop.com
> >
> >
> >
> >
> >
> >
> >
> > Yseop apporte une réponse intelligente et individualisée à chacun de vos
> > clients
> >
> >
> >
> > www.yseop.com
> >
> >
> >
> 
> 

-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: http.conf file

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Welch, Andrea [mailto:awelch@acehardware.com] 
> Subject: RE: http.conf file

> Regarding the official docs - the Proxy Support section is one place 
> that I noted the reference to the httpd.conf file.  We've also been 
> struggling with redirection of an app to be the root app and most of 
> the support information I've found for doing that online have referred
> to an httpd.conf file modification.

Note that those cases use httpd as a front-end.

For redirection with a stand-alone Tomcat, try this:
http://tuckey.org/urlrewrite/

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: http.conf file

Posted by Martin Gainty <mg...@hotmail.com>.
if you are using Apache HTTP Server as a proxy you will need to 1)configure httpd.conf parameters for mod_proxy
2)install mod_proxy.so (or mod_proxy.dll for windows) into your modules folder Instructions available athttp://httpd.apache.org/docs/2.0/mod/mod_proxy.html

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

 > From: awelch@acehardware.com
> To: users@tomcat.apache.org
> Date: Fri, 29 Jun 2012 09:18:51 -0500
> Subject: RE: http.conf file
> 
> Hi Chuck and thanks for the reply.  Regarding the official docs - the Proxy Support section is one place that I noted the reference to the httpd.conf file. We've also been struggling with redirection of an app to be the root app and most of the support information I've found for doing that online have referred to an httpd.conf file modification.
> 
> Andrea
> 
> 
> > -----Original Message-----
> > From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> > Sent: Friday, June 29, 2012 9:10 AM
> > To: Tomcat Users List
> > Subject: RE: http.conf file
> > 
> > > From: Welch, Andrea [mailto:awelch@acehardware.com]
> > > Subject: http.conf file
> > 
> > > Much of the configuration information that is referred to in the
> > > docs found at http://tomcat.apache.org/tomcat-6.0-doc/ and
> > > elsewhere refer to an httpd.conf file.
> > 
> > Can you be specific about where in the Tomcat docs this is mentioned?
> > 
> > > Do I have to create that or is it even pertinent to my installation?
> > 
> > Unless you're using Apache httpd to front-end Tomcat, it's not pertinent.
> > 
> >  - Chuck
> > 
> > 
> > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> > MATERIAL and is thus for use only by the intended recipient. If you received
> > this in error, please contact the sender and delete the e-mail and its
> > attachments from all computers.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

RE: http.conf file

Posted by "Welch, Andrea" <aw...@acehardware.com>.
Hi Chuck and thanks for the reply.  Regarding the official docs - the Proxy Support section is one place that I noted the reference to the httpd.conf file. We've also been struggling with redirection of an app to be the root app and most of the support information I've found for doing that online have referred to an httpd.conf file modification.

Andrea


> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Sent: Friday, June 29, 2012 9:10 AM
> To: Tomcat Users List
> Subject: RE: http.conf file
> 
> > From: Welch, Andrea [mailto:awelch@acehardware.com]
> > Subject: http.conf file
> 
> > Much of the configuration information that is referred to in the
> > docs found at http://tomcat.apache.org/tomcat-6.0-doc/ and
> > elsewhere refer to an httpd.conf file.
> 
> Can you be specific about where in the Tomcat docs this is mentioned?
> 
> > Do I have to create that or is it even pertinent to my installation?
> 
> Unless you're using Apache httpd to front-end Tomcat, it's not pertinent.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: http.conf file

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Welch, Andrea [mailto:awelch@acehardware.com] 
> Subject: http.conf file

> Much of the configuration information that is referred to in the 
> docs found at http://tomcat.apache.org/tomcat-6.0-doc/ and 
> elsewhere refer to an httpd.conf file.

Can you be specific about where in the Tomcat docs this is mentioned?

> Do I have to create that or is it even pertinent to my installation?
 
Unless you're using Apache httpd to front-end Tomcat, it's not pertinent.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


http.conf file

Posted by "Welch, Andrea" <aw...@acehardware.com>.
Greetings,

I'm very new to Apache Tomcat and working with version 6.0.35 installed on a Windows 2008 64-bit server. Much of the configuration information that is referred to in the docs found at http://tomcat.apache.org/tomcat-6.0-doc/ and elsewhere refer to an httpd.conf file.  I'm unable to locate that file in my installation.  Have searched all the typical locations referenced on the web as well as hidden/system files to no avail. Do I have to create that or is it even pertinent to my installation?  Thanks much and excuse the basic question please.

Thank you,

Andrea Welch
Ace Hardware Corp.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Jeff MAURY <je...@jeffmaury.com>.
No,

it does not (yet) make sense because one piece of the puzzle is missing.
The Local socket is not a TCP socket, it is created from a path rather than
from an IP address.
So this socket is in no way linked to the browser, at least directly, and
the missing piece is what is the relation from this socket to the browser.

Jeff


On Fri, Jun 29, 2012 at 2:40 PM, Laurent Petit <lp...@yseop.com> wrote:

> Hello,
>
> On Fri, 2012-06-29 at 11:45 +0200, Jeff MAURY wrote:
>
> > That what I guessed but I don't understand everything.
> > The code you are referencing is related to NTPipes and not sockets.
>
>
> I'm not a C expert, but my bet is that the file name is misleading.
>
> Indeed, the
>
> con->sa.bInheritHandle = TRUE;
>
> statement appears in the definition driven by the following macro
> expansion:
>
> TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,
>
>                                         jlong pool)
>
> And when the macro call TCN_IMPLEMENT_CALL(jlong, Local, create) is
> preprocessed, it gives:
>
>
> JNIEXPORT RT JNICALL Java_org_apache_tomcat_jni_##Local##_##create
>
> , thus the bInheritHandle = TRUE statement is defined in the following
> function signature:
>
> JNIEXPORT RT JNICALL
> Java_org_apache_tomcat_jni_##Local##_##create(TCN_STDARGS, jstring name,
>                                         jlong pool)
>
> which is a function called by JNDI, and as I guess, by class
> org.apache.tomcat.ini.Local, method create() :
>
>
> http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/java/org/apache/tomcat/jni/Local.java
>
> And the javadoc for class Local is: "Local socket"
> And for methode create :
> /**
>
>  * Create a socket.
>  * @param path The address of the new socket.
>  * @param cont The parent pool to use
>  * @return The new socket that has been set up.
>  */
>
>
> It seems like the native code uses a pool, and my bet is that the pool
> is responsible for trying to reuse the socket.
>
> And something like this may happen: the socket handle, inherited by the
> child process, puts the socket in such a state that the pool either
> can't, either doesn't want to reuse it.
>
> And then what happens is that on the other side of the socket, the
> client continues to write HTTP requests, and nobody is listening.
>
> And then when the Tomcat's child process is killed, the socket is
> finally closed somehow, the client browser notices it and creates a new
> connection to the server and retries the HTTP request.
>
>
> Does that make sense ?
>
>
>
> > So I'm
> > not familiar with Tomcat Native implementation, but do you know the
> global
> > architecture ?
> > What I guessed is that the Tomcat native stuff created with the inherit
> > flag, but even if it does, I don't see why it should not work if the
> socket
> > is closed after a timeout.
> >
> > Regards
> > Jeff
> >
> >
> >
> > On Fri, Jun 29, 2012 at 11:22 AM, Laurent Petit <lp...@yseop.com>
> wrote:
> >
> > > Hello Jeff, Konstantin & all,
> > >
> > > On Mon, 2012-06-25 at 20:52 +0200, verlag.preisser@t-online.de wrote:
> > > > Hello Jeff & all,
> > > >
> > > > > Von: Jeff MAURY <je...@jeffmaury.com>
> > > > > Datum: Mon, 25 Jun 2012 18:46:02 +0200
> > > >
> > > > > Konstantin,
> > > > >
> > > > > your explanations are very interesting but unclear to me: what do
> you
> > > > > call the inactivity timer ? When it is started ? After the request
> has
> > > > > been processed by the servlet ? In that case, I see no difference
> > > > > between a servlet that launch a process and another one.
> > > > > It seems to me that a process that is launched does not inhererits
> > > > > handles from its parent process but it's possible that under
> Windows,
> > > > > it's an option so it would be interesting to watch.
> > > > >
> > > > > Jeff
> > > > >
> > > >
> > > > Sorry, I'm just a normal Tomcat user, and I don't know how exactly
> the
> > > APR connector and its Timeout works, so I am unable to answer that.
> > > >
> > > >
> > > > Howewer, I did some further observations:
> > > >
> > > > -When I perform a request to the servlet that opens wordpad.exe, the
> TCP
> > > connection from Tomcat does not close after the timeout - even when I
> kill
> > > the Tomcat process (java.exe), the TCP connection is still open. If I
> kill
> > > wordpad.exe, then finally the connection is closed/aborted.
> > > > -When I have 1 TCP connection open to Tomcat and the servlet starts
> the
> > > little C program, Task manager shows that it has 11 handles.
> > > > However, when I have 5 TCP connections open to Tomcat, and do the
> > > request on one of them, Task maanger shows that the C program has 15
> > > handles - so four more handles when there are four more connections to
> > > Tomcat. All of that 5 TCP connections don't close until I kill that
> process.
> > > >
> > > > That seems to me to be an indication that socket handles could be
> > > inherited by the child processes that are startet by ProcessBuilder
> from
> > > tomcat.
> > > >
> > > > A msdn article mentions how to create a new process using
> > > CreateProcess(); it also mentions that socket handles can be inherited:
> > > http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx
> > > >
> > > > However, as I don't have much knowledge about programming with
> WinAPIs,
> > > I don't know why those handles are inherited (the MSDN article mentions
> > > that a handle must be specified as inheritable when created, to allow a
> > > child process to inherit it). Maybe someone with more WinAPI/Tomcat
> Native
> > > knowledge can help here.
> > >
> > >
> > > I also had the vague intuition that this related to handles
> inheritence.
> > > Your recent tests & research tend to make this hypothesis even more
> > > appealing.
> > >
> > > I know nothing about tomcat-native implementation, but I was able to
> see
> > > that the bInheritHandle member is set to true here in tomcat native's C
> > > code:
> > >
> > > lpetit:~/tmp/tomcat-native $ grep "bInheritHandle" -R *
> > > native/os/win32/ntpipe.c:    con->sa.bInheritHandle = TRUE;
> > >
> > > (
> > >
> > >
> http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/os/win32/ntpipe.c
> )
> > >
> > >
> > > Jeff,
> > >
> > > What else could we do to help investigate / fix this issue ?
> > >
> > >
> > > Cheers,
> > >
> > > --
> > > Laurent
> > >
> > >
> > > >
> > > > Regards,
> > > > Konstantin Preißer
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > >
> > > --
> > > Laurent Petit
> > >
> > > Agence +33 (0)4 78 47 07 49
> > >
> > > Email     lpetit@yseop.com
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Yseop apporte une réponse intelligente et individualisée à chacun de
> vos
> > > clients
> > >
> > >
> > >
> > > www.yseop.com
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
> >
>
>
> --
> Laurent Petit
>
> Agence +33 (0)4 78 47 07 49
>
> Email     lpetit@yseop.com
>
>
>
>
>
>
>
> Yseop apporte une réponse intelligente et individualisée à chacun de vos
> clients
>
>
>
> www.yseop.com
>
>
>


-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
Hello,

On Fri, 2012-06-29 at 11:45 +0200, Jeff MAURY wrote:

> That what I guessed but I don't understand everything.
> The code you are referencing is related to NTPipes and not sockets. 


I'm not a C expert, but my bet is that the file name is misleading.

Indeed, the 

con->sa.bInheritHandle = TRUE;

statement appears in the definition driven by the following macro
expansion:

TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,

                                         jlong pool)

And when the macro call TCN_IMPLEMENT_CALL(jlong, Local, create) is preprocessed, it gives:


JNIEXPORT RT JNICALL Java_org_apache_tomcat_jni_##Local##_##create

, thus the bInheritHandle = TRUE statement is defined in the following
function signature:

JNIEXPORT RT JNICALL
Java_org_apache_tomcat_jni_##Local##_##create(TCN_STDARGS, jstring name,
                                         jlong pool)

which is a function called by JNDI, and as I guess, by class
org.apache.tomcat.ini.Local, method create() :

http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/java/org/apache/tomcat/jni/Local.java

And the javadoc for class Local is: "Local socket"
And for methode create :
/**

 * Create a socket.
 * @param path The address of the new socket.
 * @param cont The parent pool to use
 * @return The new socket that has been set up.
 */


It seems like the native code uses a pool, and my bet is that the pool
is responsible for trying to reuse the socket.

And something like this may happen: the socket handle, inherited by the
child process, puts the socket in such a state that the pool either
can't, either doesn't want to reuse it.

And then what happens is that on the other side of the socket, the
client continues to write HTTP requests, and nobody is listening.

And then when the Tomcat's child process is killed, the socket is
finally closed somehow, the client browser notices it and creates a new
connection to the server and retries the HTTP request.


Does that make sense ?



> So I'm
> not familiar with Tomcat Native implementation, but do you know the global
> architecture ?
> What I guessed is that the Tomcat native stuff created with the inherit
> flag, but even if it does, I don't see why it should not work if the socket
> is closed after a timeout.
> 
> Regards
> Jeff
> 
> 
> 
> On Fri, Jun 29, 2012 at 11:22 AM, Laurent Petit <lp...@yseop.com> wrote:
> 
> > Hello Jeff, Konstantin & all,
> >
> > On Mon, 2012-06-25 at 20:52 +0200, verlag.preisser@t-online.de wrote:
> > > Hello Jeff & all,
> > >
> > > > Von: Jeff MAURY <je...@jeffmaury.com>
> > > > Datum: Mon, 25 Jun 2012 18:46:02 +0200
> > >
> > > > Konstantin,
> > > >
> > > > your explanations are very interesting but unclear to me: what do you
> > > > call the inactivity timer ? When it is started ? After the request has
> > > > been processed by the servlet ? In that case, I see no difference
> > > > between a servlet that launch a process and another one.
> > > > It seems to me that a process that is launched does not inhererits
> > > > handles from its parent process but it's possible that under Windows,
> > > > it's an option so it would be interesting to watch.
> > > >
> > > > Jeff
> > > >
> > >
> > > Sorry, I'm just a normal Tomcat user, and I don't know how exactly the
> > APR connector and its Timeout works, so I am unable to answer that.
> > >
> > >
> > > Howewer, I did some further observations:
> > >
> > > -When I perform a request to the servlet that opens wordpad.exe, the TCP
> > connection from Tomcat does not close after the timeout - even when I kill
> > the Tomcat process (java.exe), the TCP connection is still open. If I kill
> > wordpad.exe, then finally the connection is closed/aborted.
> > > -When I have 1 TCP connection open to Tomcat and the servlet starts the
> > little C program, Task manager shows that it has 11 handles.
> > > However, when I have 5 TCP connections open to Tomcat, and do the
> > request on one of them, Task maanger shows that the C program has 15
> > handles - so four more handles when there are four more connections to
> > Tomcat. All of that 5 TCP connections don't close until I kill that process.
> > >
> > > That seems to me to be an indication that socket handles could be
> > inherited by the child processes that are startet by ProcessBuilder from
> > tomcat.
> > >
> > > A msdn article mentions how to create a new process using
> > CreateProcess(); it also mentions that socket handles can be inherited:
> > http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx
> > >
> > > However, as I don't have much knowledge about programming with WinAPIs,
> > I don't know why those handles are inherited (the MSDN article mentions
> > that a handle must be specified as inheritable when created, to allow a
> > child process to inherit it). Maybe someone with more WinAPI/Tomcat Native
> > knowledge can help here.
> >
> >
> > I also had the vague intuition that this related to handles inheritence.
> > Your recent tests & research tend to make this hypothesis even more
> > appealing.
> >
> > I know nothing about tomcat-native implementation, but I was able to see
> > that the bInheritHandle member is set to true here in tomcat native's C
> > code:
> >
> > lpetit:~/tmp/tomcat-native $ grep "bInheritHandle" -R *
> > native/os/win32/ntpipe.c:    con->sa.bInheritHandle = TRUE;
> >
> > (
> >
> > http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/os/win32/ntpipe.c)
> >
> >
> > Jeff,
> >
> > What else could we do to help investigate / fix this issue ?
> >
> >
> > Cheers,
> >
> > --
> > Laurent
> >
> >
> > >
> > > Regards,
> > > Konstantin Preißer
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> >
> > --
> > Laurent Petit
> >
> > Agence +33 (0)4 78 47 07 49
> >
> > Email     lpetit@yseop.com
> >
> >
> >
> >
> >
> >
> >
> > Yseop apporte une réponse intelligente et individualisée à chacun de vos
> > clients
> >
> >
> >
> > www.yseop.com
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 
> 


-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com



Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Jeff MAURY <je...@jeffmaury.com>.
That what I guessed but I don't understand everything.
The code you are referencing is related to NTPipes and not sockets. So I'm
not familiar with Tomcat Native implementation, but do you know the global
architecture ?
What I guessed is that the Tomcat native stuff created with the inherit
flag, but even if it does, I don't see why it should not work if the socket
is closed after a timeout.

Regards
Jeff



On Fri, Jun 29, 2012 at 11:22 AM, Laurent Petit <lp...@yseop.com> wrote:

> Hello Jeff, Konstantin & all,
>
> On Mon, 2012-06-25 at 20:52 +0200, verlag.preisser@t-online.de wrote:
> > Hello Jeff & all,
> >
> > > Von: Jeff MAURY <je...@jeffmaury.com>
> > > Datum: Mon, 25 Jun 2012 18:46:02 +0200
> >
> > > Konstantin,
> > >
> > > your explanations are very interesting but unclear to me: what do you
> > > call the inactivity timer ? When it is started ? After the request has
> > > been processed by the servlet ? In that case, I see no difference
> > > between a servlet that launch a process and another one.
> > > It seems to me that a process that is launched does not inhererits
> > > handles from its parent process but it's possible that under Windows,
> > > it's an option so it would be interesting to watch.
> > >
> > > Jeff
> > >
> >
> > Sorry, I'm just a normal Tomcat user, and I don't know how exactly the
> APR connector and its Timeout works, so I am unable to answer that.
> >
> >
> > Howewer, I did some further observations:
> >
> > -When I perform a request to the servlet that opens wordpad.exe, the TCP
> connection from Tomcat does not close after the timeout - even when I kill
> the Tomcat process (java.exe), the TCP connection is still open. If I kill
> wordpad.exe, then finally the connection is closed/aborted.
> > -When I have 1 TCP connection open to Tomcat and the servlet starts the
> little C program, Task manager shows that it has 11 handles.
> > However, when I have 5 TCP connections open to Tomcat, and do the
> request on one of them, Task maanger shows that the C program has 15
> handles - so four more handles when there are four more connections to
> Tomcat. All of that 5 TCP connections don't close until I kill that process.
> >
> > That seems to me to be an indication that socket handles could be
> inherited by the child processes that are startet by ProcessBuilder from
> tomcat.
> >
> > A msdn article mentions how to create a new process using
> CreateProcess(); it also mentions that socket handles can be inherited:
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx
> >
> > However, as I don't have much knowledge about programming with WinAPIs,
> I don't know why those handles are inherited (the MSDN article mentions
> that a handle must be specified as inheritable when created, to allow a
> child process to inherit it). Maybe someone with more WinAPI/Tomcat Native
> knowledge can help here.
>
>
> I also had the vague intuition that this related to handles inheritence.
> Your recent tests & research tend to make this hypothesis even more
> appealing.
>
> I know nothing about tomcat-native implementation, but I was able to see
> that the bInheritHandle member is set to true here in tomcat native's C
> code:
>
> lpetit:~/tmp/tomcat-native $ grep "bInheritHandle" -R *
> native/os/win32/ntpipe.c:    con->sa.bInheritHandle = TRUE;
>
> (
>
> http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/os/win32/ntpipe.c)
>
>
> Jeff,
>
> What else could we do to help investigate / fix this issue ?
>
>
> Cheers,
>
> --
> Laurent
>
>
> >
> > Regards,
> > Konstantin Preißer
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
> --
> Laurent Petit
>
> Agence +33 (0)4 78 47 07 49
>
> Email     lpetit@yseop.com
>
>
>
>
>
>
>
> Yseop apporte une réponse intelligente et individualisée à chacun de vos
> clients
>
>
>
> www.yseop.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
Hello Jeff, Konstantin & all,

On Mon, 2012-06-25 at 20:52 +0200, verlag.preisser@t-online.de wrote:
> Hello Jeff & all,
> 
> > Von: Jeff MAURY <je...@jeffmaury.com>
> > Datum: Mon, 25 Jun 2012 18:46:02 +0200
> 
> > Konstantin,
> > 
> > your explanations are very interesting but unclear to me: what do you
> > call the inactivity timer ? When it is started ? After the request has
> > been processed by the servlet ? In that case, I see no difference
> > between a servlet that launch a process and another one.
> > It seems to me that a process that is launched does not inhererits
> > handles from its parent process but it's possible that under Windows,
> > it's an option so it would be interesting to watch.
> > 
> > Jeff
> > 
> 
> Sorry, I'm just a normal Tomcat user, and I don't know how exactly the APR connector and its Timeout works, so I am unable to answer that.
> 
> 
> Howewer, I did some further observations:
> 
> -When I perform a request to the servlet that opens wordpad.exe, the TCP connection from Tomcat does not close after the timeout - even when I kill the Tomcat process (java.exe), the TCP connection is still open. If I kill wordpad.exe, then finally the connection is closed/aborted.
> -When I have 1 TCP connection open to Tomcat and the servlet starts the little C program, Task manager shows that it has 11 handles.
> However, when I have 5 TCP connections open to Tomcat, and do the request on one of them, Task maanger shows that the C program has 15 handles - so four more handles when there are four more connections to Tomcat. All of that 5 TCP connections don't close until I kill that process.
> 
> That seems to me to be an indication that socket handles could be inherited by the child processes that are startet by ProcessBuilder from tomcat.
> 
> A msdn article mentions how to create a new process using CreateProcess(); it also mentions that socket handles can be inherited: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx
> 
> However, as I don't have much knowledge about programming with WinAPIs, I don't know why those handles are inherited (the MSDN article mentions that a handle must be specified as inheritable when created, to allow a child process to inherit it). Maybe someone with more WinAPI/Tomcat Native knowledge can help here.


I also had the vague intuition that this related to handles inheritence.
Your recent tests & research tend to make this hypothesis even more
appealing.

I know nothing about tomcat-native implementation, but I was able to see
that the bInheritHandle member is set to true here in tomcat native's C
code:

lpetit:~/tmp/tomcat-native $ grep "bInheritHandle" -R *
native/os/win32/ntpipe.c:    con->sa.bInheritHandle = TRUE;

(
http://svn.apache.org/repos/asf/tomcat/native/branches/1.1.x/native/os/win32/ntpipe.c )


Jeff, 

What else could we do to help investigate / fix this issue ?


Cheers,

-- 
Laurent


> 
> Regards,
> Konstantin Preißer
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by "verlag.preisser@t-online.de" <ve...@t-online.de>.
Hello Jeff & all,

> Von: Jeff MAURY <je...@jeffmaury.com>
> Datum: Mon, 25 Jun 2012 18:46:02 +0200

> Konstantin,
> 
> your explanations are very interesting but unclear to me: what do you
> call the inactivity timer ? When it is started ? After the request has
> been processed by the servlet ? In that case, I see no difference
> between a servlet that launch a process and another one.
> It seems to me that a process that is launched does not inhererits
> handles from its parent process but it's possible that under Windows,
> it's an option so it would be interesting to watch.
> 
> Jeff
> 

Sorry, I'm just a normal Tomcat user, and I don't know how exactly the APR connector and its Timeout works, so I am unable to answer that.


Howewer, I did some further observations:

-When I perform a request to the servlet that opens wordpad.exe, the TCP connection from Tomcat does not close after the timeout - even when I kill the Tomcat process (java.exe), the TCP connection is still open. If I kill wordpad.exe, then finally the connection is closed/aborted.
-When I have 1 TCP connection open to Tomcat and the servlet starts the little C program, Task manager shows that it has 11 handles.
However, when I have 5 TCP connections open to Tomcat, and do the request on one of them, Task maanger shows that the C program has 15 handles - so four more handles when there are four more connections to Tomcat. All of that 5 TCP connections don't close until I kill that process.

That seems to me to be an indication that socket handles could be inherited by the child processes that are startet by ProcessBuilder from tomcat.

A msdn article mentions how to create a new process using CreateProcess(); it also mentions that socket handles can be inherited: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724466.aspx

However, as I don't have much knowledge about programming with WinAPIs, I don't know why those handles are inherited (the MSDN article mentions that a handle must be specified as inheritable when created, to allow a child process to inherit it). Maybe someone with more WinAPI/Tomcat Native knowledge can help here.


Regards,
Konstantin Preißer



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Jeff MAURY <je...@jeffmaury.com>.
Konstantin,

your explanations are very interesting but unclear to me: what do you call
the inactivity timer ? When it is started ? After the request has been
processed by the servlet ? In that case, I see no difference between a
servlet that launch a process and another one.
It seems to me that a process that is launched does not inhererits handles
from its parent process but it's possible that under Windows, it's an
option so it would be interesting to watch.

Jeff


On Mon, Jun 25, 2012 at 6:23 PM, verlag.preisser@t-online.de <
verlag.preisser@t-online.de> wrote:

>
>
> > Von: Laurent Petit <lp...@yseop.com>
> > Datum: Mon, 25 Jun 2012 17:46:06 +0200
> > Hello Jeff & al,
> >
> > Here it is, I've created a Git repository with the sources for the
> > webapp & the test  (maven projects), and instructions in the README on
> > how to reproduce the issue.
> >
> > https://github.com/lpetit-yseop/apr-test
> >
> > Hope this will help you get started on reproducing the problem,
> >
> > Regards,
>
> Hello,
>
> I also could reproduce the problem on WIndows 7 64 Bit with Java 1.7.0_05
> (64-bit) and Tomcat 7.0.28, using TC Native 1.1.24. I also used a small
> connectionTimeout="200".
>
> What I can see is, that with a normal request (that doesn't start a new
> process), Tomcat processes the request, and after an inactivity timeout of
> 200 ms,  the APR connector closes the TCP connection. When the browser
> makes another request, it does open a new connection for that request.
>
> However, when a request goes to a servlet that starts a new process, and
> the timeout of 200 ms occurs, the TCP connection is not closed - but Tomcat
> doesn't seem to read on it any more, so further requests sent on that TCP
> connection will never be processed.
> When the new process (wordpad.exe) is closed, the TCP connection will be
> aborted. Then, the browser probably establishes a new TCP connection and
> re-sends it request there, which is processed by Tomcat.
>
> Unfortunately, don't have any knowledge of programming native (C)
> programms using Windows APIs, so I can only make a guess: Could it be that
> some handles to files/sockets are inherited to the child process
> (wordpad.exe) when launched by Java's ProcessBuilder, which prevent the
> socket from being closed?
> E.g., when I launch a simple C app (which calls WaitForSingleObject(-1,
> 999999)) from the Windows explorer, I can see 7 handles in the taskmanger;
> whereas when it is launched by the servlet in tomcat, Task manager shows 11
> handles - but as said, I don't know if that has something to do with the
> problem.
>
> Regards,
> Konstantin Preißer
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by "verlag.preisser@t-online.de" <ve...@t-online.de>.

> Von: Laurent Petit <lp...@yseop.com>
> Datum: Mon, 25 Jun 2012 17:46:06 +0200
> Hello Jeff & al,
> 
> Here it is, I've created a Git repository with the sources for the
> webapp & the test  (maven projects), and instructions in the README on
> how to reproduce the issue.
> 
> https://github.com/lpetit-yseop/apr-test
> 
> Hope this will help you get started on reproducing the problem,
> 
> Regards,

Hello,

I also could reproduce the problem on WIndows 7 64 Bit with Java 1.7.0_05 (64-bit) and Tomcat 7.0.28, using TC Native 1.1.24. I also used a small connectionTimeout="200".

What I can see is, that with a normal request (that doesn't start a new process), Tomcat processes the request, and after an inactivity timeout of 200 ms,  the APR connector closes the TCP connection. When the browser makes another request, it does open a new connection for that request.

However, when a request goes to a servlet that starts a new process, and the timeout of 200 ms occurs, the TCP connection is not closed - but Tomcat doesn't seem to read on it any more, so further requests sent on that TCP connection will never be processed.
When the new process (wordpad.exe) is closed, the TCP connection will be aborted. Then, the browser probably establishes a new TCP connection and re-sends it request there, which is processed by Tomcat.

Unfortunately, don't have any knowledge of programming native (C) programms using Windows APIs, so I can only make a guess: Could it be that some handles to files/sockets are inherited to the child process (wordpad.exe) when launched by Java's ProcessBuilder, which prevent the socket from being closed?
E.g., when I launch a simple C app (which calls WaitForSingleObject(-1, 999999)) from the Windows explorer, I can see 7 handles in the taskmanger; whereas when it is launched by the servlet in tomcat, Task manager shows 11 handles - but as said, I don't know if that has something to do with the problem.

Regards,
Konstantin Preißer




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
Hello Jeff & al, 

Here it is, I've created a Git repository with the sources for the
webapp & the test  (maven projects), and instructions in the README on
how to reproduce the issue.

https://github.com/lpetit-yseop/apr-test

Hope this will help you get started on reproducing the problem,

Regards,

-- 
Laurent Petit

On Mon, 2012-06-25 at 14:42 +0200, Jeff MAURY wrote:
> Yes, fine
> 
> Jeff
> 
> 
> On Mon, Jun 25, 2012 at 1:46 PM, Laurent Petit <lp...@yseop.com> wrote:
> 
> > On Mon, 2012-06-25 at 11:51 +0200, Jeff MAURY wrote:
> >
> > > If you can post a Mavenized example, I could have time to run it and
> > watch
> > > at it.
> >
> >
> > Ok, thanks, I will.
> >
> > Is a mavenized project with source code published on github ok for you ?
> >
> >
> > >
> > > Regards
> > > Jeff
> > >
> > >
> > > On Mon, Jun 25, 2012 at 11:40 AM, Laurent Petit <lp...@yseop.com>
> > wrote:
> > >
> > > > Hello,
> > > >
> > > > Is there anything I can do to help qualify the problem even more ?
> > > >
> > > > Beyond having shown the source code of the servlet, would a fully
> > > > mavenized example help? Anything else?
> > > >
> > > > Regards,
> > > >
> > > > --
> > > > Laurent
> > > >
> > > >
> > > > On Fri, 2012-06-22 at 10:21 +0200, Laurent Petit wrote:
> > > > > Hello,
> > > > >
> > > > > On Thu, 2012-06-21 at 22:53 +0200, Jeff MAURY wrote:
> > > > > > Is it specific to Wordpad or any launched process will do the
> > trick ?
> > > > > > Do you tried with a non UI process (console) ?
> > > > >
> > > > >
> > > > > I did an additional test, as you suggested, with a non UI process (a
> > > > > small java executable launched in headless mode, whose purpose was
> > just
> > > > > to wait for 20 seconds before exiting).
> > > > >
> > > > > I can reproduce the problem with this headless executable: the HTTP
> > > > > client is blocked until the 20 seconds elapse and the process is
> > killed.
> > > > >
> > > > >
> > > > > Here is the modified servlet code I used:
> > > > >
> > > > > https://www.refheap.com/paste/3285
> > > > >
> > > > >
> > > > > and here is the code for the small java program:
> > > > >
> > > > > https://www.refheap.com/paste/3286
> > > > >
> > > > >
> > > > >
> > > > > Regards,
> > > > >
> > > > > --
> > > > > Laurent
> > > > >
> > > > >
> > > > >
> > > > > >
> > > > > > Jeff
> > > > > >
> > > > > > On Thu, Jun 21, 2012 at 10:45 PM, Laurent Petit <lp...@yseop.com>
> > > > wrote:
> > > > > >
> > > > > > > En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21
> > > > juin
> > > > > > > 2012 00:07 Can you verify your 2 threads (reading input an
> > error) are
> > > > > > > launched ? Yes they are. Verified. Can you confirm you are
> > getting
> > > > the
> > > > > > > problem only on Windows ? Yes sir, we're unable to reproduce it
> > on
> > > > Ubuntu.
> > > > > > > Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <
> > > > lpetit@yseop.com>
> > > > > > > wrote: > Hello, > > I have a problem with keep-alive connections,
> > > > when
> > > > > > > starting a subprocess > (via JDK's default ProcessBuilder/Process
> > > > API),
> > > > > > > while also having > started Tomcat with the APR HTTP/1.1
> > Connector.
> > > > > > The
> > > > > > > problem symptom is with Keep-Alive connection, as follows: > > -
> > the
> > > > client
> > > > > > > (browser, jmeter, etc.) sends a first request > - the servlet
> > starts
> > > > a
> > > > > > > Process for e.g. wordpad.exe > - the servlet returns an
> > > > acknowledgment html
> > > > > > > content, sets the content > length, flushes the writer, and
> > returns
> > > > > - the
> > > > > > > client displays the received acknowledgement html content, sends
> > >
> > > > the
> > > > > > > second request to the server. > - the server doesn't answer. No
> > > > Tomcat log
> > > > > > > ever reports the start of > something received. > - Then when on
> > the
> > > > server
> > > > > > > you close the wordpad.exe instance, the server > finally handles
> > the
> > > > second
> > > > > > > request. > > I have created a small servlet code which
> > reproduces the
> > > > > > > problem. > For the demo, it suffices to have the started
> > subprocess
> > > > be >
> > > > > > > "wordpad.exe". Of course my real process is more interesting
> > than >
> > > > that
> > > > > > > :-). > > You can find the servlet code for reproducing the test
> > > > here: > >
> > > > > > > https://www.refheap.com/paste/3254 > > > To reproduce the
> > problem
> > > > > > > deterministically, the ConnectionTimeout for > the APR HTTP
> > > > Connector in
> > > > > > > servlet.xml must be set sufficiently low. > With my boxes, I get
> > a
> > > > 100%
> > > > > > > error hit when set at 200 ms. > > You can find here the jmeter
> > > > script which
> > > > > > > hits the same page again and > again with "keep-alive" option set
> > > > on: > >
> > > > > > > https://www.refheap.com/paste/3255 > > > So far, the only
> > reliable
> > > > > > > solution we have found to work around this > problem is to not
> > use
> > > > the
> > > > > > > HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US
> > > > std R2
> > > > > > > 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > >
> > Same
> > > > issue
> > > > > > > has been observed on Windows 7 32 bits. > > Was not able to
> > > > reproduce the
> > > > > > > issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for
> > your
> > > > > > > support, ideas, solutions, etc. > > > >
> > > > > > >
> > > > ---------------------------------------------------------------------
> > > To
> > > > > > > unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For
> > > > additional
> > > > > > > commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY
> > > > "Legacy
> > > > > > > code" often differs from its suggested alternative by actually
> > > > working and
> > > > > > > scaling. - Bjarne Stroustrup http://www.jeffmaury.com
> > > > > > > http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > > --
> > > > Laurent Petit
> > > >
> > > > Agence +33 (0)4 78 47 07 49
> > > >
> > > > Email     lpetit@yseop.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Yseop apporte une réponse intelligente et individualisée à chacun de
> > vos
> > > > clients
> > > >
> > > >
> > > >
> > > > www.yseop.com
> > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Laurent Petit
> >
> > Agence +33 (0)4 78 47 07 49
> >
> > Email     lpetit@yseop.com
> >
> >
> >
> >
> >
> >
> >
> > Yseop apporte une réponse intelligente et individualisée à chacun de vos
> > clients
> >
> >
> >
> > www.yseop.com
> >
> >
> >
> 
> 

-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Jeff MAURY <je...@jeffmaury.com>.
Yes, fine

Jeff


On Mon, Jun 25, 2012 at 1:46 PM, Laurent Petit <lp...@yseop.com> wrote:

> On Mon, 2012-06-25 at 11:51 +0200, Jeff MAURY wrote:
>
> > If you can post a Mavenized example, I could have time to run it and
> watch
> > at it.
>
>
> Ok, thanks, I will.
>
> Is a mavenized project with source code published on github ok for you ?
>
>
> >
> > Regards
> > Jeff
> >
> >
> > On Mon, Jun 25, 2012 at 11:40 AM, Laurent Petit <lp...@yseop.com>
> wrote:
> >
> > > Hello,
> > >
> > > Is there anything I can do to help qualify the problem even more ?
> > >
> > > Beyond having shown the source code of the servlet, would a fully
> > > mavenized example help? Anything else?
> > >
> > > Regards,
> > >
> > > --
> > > Laurent
> > >
> > >
> > > On Fri, 2012-06-22 at 10:21 +0200, Laurent Petit wrote:
> > > > Hello,
> > > >
> > > > On Thu, 2012-06-21 at 22:53 +0200, Jeff MAURY wrote:
> > > > > Is it specific to Wordpad or any launched process will do the
> trick ?
> > > > > Do you tried with a non UI process (console) ?
> > > >
> > > >
> > > > I did an additional test, as you suggested, with a non UI process (a
> > > > small java executable launched in headless mode, whose purpose was
> just
> > > > to wait for 20 seconds before exiting).
> > > >
> > > > I can reproduce the problem with this headless executable: the HTTP
> > > > client is blocked until the 20 seconds elapse and the process is
> killed.
> > > >
> > > >
> > > > Here is the modified servlet code I used:
> > > >
> > > > https://www.refheap.com/paste/3285
> > > >
> > > >
> > > > and here is the code for the small java program:
> > > >
> > > > https://www.refheap.com/paste/3286
> > > >
> > > >
> > > >
> > > > Regards,
> > > >
> > > > --
> > > > Laurent
> > > >
> > > >
> > > >
> > > > >
> > > > > Jeff
> > > > >
> > > > > On Thu, Jun 21, 2012 at 10:45 PM, Laurent Petit <lp...@yseop.com>
> > > wrote:
> > > > >
> > > > > > En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21
> > > juin
> > > > > > 2012 00:07 Can you verify your 2 threads (reading input an
> error) are
> > > > > > launched ? Yes they are. Verified. Can you confirm you are
> getting
> > > the
> > > > > > problem only on Windows ? Yes sir, we're unable to reproduce it
> on
> > > Ubuntu.
> > > > > > Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <
> > > lpetit@yseop.com>
> > > > > > wrote: > Hello, > > I have a problem with keep-alive connections,
> > > when
> > > > > > starting a subprocess > (via JDK's default ProcessBuilder/Process
> > > API),
> > > > > > while also having > started Tomcat with the APR HTTP/1.1
> Connector.
> > > > > The
> > > > > > problem symptom is with Keep-Alive connection, as follows: > > -
> the
> > > client
> > > > > > (browser, jmeter, etc.) sends a first request > - the servlet
> starts
> > > a
> > > > > > Process for e.g. wordpad.exe > - the servlet returns an
> > > acknowledgment html
> > > > > > content, sets the content > length, flushes the writer, and
> returns
> > > > - the
> > > > > > client displays the received acknowledgement html content, sends
> >
> > > the
> > > > > > second request to the server. > - the server doesn't answer. No
> > > Tomcat log
> > > > > > ever reports the start of > something received. > - Then when on
> the
> > > server
> > > > > > you close the wordpad.exe instance, the server > finally handles
> the
> > > second
> > > > > > request. > > I have created a small servlet code which
> reproduces the
> > > > > > problem. > For the demo, it suffices to have the started
> subprocess
> > > be >
> > > > > > "wordpad.exe". Of course my real process is more interesting
> than >
> > > that
> > > > > > :-). > > You can find the servlet code for reproducing the test
> > > here: > >
> > > > > > https://www.refheap.com/paste/3254 > > > To reproduce the
> problem
> > > > > > deterministically, the ConnectionTimeout for > the APR HTTP
> > > Connector in
> > > > > > servlet.xml must be set sufficiently low. > With my boxes, I get
> a
> > > 100%
> > > > > > error hit when set at 200 ms. > > You can find here the jmeter
> > > script which
> > > > > > hits the same page again and > again with "keep-alive" option set
> > > on: > >
> > > > > > https://www.refheap.com/paste/3255 > > > So far, the only
> reliable
> > > > > > solution we have found to work around this > problem is to not
> use
> > > the
> > > > > > HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US
> > > std R2
> > > > > > 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > >
> Same
> > > issue
> > > > > > has been observed on Windows 7 32 bits. > > Was not able to
> > > reproduce the
> > > > > > issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for
> your
> > > > > > support, ideas, solutions, etc. > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > To
> > > > > > unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For
> > > additional
> > > > > > commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY
> > > "Legacy
> > > > > > code" often differs from its suggested alternative by actually
> > > working and
> > > > > > scaling. - Bjarne Stroustrup http://www.jeffmaury.com
> > > > > > http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > > --
> > > Laurent Petit
> > >
> > > Agence +33 (0)4 78 47 07 49
> > >
> > > Email     lpetit@yseop.com
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Yseop apporte une réponse intelligente et individualisée à chacun de
> vos
> > > clients
> > >
> > >
> > >
> > > www.yseop.com
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
> >
>
>
> --
> Laurent Petit
>
> Agence +33 (0)4 78 47 07 49
>
> Email     lpetit@yseop.com
>
>
>
>
>
>
>
> Yseop apporte une réponse intelligente et individualisée à chacun de vos
> clients
>
>
>
> www.yseop.com
>
>
>


-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
On Mon, 2012-06-25 at 11:51 +0200, Jeff MAURY wrote:

> If you can post a Mavenized example, I could have time to run it and watch
> at it.


Ok, thanks, I will.

Is a mavenized project with source code published on github ok for you ?


> 
> Regards
> Jeff
> 
> 
> On Mon, Jun 25, 2012 at 11:40 AM, Laurent Petit <lp...@yseop.com> wrote:
> 
> > Hello,
> >
> > Is there anything I can do to help qualify the problem even more ?
> >
> > Beyond having shown the source code of the servlet, would a fully
> > mavenized example help? Anything else?
> >
> > Regards,
> >
> > --
> > Laurent
> >
> >
> > On Fri, 2012-06-22 at 10:21 +0200, Laurent Petit wrote:
> > > Hello,
> > >
> > > On Thu, 2012-06-21 at 22:53 +0200, Jeff MAURY wrote:
> > > > Is it specific to Wordpad or any launched process will do the trick ?
> > > > Do you tried with a non UI process (console) ?
> > >
> > >
> > > I did an additional test, as you suggested, with a non UI process (a
> > > small java executable launched in headless mode, whose purpose was just
> > > to wait for 20 seconds before exiting).
> > >
> > > I can reproduce the problem with this headless executable: the HTTP
> > > client is blocked until the 20 seconds elapse and the process is killed.
> > >
> > >
> > > Here is the modified servlet code I used:
> > >
> > > https://www.refheap.com/paste/3285
> > >
> > >
> > > and here is the code for the small java program:
> > >
> > > https://www.refheap.com/paste/3286
> > >
> > >
> > >
> > > Regards,
> > >
> > > --
> > > Laurent
> > >
> > >
> > >
> > > >
> > > > Jeff
> > > >
> > > > On Thu, Jun 21, 2012 at 10:45 PM, Laurent Petit <lp...@yseop.com>
> > wrote:
> > > >
> > > > > En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21
> > juin
> > > > > 2012 00:07 Can you verify your 2 threads (reading input an error) are
> > > > > launched ? Yes they are. Verified. Can you confirm you are getting
> > the
> > > > > problem only on Windows ? Yes sir, we're unable to reproduce it on
> > Ubuntu.
> > > > > Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <
> > lpetit@yseop.com>
> > > > > wrote: > Hello, > > I have a problem with keep-alive connections,
> > when
> > > > > starting a subprocess > (via JDK's default ProcessBuilder/Process
> > API),
> > > > > while also having > started Tomcat with the APR HTTP/1.1 Connector.
> > > > The
> > > > > problem symptom is with Keep-Alive connection, as follows: > > - the
> > client
> > > > > (browser, jmeter, etc.) sends a first request > - the servlet starts
> > a
> > > > > Process for e.g. wordpad.exe > - the servlet returns an
> > acknowledgment html
> > > > > content, sets the content > length, flushes the writer, and returns
> > > - the
> > > > > client displays the received acknowledgement html content, sends >
> > the
> > > > > second request to the server. > - the server doesn't answer. No
> > Tomcat log
> > > > > ever reports the start of > something received. > - Then when on the
> > server
> > > > > you close the wordpad.exe instance, the server > finally handles the
> > second
> > > > > request. > > I have created a small servlet code which reproduces the
> > > > > problem. > For the demo, it suffices to have the started subprocess
> > be >
> > > > > "wordpad.exe". Of course my real process is more interesting than >
> > that
> > > > > :-). > > You can find the servlet code for reproducing the test
> > here: > >
> > > > > https://www.refheap.com/paste/3254 > > > To reproduce the problem
> > > > > deterministically, the ConnectionTimeout for > the APR HTTP
> > Connector in
> > > > > servlet.xml must be set sufficiently low. > With my boxes, I get a
> > 100%
> > > > > error hit when set at 200 ms. > > You can find here the jmeter
> > script which
> > > > > hits the same page again and > again with "keep-alive" option set
> > on: > >
> > > > > https://www.refheap.com/paste/3255 > > > So far, the only reliable
> > > > > solution we have found to work around this > problem is to not use
> > the
> > > > > HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US
> > std R2
> > > > > 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > > Same
> > issue
> > > > > has been observed on Windows 7 32 bits. > > Was not able to
> > reproduce the
> > > > > issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for your
> > > > > support, ideas, solutions, etc. > > > >
> > > > >
> > --------------------------------------------------------------------- > To
> > > > > unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For
> > additional
> > > > > commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY
> > "Legacy
> > > > > code" often differs from its suggested alternative by actually
> > working and
> > > > > scaling. - Bjarne Stroustrup http://www.jeffmaury.com
> > > > > http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
> > > >
> > > >
> > > >
> > > >
> > >
> >
> > --
> > Laurent Petit
> >
> > Agence +33 (0)4 78 47 07 49
> >
> > Email     lpetit@yseop.com
> >
> >
> >
> >
> >
> >
> >
> > Yseop apporte une réponse intelligente et individualisée à chacun de vos
> > clients
> >
> >
> >
> > www.yseop.com
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 
> 


-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com



Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Jeff MAURY <je...@jeffmaury.com>.
If you can post a Mavenized example, I could have time to run it and watch
at it.

Regards
Jeff


On Mon, Jun 25, 2012 at 11:40 AM, Laurent Petit <lp...@yseop.com> wrote:

> Hello,
>
> Is there anything I can do to help qualify the problem even more ?
>
> Beyond having shown the source code of the servlet, would a fully
> mavenized example help? Anything else?
>
> Regards,
>
> --
> Laurent
>
>
> On Fri, 2012-06-22 at 10:21 +0200, Laurent Petit wrote:
> > Hello,
> >
> > On Thu, 2012-06-21 at 22:53 +0200, Jeff MAURY wrote:
> > > Is it specific to Wordpad or any launched process will do the trick ?
> > > Do you tried with a non UI process (console) ?
> >
> >
> > I did an additional test, as you suggested, with a non UI process (a
> > small java executable launched in headless mode, whose purpose was just
> > to wait for 20 seconds before exiting).
> >
> > I can reproduce the problem with this headless executable: the HTTP
> > client is blocked until the 20 seconds elapse and the process is killed.
> >
> >
> > Here is the modified servlet code I used:
> >
> > https://www.refheap.com/paste/3285
> >
> >
> > and here is the code for the small java program:
> >
> > https://www.refheap.com/paste/3286
> >
> >
> >
> > Regards,
> >
> > --
> > Laurent
> >
> >
> >
> > >
> > > Jeff
> > >
> > > On Thu, Jun 21, 2012 at 10:45 PM, Laurent Petit <lp...@yseop.com>
> wrote:
> > >
> > > > En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21
> juin
> > > > 2012 00:07 Can you verify your 2 threads (reading input an error) are
> > > > launched ? Yes they are. Verified. Can you confirm you are getting
> the
> > > > problem only on Windows ? Yes sir, we're unable to reproduce it on
> Ubuntu.
> > > > Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <
> lpetit@yseop.com>
> > > > wrote: > Hello, > > I have a problem with keep-alive connections,
> when
> > > > starting a subprocess > (via JDK's default ProcessBuilder/Process
> API),
> > > > while also having > started Tomcat with the APR HTTP/1.1 Connector.
> > > The
> > > > problem symptom is with Keep-Alive connection, as follows: > > - the
> client
> > > > (browser, jmeter, etc.) sends a first request > - the servlet starts
> a
> > > > Process for e.g. wordpad.exe > - the servlet returns an
> acknowledgment html
> > > > content, sets the content > length, flushes the writer, and returns
> > - the
> > > > client displays the received acknowledgement html content, sends >
> the
> > > > second request to the server. > - the server doesn't answer. No
> Tomcat log
> > > > ever reports the start of > something received. > - Then when on the
> server
> > > > you close the wordpad.exe instance, the server > finally handles the
> second
> > > > request. > > I have created a small servlet code which reproduces the
> > > > problem. > For the demo, it suffices to have the started subprocess
> be >
> > > > "wordpad.exe". Of course my real process is more interesting than >
> that
> > > > :-). > > You can find the servlet code for reproducing the test
> here: > >
> > > > https://www.refheap.com/paste/3254 > > > To reproduce the problem
> > > > deterministically, the ConnectionTimeout for > the APR HTTP
> Connector in
> > > > servlet.xml must be set sufficiently low. > With my boxes, I get a
> 100%
> > > > error hit when set at 200 ms. > > You can find here the jmeter
> script which
> > > > hits the same page again and > again with "keep-alive" option set
> on: > >
> > > > https://www.refheap.com/paste/3255 > > > So far, the only reliable
> > > > solution we have found to work around this > problem is to not use
> the
> > > > HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US
> std R2
> > > > 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > > Same
> issue
> > > > has been observed on Windows 7 32 bits. > > Was not able to
> reproduce the
> > > > issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for your
> > > > support, ideas, solutions, etc. > > > >
> > > >
> --------------------------------------------------------------------- > To
> > > > unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For
> additional
> > > > commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY
> "Legacy
> > > > code" often differs from its suggested alternative by actually
> working and
> > > > scaling. - Bjarne Stroustrup http://www.jeffmaury.com
> > > > http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
> > >
> > >
> > >
> > >
> >
>
> --
> Laurent Petit
>
> Agence +33 (0)4 78 47 07 49
>
> Email     lpetit@yseop.com
>
>
>
>
>
>
>
> Yseop apporte une réponse intelligente et individualisée à chacun de vos
> clients
>
>
>
> www.yseop.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
Hello, 

Is there anything I can do to help qualify the problem even more ?

Beyond having shown the source code of the servlet, would a fully
mavenized example help? Anything else?

Regards,

-- 
Laurent


On Fri, 2012-06-22 at 10:21 +0200, Laurent Petit wrote:
> Hello,
> 
> On Thu, 2012-06-21 at 22:53 +0200, Jeff MAURY wrote:
> > Is it specific to Wordpad or any launched process will do the trick ?
> > Do you tried with a non UI process (console) ?
> 
> 
> I did an additional test, as you suggested, with a non UI process (a
> small java executable launched in headless mode, whose purpose was just
> to wait for 20 seconds before exiting).
> 
> I can reproduce the problem with this headless executable: the HTTP
> client is blocked until the 20 seconds elapse and the process is killed.
> 
> 
> Here is the modified servlet code I used:
> 
> https://www.refheap.com/paste/3285
> 
> 
> and here is the code for the small java program:
> 
> https://www.refheap.com/paste/3286
> 
> 
> 
> Regards,
> 
> -- 
> Laurent
> 
> 
> 
> > 
> > Jeff
> > 
> > On Thu, Jun 21, 2012 at 10:45 PM, Laurent Petit <lp...@yseop.com> wrote:
> > 
> > > En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21 juin
> > > 2012 00:07 Can you verify your 2 threads (reading input an error) are
> > > launched ? Yes they are. Verified. Can you confirm you are getting the
> > > problem only on Windows ? Yes sir, we're unable to reproduce it on Ubuntu.
> > > Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <lp...@yseop.com>
> > > wrote: > Hello, > > I have a problem with keep-alive connections, when
> > > starting a subprocess > (via JDK's default ProcessBuilder/Process API),
> > > while also having > started Tomcat with the APR HTTP/1.1 Connector. > > The
> > > problem symptom is with Keep-Alive connection, as follows: > > - the client
> > > (browser, jmeter, etc.) sends a first request > - the servlet starts a
> > > Process for e.g. wordpad.exe > - the servlet returns an acknowledgment html
> > > content, sets the content > length, flushes the writer, and returns > - the
> > > client displays the received acknowledgement html content, sends > the
> > > second request to the server. > - the server doesn't answer. No Tomcat log
> > > ever reports the start of > something received. > - Then when on the server
> > > you close the wordpad.exe instance, the server > finally handles the second
> > > request. > > I have created a small servlet code which reproduces the
> > > problem. > For the demo, it suffices to have the started subprocess be >
> > > "wordpad.exe". Of course my real process is more interesting than > that
> > > :-). > > You can find the servlet code for reproducing the test here: > >
> > > https://www.refheap.com/paste/3254 > > > To reproduce the problem
> > > deterministically, the ConnectionTimeout for > the APR HTTP Connector in
> > > servlet.xml must be set sufficiently low. > With my boxes, I get a 100%
> > > error hit when set at 200 ms. > > You can find here the jmeter script which
> > > hits the same page again and > again with "keep-alive" option set on: > >
> > > https://www.refheap.com/paste/3255 > > > So far, the only reliable
> > > solution we have found to work around this > problem is to not use the
> > > HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US std R2
> > > 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > > Same issue
> > > has been observed on Windows 7 32 bits. > > Was not able to reproduce the
> > > issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for your
> > > support, ideas, solutions, etc. > > > >
> > > --------------------------------------------------------------------- > To
> > > unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional
> > > commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY "Legacy
> > > code" often differs from its suggested alternative by actually working and
> > > scaling. - Bjarne Stroustrup http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
> > 
> > 
> > 
> > 
> 

-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Laurent Petit <lp...@yseop.com>.
Hello,

On Thu, 2012-06-21 at 22:53 +0200, Jeff MAURY wrote:
> Is it specific to Wordpad or any launched process will do the trick ?
> Do you tried with a non UI process (console) ?


I did an additional test, as you suggested, with a non UI process (a
small java executable launched in headless mode, whose purpose was just
to wait for 20 seconds before exiting).

I can reproduce the problem with this headless executable: the HTTP
client is blocked until the 20 seconds elapse and the process is killed.


Here is the modified servlet code I used:

https://www.refheap.com/paste/3285


and here is the code for the small java program:

https://www.refheap.com/paste/3286



Regards,

-- 
Laurent



> 
> Jeff
> 
> On Thu, Jun 21, 2012 at 10:45 PM, Laurent Petit <lp...@yseop.com> wrote:
> 
> > En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21 juin
> > 2012 00:07 Can you verify your 2 threads (reading input an error) are
> > launched ? Yes they are. Verified. Can you confirm you are getting the
> > problem only on Windows ? Yes sir, we're unable to reproduce it on Ubuntu.
> > Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <lp...@yseop.com>
> > wrote: > Hello, > > I have a problem with keep-alive connections, when
> > starting a subprocess > (via JDK's default ProcessBuilder/Process API),
> > while also having > started Tomcat with the APR HTTP/1.1 Connector. > > The
> > problem symptom is with Keep-Alive connection, as follows: > > - the client
> > (browser, jmeter, etc.) sends a first request > - the servlet starts a
> > Process for e.g. wordpad.exe > - the servlet returns an acknowledgment html
> > content, sets the content > length, flushes the writer, and returns > - the
> > client displays the received acknowledgement html content, sends > the
> > second request to the server. > - the server doesn't answer. No Tomcat log
> > ever reports the start of > something received. > - Then when on the server
> > you close the wordpad.exe instance, the server > finally handles the second
> > request. > > I have created a small servlet code which reproduces the
> > problem. > For the demo, it suffices to have the started subprocess be >
> > "wordpad.exe". Of course my real process is more interesting than > that
> > :-). > > You can find the servlet code for reproducing the test here: > >
> > https://www.refheap.com/paste/3254 > > > To reproduce the problem
> > deterministically, the ConnectionTimeout for > the APR HTTP Connector in
> > servlet.xml must be set sufficiently low. > With my boxes, I get a 100%
> > error hit when set at 200 ms. > > You can find here the jmeter script which
> > hits the same page again and > again with "keep-alive" option set on: > >
> > https://www.refheap.com/paste/3255 > > > So far, the only reliable
> > solution we have found to work around this > problem is to not use the
> > HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US std R2
> > 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > > Same issue
> > has been observed on Windows 7 32 bits. > > Was not able to reproduce the
> > issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for your
> > support, ideas, solutions, etc. > > > >
> > --------------------------------------------------------------------- > To
> > unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional
> > commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY "Legacy
> > code" often differs from its suggested alternative by actually working and
> > scaling. - Bjarne Stroustrup http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury
> 
> 
> 
> 

-- 
Laurent Petit

Agence +33 (0)4 78 47 07 49

Email     lpetit@yseop.com

 



 

Yseop apporte une réponse intelligente et individualisée à chacun de vos
clients

 

www.yseop.com




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets

Posted by Jeff MAURY <je...@jeffmaury.com>.
Is it specific to Wordpad or any launched process will do the trick ?
Do you tried with a non UI process (console) ?

Jeff

On Thu, Jun 21, 2012 at 10:45 PM, Laurent Petit <lp...@yseop.com> wrote:

> En Réponse à "Tomcat Users List" <us...@tomcat.apache.org> le 21 juin
> 2012 00:07 Can you verify your 2 threads (reading input an error) are
> launched ? Yes they are. Verified. Can you confirm you are getting the
> problem only on Windows ? Yes sir, we're unable to reproduce it on Ubuntu.
> Jeff On Wed, Jun 20, 2012 at 4:19 PM, Laurent Petit <lp...@yseop.com>
> wrote: > Hello, > > I have a problem with keep-alive connections, when
> starting a subprocess > (via JDK's default ProcessBuilder/Process API),
> while also having > started Tomcat with the APR HTTP/1.1 Connector. > > The
> problem symptom is with Keep-Alive connection, as follows: > > - the client
> (browser, jmeter, etc.) sends a first request > - the servlet starts a
> Process for e.g. wordpad.exe > - the servlet returns an acknowledgment html
> content, sets the content > length, flushes the writer, and returns > - the
> client displays the received acknowledgement html content, sends > the
> second request to the server. > - the server doesn't answer. No Tomcat log
> ever reports the start of > something received. > - Then when on the server
> you close the wordpad.exe instance, the server > finally handles the second
> request. > > I have created a small servlet code which reproduces the
> problem. > For the demo, it suffices to have the started subprocess be >
> "wordpad.exe". Of course my real process is more interesting than > that
> :-). > > You can find the servlet code for reproducing the test here: > >
> https://www.refheap.com/paste/3254 > > > To reproduce the problem
> deterministically, the ConnectionTimeout for > the APR HTTP Connector in
> servlet.xml must be set sufficiently low. > With my boxes, I get a 100%
> error hit when set at 200 ms. > > You can find here the jmeter script which
> hits the same page again and > again with "keep-alive" option set on: > >
> https://www.refheap.com/paste/3255 > > > So far, the only reliable
> solution we have found to work around this > problem is to not use the
> HTP/1.1 APR Connector. > > > My configuration : > Windows 2008 US std R2
> 64bits > Tomcat 6.0.32 64 bits > Java 6u30 64 bits(Oracle) > > Same issue
> has been observed on Windows 7 32 bits. > > Was not able to reproduce the
> issue on Linux Ubuntu Desktop 11.10 or > 12.04. > > > Thanks for your
> support, ideas, solutions, etc. > > > >
> --------------------------------------------------------------------- > To
> unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional
> commands, e-mail: users-help@tomcat.apache.org > > -- Jeff MAURY "Legacy
> code" often differs from its suggested alternative by actually working and
> scaling. - Bjarne Stroustrup http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com http://www.twitter.com/jeffmaury




-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury