Re: encodeURL, jsessionid and mod_rewrite ?
Thanks for the replies. The jsessionid/cookie tracking mode is not really part of the problem, sorry about that. Obviously I'm thinking about renaming the war but the rewriting is really used, for example seo friendly urls like /bar/steps/1 internally rewrite to /foo/somesubmodule/steps.jsp?step=1 and the system really can't expose /somesubmodule/steps.jsp?step=1 as public urls, it messes with google analytics stats or bookmarked urls. As last resort I could move the apache RewriteRules to tuckey urlrewriter under the war itself and just keep the ProxyPasses under apache. Configuration & docs would be in a sole space. I know that just because I /can/ do nasty rewriting stuff at the response wrapper level I may not want to do it. The replies were useful ;) regards On Wed, Oct 4, 2017 at 9:58 AM, André Warnier (tomcat) <a...@ice-sa.com> wrote: > On 04.10.2017 07:40, Peter Kreuser wrote: > >> >> Peter Kreuser >> >> Am 04.10.2017 um 02:44 schrieb Christopher Schultz < >>> ch...@christopherschultz.net>: >>> >>> -BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA256 >>> >>> Laurant, >>> >>> On 10/3/17 5:17 PM, Laurent Perez wrote: >>>> I'm using apache+mod_proxy+mod_rewrite as a tomcat frontend. A >>>> "foo" war is deployed at /foo context path under tomcat. The /foo >>>> path is not public, apache has a rewrite rule defined as : /bar/* >>>> rewrites internally to /foo/*. >>>> >>>> I'm using jstl and its for every url in my >>>> jsps to gain the ;jsessionid from encodeURL whenever jsessionid >>>> cookie is not yet set (1st requests) >>>> >>>> >> adding to Christopher, accepting the jsessionid from the Url is a bad >> security risk (Session fixation). So you should disable that by accepting >> the session only via COOKIE via >> >> COOKIE >> then at least this rewriting problem is gone. >> >> Peter >> >> > Well, a cookie can also be path-specific. Which is only *one* of these > issues which we are talking about, when we say "don't". > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- http://laurentperez.fr J2EE, HTML5, JS, CSS3
encodeURL, jsessionid and mod_rewrite ?
Hi I'm using apache+mod_proxy+mod_rewrite as a tomcat frontend. A "foo" war is deployed at /foo context path under tomcat. The /foo path is not public, apache has a rewrite rule defined as : /bar/* rewrites internally to /foo/*. I'm using jstl and its for every url in my jsps to gain the ;jsessionid from encodeURL whenever jsessionid cookie is not yet set (1st requests) Now my question is : the results in a "/foo/page.jsp;jsessionid=..." I want the result instead as /bar/pages.jsp;jsessionid= Should I go straight for a HttpServletResponseWrapper replacing every /foo/ with /bar/ or is there a more elegant way ? If the apache rewrite rule is modified - say, to /barv2/, is it ok to use mod_headers to pass the original path instead of hardcoding /bar/ ? thanks -- http://laurentperez.fr J2EE, HTML5, JS, CSS3
Getting a WAR last deployment timestamp thru JMX ?
Hi I'm exposing some webapp metrics over a JSON servlet. I'd like to output the deployment timestamp of my webapp, when war is redeployed by tomcat using the built-in /manager/. I looked into the manager and could not find a timestamp. Is there some magic JMX query available to obtain the last deployment time of a war ? Thanks laurent -- http://laurentperez.fr J2EE, HTML5, JS, CSS3
Re: Setting up HTTP/2 with no SSL connector ?
Yes I was under the false impression that Chrome did support h2c ; it does not, as you pointed. HTTP/2 works fine now. Thanks On Thu, Mar 30, 2017 at 10:46 PM, Mark Thomas <ma...@apache.org> wrote: > On 30 March 2017 20:53:06 BST, Laurent Perez <l.lauren...@gmail.com> > wrote: > >Thank you Mark. > > > >h2c is enabled : 30-Mar-2017 21:30:33.373 INFOS [main] > >org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol > >The ["http-nio-8080"] connector has been configured to support HTTP > >upgrade > >to [h2c] > > > >However org.apache.catalina.connector.Request#newPushBuilder returns > >null. > >Processor is a Http11Processor and it does not override the return > >false > >of org.apache.coyote.AbstractProcessor#isPushSupported. It's as if the > >upgrade did not plug in. > > > >Using the apr+ssl connector, same client works fine (i.e pushBuilder is > >not > >null). > > > >Client is Chrome 56. Where could I check in tomcat source to see if the > >client is sending the h2c upgrade token ? > > I'm fairly sure most browsers including chrome do not support h2c. > > Chrome developer tools should show you the network traffic. > > Mark > > > > > >laurent > > > > > > > >On Thu, Mar 30, 2017 at 9:07 PM, Mark Thomas <ma...@apache.org> wrote: > >> > >> On 30/03/17 18:02, Laurent Perez wrote: > >> > Hi > >> > > >> > I managed to run the servlets/serverpush/simpleimage HTTP/2 push > >example > >> > from Tomcat 9 trunk with the SSL Http11AprProtocol connnector and > >> > >> > className="org.apache.coyote.http2.Http2Protocol"/>. > >> > > >> > Now I would like to enable HTTP/2 but without SSL : my certificates > >are > >> > either hosted under my load balancer or Apache itself, and I do not > >require > >> > SSL between mod_proxy and Tomcat. > >> > > >> > But org.apache.coyote.AbstractProcessor#isPushSupported then > >returns > >false, > >> > as if the UpgradeProtocol did not fire. > >> > > >> > Is it possible to enable HTTP/2 with no SSL connector ? > >> > >> Yes. You need to add the block to an HTTP > >> connector. You should see in the start-up log that h2c is enabled via > >> HTTP Upgrade. > >> > >> Mark > >> > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > >> For additional commands, e-mail: users-h...@tomcat.apache.org > >> > > > > > > > >-- > >http://cv.laurentperez.fr > >J2EE, HTML5, JS, CSS3 > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- http://cv.laurentperez.fr J2EE, HTML5, JS, CSS3
Re: Setting up HTTP/2 with no SSL connector ?
Thank you Mark. h2c is enabled : 30-Mar-2017 21:30:33.373 INFOS [main] org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol The ["http-nio-8080"] connector has been configured to support HTTP upgrade to [h2c] However org.apache.catalina.connector.Request#newPushBuilder returns null. Processor is a Http11Processor and it does not override the return false of org.apache.coyote.AbstractProcessor#isPushSupported. It's as if the upgrade did not plug in. Using the apr+ssl connector, same client works fine (i.e pushBuilder is not null). Client is Chrome 56. Where could I check in tomcat source to see if the client is sending the h2c upgrade token ? laurent On Thu, Mar 30, 2017 at 9:07 PM, Mark Thomas <ma...@apache.org> wrote: > > On 30/03/17 18:02, Laurent Perez wrote: > > Hi > > > > I managed to run the servlets/serverpush/simpleimage HTTP/2 push example > > from Tomcat 9 trunk with the SSL Http11AprProtocol connnector and > > > className="org.apache.coyote.http2.Http2Protocol"/>. > > > > Now I would like to enable HTTP/2 but without SSL : my certificates are > > either hosted under my load balancer or Apache itself, and I do not require > > SSL between mod_proxy and Tomcat. > > > > But org.apache.coyote.AbstractProcessor#isPushSupported then returns false, > > as if the UpgradeProtocol did not fire. > > > > Is it possible to enable HTTP/2 with no SSL connector ? > > Yes. You need to add the block to an HTTP > connector. You should see in the start-up log that h2c is enabled via > HTTP Upgrade. > > Mark > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > -- http://cv.laurentperez.fr J2EE, HTML5, JS, CSS3
Setting up HTTP/2 with no SSL connector ?
Hi I managed to run the servlets/serverpush/simpleimage HTTP/2 push example from Tomcat 9 trunk with the SSL Http11AprProtocol connnector and . Now I would like to enable HTTP/2 but without SSL : my certificates are either hosted under my load balancer or Apache itself, and I do not require SSL between mod_proxy and Tomcat. But org.apache.coyote.AbstractProcessor#isPushSupported then returns false, as if the UpgradeProtocol did not fire. Is it possible to enable HTTP/2 with no SSL connector ? Thanks laurent -- http://cv.laurentperez.fr J2EE, HTML5, JS, CSS3
RE: Best practice to programmatically get the disableURLRewriting context attribute value
Thanks for your answer. 1. Before testing the code below with different Tomcat configurations, I would like to know if there is a better way to do what I want. I'm not really satisfied with this code that is closely related to Tomcat classes. 2. The original problem is that I would like to: a) prevent Tomcat (6.0.x, including versions older than 6.0.30) from adding the ;jsessionid=xxx string to the URL when there is no cookie named JSESSIONID in the client browser b) prevent jsessionid hijacking via the url, i.e redirect to an error page when the jsessionid= string is detected in the URL Lo -Message d'origine- De : Mark Thomas [mailto:ma...@apache.org] Envoyé : jeudi 17 avril 2014 11:54 À : Tomcat Users List Objet : Re: Best practice to programmatically get the disableURLRewriting context attribute value On 10/04/2014 14:01, lo lo wrote: Tomcat version 6.0.x on Linux OS Hi all, I have an application deployed on several customers Tomcat servers. The Tomcat versions are different (6.0.16, 6.0.37, etc.) and asking all customers to upgrade to the latest Tomcat version would be too tricky. I would like to programmatically get the disableURLRewriting context attribute value, when it exists (i.e Tomcat 6.0.30 onwards). My purpose is to add a tuckey.org/urlrewrite filter rule that redirects the user to an error page when the 'jsessionid=' string is detected in the URL. if (disableURLRewriting exists and its value is true) - the filter rule should be applied if (disableURLRewriting doesn't exist or its value is false) - the filter rule should not be applied because Tomcat 6 adds ';jsessionid=xxx' when there is no cookie in the client browser The only way that I have found to achieve this on different Tomcat versions is to use Tomcat classes: public boolean isDisableURLRewriting(StandardContext standardContext) { Method isDisableURLRewritingMethod = null; try { isDisableURLRewritingMethod = StandardContext.class.getMethod(isDisableURLRewriting); } catch (Exception e) { // the method does not exist or is not accesible } if (isDisableURLRewritingMethod != null) { try { return ((Boolean) isDisableURLRewritingMethod.invoke(standardContext)).booleanValue(); } catch (Exception e) { throw new RuntimeException(Unable to invoke the isDisableURLRewriting method on the standard context); } } // the method does not exist, we return false return false; } StandardEngine engine = (StandardEngine) ServerFactory.getServer().findService(Catalina).getContainer(); Container container = engine.findChild(engine.getDefaultHost()); StandardContext standardContext = (StandardContext) container.findChild(context.getContextPath()); if (isDisableURLRewriting(standardContext)) { // apply the rule } else { // don't apply the rule } 1. Will this code work for every Tomcat configuration? (I know that this code works when the context file is in the conf/Catalina/localhost directory with the default server.xml file, but I don't know if it will work when several hosts are defined in the server.xml file, because I'm using engine.getDefaultHost()) So maybe you should test that and see what happens. 2. Is there a better way to achieve this? (maybe without using Tomcat classes?) It depends on what you are trying to achieve. You have described a problem with your current solution but not what your original problem is. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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 lpe...@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
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
Hello Jeff, Konstantin all, On Mon, 2012-06-25 at 20:52 +0200, verlag.preis...@t-online.de wrote: Hello Jeff all, Von: Jeff MAURY jeffma...@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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Laurent Petit Agence +33 (0)4 78 47 07 49 Email lpe...@yseop.com Yseop apporte une réponse intelligente et individualisée à chacun de vos clients www.yseop.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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 lpe...@yseop.com wrote: Hello Jeff, Konstantin all, On Mon, 2012-06-25 at 20:52 +0200, verlag.preis...@t-online.de wrote: Hello Jeff all, Von: Jeff MAURY jeffma...@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
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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 lpe...@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 lpe...@yseop.com
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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 lpe...@yseop.com wrote: En Réponse à Tomcat Users List users@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 lpe...@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/3254To 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/3255So 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@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 lpe...@yseop.com Yseop apporte une réponse intelligente et individualisée à chacun de vos clients www.yseop.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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 lpe...@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 lpe...@yseop.com wrote: En Réponse à Tomcat Users List users@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 lpe...@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/3254To 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/3255So 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@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 lpe...@yseop.com Yseop apporte une réponse intelligente et individualisée à chacun de vos clients www.yseop.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Laurent Petit Agence +33 (0)4 78 47 07 49 Email lpe...@yseop.com Yseop apporte une réponse intelligente et individualisée à chacun de vos clients
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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 lpe...@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 lpe...@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 lpe...@yseop.com wrote: En Réponse à Tomcat Users List users@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 lpe...@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/3254To 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/3255So 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Jeff MAURY Legacy code often differs from its suggested
Re: Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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 lpe...@yseop.com wrote: En Réponse à Tomcat Users List users@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 lpe...@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/3254To 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/3255So 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@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 lpe...@yseop.com Yseop apporte une réponse intelligente et individualisée à chacun de vos clients www.yseop.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re : Re: Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
En Réponse à Tomcat Users List users@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 lpe...@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/3254To 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/3255So 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@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
Issue with keep-alive connections, when using APR Connector on Windows and starting Processes from Servlets
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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 7 - New attribut aliases in the context configuration item
Here is the preview of the documentation : http://ci.apache.org/projects/tomcat/tomcat7/docs/config/context.html#Virtual_webapp (this is a nightly snapshot of the tomcat 7 branch) On 6 déc. 2011, at 17:31, Sylvain Goulmy wrote: Hi Sylvain, I have taken the sources from the trunk version and i compiled T7. Can you please give me an example of the declaration of the ressource i should do in my context in order to have the benefit of this functionnality ? I don't understand the loader part of your comment in the bugzilla ticket. What is the order of the research of the ressources when you have additional directories defined for your application ? I'm gonna have a look at your code but i'm not a java expert so i prefer asking in order to avoid any confusion. Thank you for your support. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 7 - New attribut aliases in the context configuration item
On 6 déc. 2011, at 18:07, Sylvain Goulmy wrote: Hi Sylvain, I have tested your functionnality thanks to the description you give in your code. This is just EXACTLY what i wanted. I can define an external directory, the ressources are searched in my application and then in the directory defined in the configuration, and icing on the cake you can define the '/' context for your new directory. This is just perfect ! I see in your comment that this functionnality is not meant to be used in production, why ? This is rather a disclaimer ;-) I really did not test for potential security threats when using this feature, I don't know what happens if the URL contains sequences like ../../... Nor did I do performance tests. The primary goal was to fix the serve modules without publishing feature of eclipse which used to work with tc6 but was broken with tc7. Could this functionnality be backported to Tomcat 6 or a patch could be provided ? Probably, but since the Serve modules without publishing feature of eclipse works as is, there was no point in touching this... If there's really some demand, I could have a look at it. Thank you very much for pointing this bugzilla ticket ;-) you're welcome. Sylvain - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 7 - New attribut aliases in the context configuration item
It's not for eclipse only. The ticket talks about eclipse because that was the main motivation for the feature, but it's totally independent. On 5 déc. 2011, at 15:15, Sylvain Goulmy wrote: Well, what is described in this ticket seems to concern Tomcat in the Eclipse environment, i'd like to have the functionnality on the live environment, i'll keep on watching your patch to see if that can give me the functionnality i'm looking for. Thank you for this information. On Fri, Dec 2, 2011 at 8:11 PM, Sylvain Laurent slaur...@apache.org wrote: keep a watch on https://issues.apache.org/bugzilla/show_bug.cgi?id=51741. When it is implemented, it should give you this functionality. On 30 nov. 2011, at 14:58, Sylvain Goulmy wrote: So the effect is that multiple physical directories must be searched for a given resource? Correct. The alias maps a given path to an external directory. Ok, that's what i had understood. Can you give an example of how you would like it to work? Here is the description of the EDR (Extended Document Root) mecanism in Websphere : Let's assume i have the following application : - Webapps/ - MyApplication/ - images/ - css/ - META-INF/ - WEB-INF/ - index.html I can define an EDR directory in the configuration of my application so that the ressource i access are first retrieved from my application and then in the EDR directory if they don't exist in my application. - /.../.../.../.../EDR/ - images/ - index.html These directories are defined as extension of my application and another important thing is that i can also extend files which are at the root of my application (as index.html). After a few more test with Tomcat i understand that : - You cannot extend directory, if you define an external location which math an existing directory of your application, the ressources of your application become unreachable. - As the documentation say Using '/' as an aliasPath is not allowed., you cannot extend any ressource which is at the root of your application. Things seems clear for me now, please tell if i have missed something. Thank you in advance for your support. On Wed, Nov 30, 2011 at 11:53 AM, Pid p...@pidster.com wrote: On 29/11/2011 17:47, Sylvain Goulmy wrote: Hi all, I'd like to know it is possible to have equivalent functionality to the extended document root provided by the WebSphere product. This feature allows you to define a location outside the webapp to make contribution without having to redeploy the application. This mechanism first checks if the resource is present in the application and if not will look for it in the directory extension. So the effect is that multiple physical directories must be searched for a given resource? I thought that the functionality provided by the new attribute aliases for the configuration item context would have a similar behavior, but I see another operation. First of all it is not possible to set an alias on the context '/', making it necessary to declare all the directories in which you want to make the contribution. Also when I set an alias for a directory present in my webapp, it becomes a priority and files in my webapp are no longer available. Do I understand correctly how this new attribute aliases has to be used ? The alias maps a given path to an external directory. Is it possible with Tomcat 7 to set up a mechanism similar to the extended document root of Websphere? Can you give an example of how you would like it to work? p -- [key:62590808] - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 7 - New attribut aliases in the context configuration item
keep a watch on https://issues.apache.org/bugzilla/show_bug.cgi?id=51741 . When it is implemented, it should give you this functionality. On 30 nov. 2011, at 14:58, Sylvain Goulmy wrote: So the effect is that multiple physical directories must be searched for a given resource? Correct. The alias maps a given path to an external directory. Ok, that's what i had understood. Can you give an example of how you would like it to work? Here is the description of the EDR (Extended Document Root) mecanism in Websphere : Let's assume i have the following application : - Webapps/ - MyApplication/ - images/ - css/ - META-INF/ - WEB-INF/ - index.html I can define an EDR directory in the configuration of my application so that the ressource i access are first retrieved from my application and then in the EDR directory if they don't exist in my application. - /.../.../.../.../EDR/ - images/ - index.html These directories are defined as extension of my application and another important thing is that i can also extend files which are at the root of my application (as index.html). After a few more test with Tomcat i understand that : - You cannot extend directory, if you define an external location which math an existing directory of your application, the ressources of your application become unreachable. - As the documentation say Using '/' as an aliasPath is not allowed., you cannot extend any ressource which is at the root of your application. Things seems clear for me now, please tell if i have missed something. Thank you in advance for your support. On Wed, Nov 30, 2011 at 11:53 AM, Pid p...@pidster.com wrote: On 29/11/2011 17:47, Sylvain Goulmy wrote: Hi all, I'd like to know it is possible to have equivalent functionality to the extended document root provided by the WebSphere product. This feature allows you to define a location outside the webapp to make contribution without having to redeploy the application. This mechanism first checks if the resource is present in the application and if not will look for it in the directory extension. So the effect is that multiple physical directories must be searched for a given resource? I thought that the functionality provided by the new attribute aliases for the configuration item context would have a similar behavior, but I see another operation. First of all it is not possible to set an alias on the context '/', making it necessary to declare all the directories in which you want to make the contribution. Also when I set an alias for a directory present in my webapp, it becomes a priority and files in my webapp are no longer available. Do I understand correctly how this new attribute aliases has to be used ? The alias maps a given path to an external directory. Is it possible with Tomcat 7 to set up a mechanism similar to the extended document root of Websphere? Can you give an example of how you would like it to work? p -- [key:62590808] - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Babysitting ThreadLocals
On 25 nov. 2011, at 15:58, Christopher Schultz wrote: On 11/24/11 4:02 PM, Sylvain Laurent wrote: I don't think this ThreadLocal creates a real leak of classloader. It would if dayFormat was static. IIRC, ThreadLocal essentially puts a key/value pair in a Map in the Thread. I dunno what kind of reference it is, but I suspect it's a normal, strong reference. That means that the Thread itself retains a reference to the instance of the inner class in my servlet. That's just not going to become available for collection anytime soon. Actually, in Sun's implementation (1.5 and 1.6 at least), ThreadLocal are implemented with a kind of WeakHashMap in a instance variable of Thread, using your ThreadLocal instance as a weak key and the actual value you stored as value with a strong reference. In your example, the reference to the ThreadLocal instance is stored in an instance variable of your Servlet. So, when your app is stopped, tomcat releases its reference to your Servlet instance so that it can be collected and your ThreadLocal instance too. Since in your case the value that is bound in the ThreadLocal for each thread is a JRE class (SimpleDateFormat), it does not reference the webapp classloader. The latter can then be collected (provided there are no other references pinning it in memory). Note that I was wrong when I wrote that there would be a leak if dayFormat was static : that would only be the case if the value bound in the ThreadLocal was an instance of a class that is loaded by the webapp. It's not the case here (SimpleDateFormat), so that even with a static dayFormat, the classloader would be GCed. Sylvain - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Babysitting ThreadLocals
On 23 nov. 2011, at 16:48, Christopher Schultz wrote: Our servlet defines the ThreadLocal to be protected (because this is a base class for several servlets that all do similar things) and transient (because we just don't need it to be serialized) and override the initialValue method, like this: protected transient ThreadLocalSimpleDateFormat dayFormat = new ThreadLocalSimpleDateFormat() { public SimpleDateFormat initialValue() { return new SimpleDateFormat(-MM-dd); } }; In the servlet's destroy method, we dutifully call dayFormat.remove(). Tomcat complains that we are leaving sloppy ThreadLocals around on shutdown. Duh: Servlet.destroy is called by a single thread and won't actually remove the ThreadLocal in any meaningful way. So, my question is whether or not there is a good way to clean-out the ThreadLocals from our webapp? Given the declaration above, we are creating a new class which will be loaded by our webapp's ClassLoader and therefore pinning that ClassLoader in memory definitely causing a memory leak across reploy cycles. I don't think this ThreadLocal creates a real leak of classloader. It would if dayFormat was static. But you may still see warnings issued by tomcat when the application is stopped because of this problem http://wiki.apache.org/tomcat/MemoryLeakProtection#threadLocalPseudoLeak After some time and if all the threads of the server are sollicited sufficiently, the classloader will be eventually collected. With tomcat 7, there's no leak since threads are renewed, but you might still see the warnings. IMHO, you'd rather either stop worrying and recreate a new SimpleDateFormat, unless actual tests show a real bottleneck. In that case, go with another implementation like FastDateFormat. It will be much cleaner than playing with ThreadLocals... Sylvain - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: ThreadLocal Memory Leak Protection - Executor threadRenewalDelay questions
Hello, On 26 oct. 2011, at 17:55, Rohit Kelapure wrote: * Reposting from the dev list as advised * Dear All, After going through the thread renewal code in /tomcat-8.0.x/java/org/apache/tomcat/util/threads/TaskQueue.java , /tomcat-8.0.x/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java and the bug (Improve ThreadLocal memory leak clean-up) https://issues.apache.org/bugzilla/show_bug.cgi?id=49159 I had the following questions- 1. Once the thread pool has been renewed after No. of active threads in pool * max (threadKeepAliveTimeout, longestRequest+ threadRenewalDelay) seconds, why does the ThreadPoolExecutor still keep paying the price of thread renewal. ? After org.apache.tomcat.util.threads.ThreadPoolExecutor.threadRenewalDelay is set to 1000L it never goes back to -1. Ideally once the all the threads in the threadpool is renewed we should revert the threadRenewalDelay back to -1 and NOT call ThreadPoolExecutor.currentThreadShouldBeStopped()/ThreadPoolExecutor.stopCurrentThreadIfNeeded() in TaskQueue.poll(long, TimeUnit) or TaskQueue.take(). Is this because we are never quite sure as to when *all* of the threads in the pool have been renewed ? Yes. threadRenewalDelay is a configuration parameter of the ThreadPoolExecutor and its value never changes at runtime (unless you play with JMX). The thing is that it may take a long time to renew all the threads of the pool because there might be very long requests. Besides, a second renewal can be triggered (i.e. another webapp being stopped) while some threads have not been renewed yet after the first renewal was asked. By comparing the timestamps of when the thread was created and when the last renewal was triggered, we are sure that all threads are eventually renewed (provided they are returned to the pool). 2. Does the thread renewal approach scale under load (i.e. all threads in the pool busy servicing requests and CPU close to 90%) ? Is it meant for production deployments ? Yes, it was meant for both development and production and is enabled by default. When I was developing it I performed some load tests with JMeter to check that there is no functional impact while threads are being renewed, but I did not measure the performance impact of recreating new threads. Anyway, threadRenewalDelay is here to throttle the rate of renewal, so that not all threads are re-created at the same time, thus the performance impact should be negligible (and configurable). 3. How about threads that are servicing long running HTTP Keep-alive connections that never let the thread return to the pool. Are these threads renewed before the server is stopped. With tomcat 6 (and the BIO connector, I don't know for others), threads were tied to the TCP connection as you describe, so that they were not returned to the pool if the connection was kept alive. But kee-palive is not eternal, the number of requests is limited and there's a timeout if the client does not send a new request for some time. From tomcat 7 (with the BIO connector at least), threads are decoupled from TCP connections, so that even with keep-alive, threads are returned to the pool after servicing each request. So, in this case threads are newed if needed. Sylvain - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to add/remove DataSource dynamically to a running Tomcat/WebApp
I'm building a multi-tenant WebApp. For ease of maintenance and operation, I would like to have a single WebApp (WAR) in a single Tomcat instance (JVM process) handling the requests of all tenants. Tenants (my customers) can be added and removed dynamically in the system (using an Administration WebApp). Data for each tenant are stored in dedicated database SCHEMA (different user/password and even database instances). My question is: how can I add/removed datasource programmatically in a running Tomcat and WebApp? I know out to declare one or multiple static datasource, which typically means adding the following XML nodes in the specified files [WAR_HOME/WEB-INF/web.xml] web-app resource-ref descriptionMy DataSource/description res-ref-namejdbc/myds/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeShareable/res-sharing-scope /resource-ref /web-app [WAR_HOME/META-INF/context.xml] Context path=/dictao-d3s-authority-web ResourceLink name=jdbc/msDS global=jdbc/myDS type=javax.sql.DataSource / /Context [TOMCAT_HOME/server.xml] Server GlobalNamingResources Resource name=jdbc/myDS auth=Container url=… user=… password=… type=javax.sql.DataSource driverClassName=… maxActive=10 maxIdle=5/ /GlobalNamingResources /Server I'm trying to do that programmatically, for each new tenant added to my system, I would like to add the corresponding resource-ref, ResourceLink and Resource dynamically using some code running inside my Administration WebApp. Any thought ?
Re: [OT] Tomcat 7 parallel deployment and PermGen Heap Space
My personal advice with the Oracle driver is to put it at the server level, not at the webapp level. For instance if you use the query timeouts, oracle JDBC spawns a Thread to handle the timeouts, and there is no way to properly stop this thread so tomcat will continue complaining about leaking a classloader... With the driver at the server level, the warnings will disappear and your webapp won't leak (or at least not because of the JDBC driver). Sylvain On 20 juil. 2011, at 22:59, Mark Thomas wrote: On 20/07/2011 21:46, Christopher Schultz wrote: Mark, On 7/20/2011 4:25 AM, Mark Thomas wrote: You need to de-register the driver you registered. However, that won't be causing the leak since Tomcat already did the clean up for you. Time to get the profiler out. Quick question: I get these JDBC Driver messages from Tomcat when I undeploy, but my code does not register the driver itself... The code might not, but registration is triggered by the application including the JAR. Just putting a JAR with a JDBC driver and the appropriate content in META-INF/services is enough to trigger registration with the JVM. Tomcat has nothing to do with this. Tomcat does via a Resource defined in context.xml. Is that driver registered with the WebappClassLoader and therefore considered registered by the webapp? No. It is registered with the DriverManager. It is loaded by the WebappClassLoader which triggers the potential memory leak. I've been irritated by this behavior for a while because I feel like the container is performing the registration of the driver, but expecting the webapp to perform the de-registration. The META-INF/services mechanism does not provide automatic de-registration so the app has to take care of it. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Start connectors after deployment of all webapps have been completed
have a look at the bindOnInit parameter on the connector http://tomcat.apache.org/tomcat-7.0-doc/config/http.html On 15 mai 2011, at 12:31, Afkham Azeez wrote: Hi folks, We are using Embedded Tomcat 7.0.14. We create connectors in the normal way, add the webapps to Tomcat, and then call start on Tomcat. However, we noticed that the connectors get started before the completion of the webapp deployment. Is there a way to delay the starting of the connectors (opening of the sockets) until after the webapps have been deployed? Thanks Azeez -- *Afkham Azeez* *Member; Apache Software Foundation; **http://www.apache.org/*http://www.apache.org/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Suggestions for really getting to the bottom of memory leak issues on hot-deploys
[from your blog entry] I also think that logging leaks may be more helpful than using part of manager, because many don't deploy manager (they remove it). it is logged when the application is stopped, on recent tomcat 6 and 7. I think your approach to finding leaks by performing comparisons is not the most efficient. What I usually do to find the leak is to use MAT (eclipse memory analyzer, as you used too) and its class loader explorer. There I find the instance of org.apache.catalina.loader.WebappClassLoader that corresponds to my webapp and right-click to ask path to GC roots/exclude all phantom/weak/soft, etc. references. There I usually see the cause of the leak vey quickly. I you find no strong reference to your classloaders then you might have encountered some JDK bug... You should use a recent one to avoid some (at least 6.0u21). Sylvain On 10 mai 2011, at 21:55, Gary Weaver wrote: Here's what I did and what little I came up with: http://stufftohelpyouout.blogspot.com/2011/05/diagnosing-webappportlet-hot-deploy.html I'm definitely not an expert at diagnosing leaks, so if you have any recommendations/comments, please let me know. I unfortunately started off just thinking I could tune JVM settings, not just by bumping up permgen but by adding things like: -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled But, I was (really) wrong as you can see in the post, along with the various tools used to try to identify what was causing the issue(s). It doesn't seem like determining exactly what is leaking memory (at least in the case of permgen and hot-redeploys/hot-deploys) is a whole lot easier than it was years ago, unless I'm doing something wrong, which I most likely am. Thanks in advance for any feedback! Gary - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat JMX Monitoring - Busy Threads?
I'm trying to monitor Tomcat 6.0.29 using JMX. Specifically, I want to monitor the number of active threads servicing requests so I can get an alert if it approaches the maximum. While I have JMX monitoring working in general, I can't seem to get the number of threads. Everything I have read suggests looking at: Catalina:type=ThreadPool,name=http-8080 And examining the currentThreadsBusy attribute. Unfortunately, I only ever seem to get -1 as a value. I've tried it on five different Tomcat instances and I always get -1. Is there something I'm missing? Should I be looking at a different value? -Sean - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: IS that a good idea moving all the common libs?
On 22 déc. 2010, at 12:49, Mark Thomas wrote: It is do-able if you are prepared to accept the associated constraints: - all web apps must use the exact same version of every shared library - updating the shared libraries requires a Tomcat restart - all of the shared web apps must be well behaved in a multiple class-loader environment Maybe a bit off topic, but as far as I understood, OSGI based servers (e.g. Virgo) support this type of scenario. With multiple versions of shared libraries and the possibility to deploy newer versions. Of course every piece of code must be well behaved, osgi-compliant, etc... - one out of control web application can take down the whole instance Definitely a weakness of java... PHP and other scripting platforms do not suffer from this since each process is isolated (more or less). Does somebody know how it works on .NET side ? Does it suffer from the same weakness ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: 6.0.26 java.lang.Thread.State: WAITING (on object monitor)
Some short answers : - (for the moment) threads are always reused, even after an application is stopped. - tomcat 6.0.26 tries to clean the threadlocals which may provoke a leak, but 1) it was unsafe and has been disabled by default from 6.0.27 (see https://issues.apache.org/bugzilla/show_bug.cgi?id=48895 ) and 2) some leak through threadlocals might not be detected and thus not cleared, as explained in http://wiki.apache.org/tomcat/MemoryLeakProtection#webappClassInstanceAsThreadLocalIndirectValue - To improve over this situation, threads are now being renewed after an application is stopped. This change is currently only in SVN trunk for tomcat 7. See https://issues.apache.org/bugzilla/show_bug.cgi?id=49159 - please upgrade to 6.0.29 and post the logs again. There has been some improvement in the diagnostics. Sylvain On 11 déc. 2010, at 21:01, Srikanth Konjarla wrote: Pid, Thanks for your patience. Here is the output from catalina.out file while the webapp is being undeployed. As you can see there are few threadLocals that are cleaned up. -- Dec 10, 2010 8:46:56 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.threadlo...@7ee75db3]) and a value of type [org.apache.catalina.loader.WebappClassLoader] (value [WebappClassLoader delegate: false repositories: /WEB-INF/classes/ -- Parent Classloader: org.apache.catalina.loader.standardclassloa...@1eb3319f ]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed. Dec 10, 2010 8:46:56 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.threadlo...@7ee75db3]) and a value of type [org.apache.catalina.loader.WebappClassLoader] (value [WebappClassLoader delegate: false repositories: /WEB-INF/classes/ -- Parent Classloader: org.apache.catalina.loader.standardclassloa...@1eb3319f ]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed. Dec 10, 2010 8:46:56 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SEVERE: A web application created a ThreadLocal with key of type [org.apache.xml.security.utils.UnsyncByteArrayOutputStream$1] (value [org.apache.xml.security.utils.unsyncbytearrayoutputstrea...@775d1479]) and a value of type [byte[]] (value [...@5faeed4]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed. Dec 10, 2010 8:46:56 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap SEVERE: A web application created a ThreadLocal with key of type [org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder] (value [org.apache.axis.utils.xmlutils$threadlocaldocumentbuil...@3a0ee334]) and a value of type [org.apache.xerces.jaxp.DocumentBuilderImpl] (value [org.apache.xerces.jaxp.documentbuilderi...@61583db6]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed. Srikanth - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [Tomcat] Can I see if 'maxThreads' is exceeded?
On 29 nov. 2010, at 15:01, Mark Thomas wrote: On 29/11/2010 13:57, sol myr wrote: Hi, I'm new to Tomcat management, and would appreciate help on the 'maxThreads' property of the Http Connector: 1) Please tell if I understood correctly: Suppose I configure 'maxThreads=100', and 130 users try to simultaneously access my Tomcat - then 100 users will be served immediately, and the other 30 will be put on hold? Is this correct? Yes. 2) Is there a way to monitor how many users are 'put on hold' (e.g. 50 on the above example)? No. It happens too low down the network stack for Tomcat to be able to get this information. Mark, correct me if I'm wrong, but I believe that actually with an Executor, the acceptor thread still accepts requests and enqueues them in a queue which is unbounded by default. You can monitor the size of this queue with JMX (attribute queueSize on the Executor's thread pool). What you refered to is when the acceptor thread does not keepup, the OS enqueues new TCP connections attempts up to a maximum (100 by default for the http basic IO connector). Can I ask tomcat log this information? No. Or is this information exposed on the 'manager'? Or via JConsole? No. No. No. yes (executor queueSize) Sylvain - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: OutOfMemoryError some time on some tomcat!!!!1
Don't bother with jhat, try eclipse Memory Analysis Tool instead. It's much more friendly and efficient to find leaks. On 23 nov. 2010, at 12:18, xu cheng wrote: hi, Chuck.Caldarale I referenced to these two links http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java http://blogs.sun.com/fkieviet/entry/how_to_fix_the_dreaded and do as the blog tolds, but failed to find the reason of the oom of my app... thanks though.. by the way, do you have the the jhat the articals mentioned? I went to the jdk/bin, but the jhat there seems not work as the author mentioned. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Removing the date from the name of the file catalina.{date}.log
Hi all, I'd like to have a catalina.log instead of catalina.{date}.log . I took a look as saw the the implementation of the class org.apache.juli.FileHandler forces to have a date in the filename. (I would then suggest to rename it DateFileHandler or DailyFileHandler). I tried to modify the file $CATALINA_BASE/conf/logging.properties to use the standard java.util.logging.FileHandler but did not succeed : I get a file $HOME/java0.log instead of /tmp/catalina.log . Here is my logging.properties file : handlers = 1catalina.java.util.logging.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler #handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler .handlers = 1catalina.java.util.logging.FileHandler, java.util.logging.ConsoleHandler #.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler # Handler specific properties. # Describes specific configuration info for Handlers. 1catalina.org.apache.juli.FileHandler.level = FINE 1catalina.org.apache.juli.FileHandler.pattern = /tmp/catalina.log 1catalina.org.apache.juli.FileHandler.append = true #1catalina.org.apache.juli.FileHandler.level = FINE #1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs #1catalina.org.apache.juli.FileHandler.prefix = catalina. Does anyone has an idea of what's wrong ? I read the page http://tomcat.apache.org/tomcat-6.0-doc/logging.html but maybe I missed something. Laurent
Re: Removing the date from the name of the file catalina.{date}.log
I am so stupid ! Thanks for pointing me this error, it works as expected now. Laurent 2010/3/17 Konstantin Kolinko knst.koli...@gmail.com 2010/3/17 Laurent Vaills laurent.vai...@gmail.com: (...) 1catalina.org.apache.juli.FileHandler.level = FINE 1catalina.org.apache.juli.FileHandler.pattern = /tmp/catalina.log 1catalina.org.apache.juli.FileHandler.append = true The above three lines have to start with 1catalina.java.util.logging.FileHandler. #1catalina.org.apache.juli.FileHandler.level = FINE #1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs #1catalina.org.apache.juli.FileHandler.prefix = catalina. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
ServletContext.java version in the Tomcat 6.0.16 or 6.0.18 source code
Hello all, I'd like to know why the ServletContext.java file found in the Tomcat 6.0.16 or 6.0.18 source code seems to belong to the Servlet 2.4 specifications whereas Tomcat 6.0.x supports the Servlet 2.5 specifications: In this file, we can read: /** * Returns the major version of the Java Servlet API that this * servlet container supports. All implementations that comply * with Version 2.4 must have this method * return the integer 2. * * @return 2 * */ public int getMajorVersion(); /** * Returns the minor version of the Servlet API that this * servlet container supports. All implementations that comply * with Version 2.4 must have this method * return the integer 4. * * @return 4 * */ public int getMinorVersion(); In the same way, if we click on the 'Servlet API Javadocs' link (The Servlet 2.5 API Javadocs) on the following page: http://tomcat.apache.org/tomcat-6.0-doc/index.html We can read in the ServletContext javadoc: int getMajorVersion() Returns the major version of the Java Servlet API that this servlet container supports. All implementations that comply with Version 2.4 must have this method return the integer 2. Returns: 2 int getMinorVersion() Returns the minor version of the Servlet API that this servlet container supports. All implementations that comply with Version 2.4 must have this method return the integer 4. Returns: 4 Above in the same page, we can find the javadoc of the getContextPath() method which was added in the Servlet 2.5 specifications. I think there is a mistake in both versions (source and javadoc) because when I put the following code in a test JSP running on Tomcat 6.0.16: Servlet Engine: %= session.getServletContext().getMajorVersion() %.%= session.getServletContext().getMinorVersion() %br/ JSP Engine: %= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %br/ Application Server: %= application.getServerInfo()%br/ I get: Servlet Engine: 2.5 JSP Engine: 2.1 Application Server: Apache Tomcat/6.0.16 Thank you in advance for your answers. Laurent - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
shared libs, but non shared static object instances between multiple webapps?
Hi Is it possible to have shared libs between multiple web applications (context's) in tomcat (6.0.x), where the static instances (like singletons) are not shared? I used following feature in catalina.properties, which successfully loads the libs from the same path for each webapp: shared.loader=$INSTALL_PATH/core/conf,$INSTALL_PATH/core/*.jar,$INSTALL_PATH/core/lib/*.jar But unfortunately (for us), all the singleton objects (based on static var) are now shared too, which seems logical as the classloader probably loads only one instance of the jars/classes for the whole tomcat container. The motivation for doing this is that we have many projects on one server which run under the same tomcat, and which should run the same software/jar release (defined in shared.loader), only different configuration files. This would allow to update the software for all projects by updating the libs in our core systems, which is only installed once per server. Before we had to update each project's WEB-INF/lib separately, and over 100MB of libs were duplicated per project. Any hope achieving this easily (like configure separate classloaders?), without having to remove all singletons ? Besides, having an empty 'WEB-INF/lib' brought some other strange changes: Following code did not find property files in the Classpath (WEB-INF/classes), whereas before (with all our libs in WEB-INF/lib) it worked : InputStream propertyResource = getClass().getResourceAsStream(filename); Seems the tomcat (java?) classloader is reacting specially in that case, like shortcutting it's ressource search?! Thanks, Laurent JVM : 1.6.0 update2 OS : Windows Server 2003 Tomcat : 6.0.13
Instantiating jsp custom tags outside the tag scope itself ?
Hi I'm trying to understand if I'm doing something inherently wrong in my current code, which is working, but which may give me troubles later on : I have a custom jsp tag, and instead of writing its rendering logic inside its doStartTag/doEndTag methods (I'm using JSP 1.2, not 2.x), I let its doStartTag/doEndTag methods delegate to another class, a dedicated renderer (I'm passing it the PageContext object, too). This renderer then instantiantes new tags, like Tag tag = new Tag(); tag.setPageContext(ctx); (...) tag.doStartTag; tag.doEndTag() (...), basically I have a chain of renderers. It works, but is there something very, very wrong with this approach ? My tag usage within my renderer class follows the Tag lifecycle, i.e I always call tag.recycle(); at the end. Thanks for any input ! laurent -- a href=http://in-pocket.blogspot.com;http://in-pocket.blogspot.com - Mobile world, technology and more/a - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat5.5.17 not releasing custom JSP tags ?
Hi A webapp I'm working on uses custom JSP tags (1.2) under tomcat 5.5.17. I ran into the following problem : custom b tag is supposed to have custom a tags as children : ba/a//b b has a addChild(Tag tag) method, doing children.add(tag); b doStartTag() inits its children container : children = new ArrayList(); a doStartTag() gives itself to his b parent : ((b)getParent()).addChild(this) both b and a extend BodyTagSupport Now, the problem is that the this in addChild(this) always references the same a handler, when I toString() it, it always shows [EMAIL PROTECTED]. I tried to force a release with super.release() in a doStartTag() but it doesn't help. I disabled tag pooling and it doesn't help. Is it impossible for a tag to pass itself onto another parent tag ? Can I only pass attributes or bodycontent between tags, not tags themselves ? thanks ! - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session not released after session.invalidate()
Hello, I am using JBoss 3.2.5 with Tomcat 5.0.26. We are doing performance testing and we have found some issue which may be related to the way Tomcat handles sessions. Specifically, when we do a login/logout then look at the active sessions using the JBoss console, it says that there is one active session. If I login again, using the same browser, the count of active sessions does not go out. However, if I login using a different browser, the count does go up. I have written a client-side script that does multiple login/logouts in my application. I have noticed the same behaviour: if I login and logou 50 times with 50 different clients, even after a logout, the console reports 50 active sessions. Why is that? Is there a way to correct this? Thanks, L - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
enable HTTP PUT on only one webapp
Hi, I would like to enable HTTP PUT method on only one webapp, not to all webapps. I prefer to not modify system wide web.xml, because if I do it this way I have to secure other webapps. How can I do it easily ? Regards, Laurent.
getContext(uri) returns null
Hi, I am using Tomcat 5.5.16, and a getServletContext().getContext('toto') call returns null. 'toto' is a web app deployed on same instance of tomcat where there is another wep app containing the servlet doing the call. What should I do for this call returns the correct ServletContext ? Regards, Laurent.
Re: Tomcat 5.5 installation problem
Hello, Normally you shouldn't have any problem, I've achieved this (3 tomcat 5 on the same physical machine and OS, linked through load balancing with Apache. Try again but it should work with the usual install. Regards, Laurent 2005/12/27, [EMAIL PROTECTED] [EMAIL PROTECTED]: Hi I am trying to install more than one copy of Tomcat 5.5 and use Apache 2 to achieve load balancing. But i have a problem in doing so. When i install the first copy of Tomcat 5.5, it gets installed properly and works fine. But when i try to install another copy of Tomcat 5.5, i mean the second one, i get an exception during installation and the installation aborts. is the above scenario a known issue ? or should i do something more to have multiple copies of Tomcat 5.5 running in the same system. Have a great day. Thanx Regards E.Faisal Senior Software Engineer Scandent Solutions Growing.Together. www.scandentsolutions.com Important Email Information :- The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you are not the intended addressee please contact the sender and dispose of this e-mail immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
mod_jk troubles under heavy load
Hello I'm using Apache2 + mod_jk + Tomcat 5.0.25 for a customer web site, everything seems to work ok, but under heavy load, the following error randomly appears inside my catalina.out : 12 déc. 2005 14:46:53 org.apache.commons.modeler.Registry registerComponent FATAL: Error registering Catalina:type=RequestProcessor,worker=jk-8009,name=JkRequest39683 javax.management.InstanceAlreadyExistsException: Catalina:type=RequestProcessor,worker=jk-8009,name=JkRequest39683 at mx4j.server.MBeanServerImpl.register(MBeanServerImpl.java:1123) at mx4j.server.MBeanServerImpl.registerImpl(MBeanServerImpl.java:1054) at mx4j.server.MBeanServerImpl.registerMBeanImpl(MBeanServerImpl.java:1002) at mx4j.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:978) at org.apache.commons.modeler.Registry.registerComponent(Registry.java:871) at org.apache.jk.common.ChannelSocket.registerRequest(ChannelSocket.java:436) at org.apache.jk.common.HandlerRequest.decodeRequest(HandlerRequest.java:443) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:352) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) 12 déc. 2005 14:46:53 org.apache.jk.common.ChannelSocket registerRequest ATTENTION: Error registering request I'm puzzled with this InstanceAlreadyExistsException exception, because I'm only using one Tomcat instance, with one worker. After this error happens, the site is still running, but performance is slowly degrading, too many tomcat threads - I presume one for every mod_jk request - are created and do not seem to be cleanup up, the cpu slowly raises to 100%, and a few hours later I have to restart Tomcat because every request goes timeout. Is it a known performance problem and are there tips to avoid this ? Thanks for any input Laurent -- a href=http://in-pocket.blogspot.com;http://in-pocket.blogspot.com - Mobile world, technology and more/a - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: mod_jk troubles under heavy load
Hi Peter a) Use a newer tomcat release 5.0.30 better 5.5.9 or higher b) 5.0.30 has a memory leak with registering stats as jk requests use request.registerRequests=false inside you worker2.properties Unfortunately I can't really switch my tomcat version, because my webapp is colocated with another client one which requires 5.0.25. Thank you very much for this bug report, I wasn't aware of this, and this thread http://marc.theaimsgroup.com/?l=tomcat-userm=113297418730693w=2 describes exactly the problems I'm experiencing, so I'll add this property and check the load afterwards. Thanks again Laurent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]