Re: Jmx example for adding or removing users?
Ahh perfect, thanks. On Fri, Apr 26, 2019 at 12:34 PM Mark Thomas wrote: > On 26/04/2019 12:11, Alex O'Ree wrote: > > I am looking for a way to programmatically add or remove user accounts > > using tomcats user xml file as a store without restarting tomcat. Can > this > > be done using jmx? > > > > Yes. Look under Users -> UserDatabase > > Mark > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: OutOfMemory on large file download with AJP and cachingAllowed=false
On 26/04/2019 21:07, Olivier Jaquemet wrote: > PS : completely unrelated to this matter, I just find out that the page > https://tomcat.apache.org/svn.html contains outdated information and > should probably removed as it as been replaced with > https://tomcat.apache.org/source.html There is meant to be a rewrite rule in place for that. I'll see if I can figure out why it isn't working. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: OutOfMemory on large file download with AJP and cachingAllowed=false
On 26/04/2019 09:56, Mark Thomas wrote: There was an extra copy but Chris's suggestion got me thinking and I found a much better solution. The patch has been applied to 9.0.x and 8.5.x and will be in the next release of both. 7.0.x is not affected. The patch fixes the OutOfMemoryError and the ArrayIndexOutOfBoundsException. Mark Thank you Mark and Christopher for your work on this. As always you rocks. For the record, if anyone is looking for the corresponding issue/bug, none was entered (quite unfortunate from my point of view regarding defect tracking), but the corresponding commit is there : * master (9.x) https://github.com/apache/tomcat/commit/a8f1e96a456d8493a8e64dfe743a8ae663b28ce * 8.5 : https://github.com/apache/tomcat/commit/4ab58e9881ebdc039a657f5f77caf66b673f934b (and also two some commits added for improved getContent javadoc) Thanks again. Olivier PS : completely unrelated to this matter, I just find out that the page https://tomcat.apache.org/svn.html contains outdated information and should probably removed as it as been replaced with https://tomcat.apache.org/source.html
Re: Jmx example for adding or removing users?
On 26/04/2019 12:11, Alex O'Ree wrote: > I am looking for a way to programmatically add or remove user accounts > using tomcats user xml file as a store without restarting tomcat. Can this > be done using jmx? > Yes. Look under Users -> UserDatabase Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Internals of Tomcat Thread Pool
On 26/04/2019 06:25, Supun Abeysinghe wrote: > Hi all, > > > I am working on a project which tries to tune the Tomcat thread pool > dynamically by looking at runtime characteristics in order to enhance the > system performance. To get a better understanding, I have gone through the > Tomcat source code and found out that it uses ThreadPoolExecutor. It maps > minSpareThreads parameter to corePoolSize and maxThreads parameter to > specify the maximum thread pool size. However, I'm having trouble > understanding how to specify the queue length. This is not the acceptCount. > I'm talking about the size of the BlockingQueue (work queue) which is used > inside the ThreadPoolExecutor. As per my understanding, the BlockingQueue > (work queue) and the request queue (of which the size is specified using > the acceptCount parameter) are two different queues (am I wrong here? are > both the same?). > > My Question is, how to specify the length of the BlockingQueue (work queue) > using Tomcat parameters? Is there any JMX MBean that reports this queue > size? StandardThreadExectuor maxQueueSize Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Fix for DBCP-518
On 24/04/2019 16:28, Lazar Kirchev wrote: > Hello, > > Any update on this? No specific plans but I can do an update of DBCP2, Pool2 etc for the next set of releases. Mark > > Regards, > Lazar > > On Tue, Apr 16, 2019 at 4:28 PM Lazar Kirchev > wrote: > >> Hello, >> >> Do you have any plans to get the fix for >> https://issues.apache.org/jira/browse/DBCP-518 in the Tomcat 8.5 clone of >> the Commons DBCP? >> The commits with the fix are >> https://github.com/apache/commons-dbcp/commit/81aea944160608838cb2d7cdfb0d9b6893a655d9, >> >> https://github.com/apache/commons-dbcp/commit/3449a42bbaeed0ff5b0d07998169ff2896bf45c7 >> and >> https://github.com/apache/commons-dbcp/commit/91f7e267e61047614751763f6c5968a1ff65f82c >> >> Regards, >> Lazar >> > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Apache httpd / tomcat AJP connector(s?)
On 24/04/2019 10:58, André Warnier (tomcat) wrote: > Hi. > > This is somewhat of an arcane question and somewhat straddling httpd and > tomcat, so if I'm on the wrong list for this, just let me know. Here is fine. We can always move the thread if necessary. > The question is : is there any particular reason why the combination > mod_proxy + mod_proxy_ajp (in httpd), does not seem to follow the > ProxyPreserveHost directive, when proxying something from httpd to tomcat ? None that I am aware of. I've complete a quick test with httpd 2.4.34 and Tomcat 9.0.x and I see the host header is passed via AJP as expected. I suggest wireshark to look at what is on the wire. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Using custom Configurator with WebSockets
Hmm. Looking at this some more I'm not sure this is going to work. HarbourServerEndpoint needs to extend javax.websocket.Endpoint which it can't do as an interface. I think you are going to have to wrap the instance returned by the registry. In which case you can probably go back to using POJO. So you'd have something like (I'm typing directly in email so the chances of this compiling first time are slim): @ServerEndpoint(...) HarbourServerEndpointWrapper private HarbourServerEndpoint inner; public HarbourServerEndpointWrapper() { inner = RegistryProxy.getService(HarbourServerEndpoint.class); } @OnOpen void onOpen(Session session, EndpointConfig config) { inner.onOpen(Session session, EndpointConfig config); } @OnMessage void onMessageMessage(Session session, Message message) { inner.onMessageMessage(Session session, Message message); } @OnClose void onClose(Session session, CloseReason reason) { inner.onClose(Session session, CloseReason reason); } @OnError void onError(Session session, Throwable throwable) { inner.onError(Session session, Throwable throwable); } } Mark On 26/04/2019 11:07, Christopher Dodunski wrote: > So I've converted the server endpoint from annotation-based to > programmatic, to get around the constraint of the @ServerEndpoint > annotation having to decorate a concrete class. The elements of this > annotation now occupy an implementation of ServerApplicationConfig: > > > public class HarbourServerApplicationConfig implements > ServerApplicationConfig { > > ... > > @Override > public Set getEndpointConfigs(Set extends Endpoint>> endpointClasses) { > Set result = new HashSet<>(); > ServerEndpointConfig configuration = > ServerEndpointConfig.Builder.create(HarbourServerEndpoint.class, > "/websocket/{port-name}/{username}") > .configurator(configurator) > .encoders(encoders) > .decoders(decoders) > .build(); > result.add(configuration); > > return result; > } > } > > > All works fine when the Builder.create() parameter is a concrete endpoint > class, but not if an interface (the goal is having Tomcat accept as > endpoint instances IoC proxy objects cast back to their interface). > > The error message suggests that Tomcat is treating this class as concrete. > > > 26-Apr-2019 20:00:40.605 SEVERE [ajp-nio-127.0.0.1-8009-exec-197] > org.apache.catalina.core.ContainerBase.addChildInternal > ContainerBase.addChild: start: > org.apache.catalina.LifecycleException: Failed to start component > [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/harbour]] > at > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) > at > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754) > at > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730) > at > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) > at > org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985) > ... > Caused by: java.lang.NullPointerException > at > org.apache.tomcat.websocket.pojo.PojoMethodMapping.(PojoMethodMapping.java:85) > at > org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:147) > at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:116) > at > org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5245) > at > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) > ... 46 more > > > Lastly, below is the interface itself (my programmatic endpoint implements > this). > > > public interface HarbourServerEndpoint { > > void onOpen(Session session, EndpointConfig config); > > void onMessageMessage(Session session, Message message); > > void onClose(Session session, CloseReason reason); > > void onError(Session session, Throwable throwable); > } > > > Unfortunately online examples of programmatic endpoints are sparse, and > the few to be found very basic. So am quite reliant on those familiar > with the WebSocket library, and Tomcat's application of it. > > Kind regards, > > Chris. > > > - > 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
Jmx example for adding or removing users?
I am looking for a way to programmatically add or remove user accounts using tomcats user xml file as a store without restarting tomcat. Can this be done using jmx?
Re: Using custom Configurator with WebSockets
So I've converted the server endpoint from annotation-based to programmatic, to get around the constraint of the @ServerEndpoint annotation having to decorate a concrete class. The elements of this annotation now occupy an implementation of ServerApplicationConfig: public class HarbourServerApplicationConfig implements ServerApplicationConfig { ... @Override public Set getEndpointConfigs(Set> endpointClasses) { Set result = new HashSet<>(); ServerEndpointConfig configuration = ServerEndpointConfig.Builder.create(HarbourServerEndpoint.class, "/websocket/{port-name}/{username}") .configurator(configurator) .encoders(encoders) .decoders(decoders) .build(); result.add(configuration); return result; } } All works fine when the Builder.create() parameter is a concrete endpoint class, but not if an interface (the goal is having Tomcat accept as endpoint instances IoC proxy objects cast back to their interface). The error message suggests that Tomcat is treating this class as concrete. 26-Apr-2019 20:00:40.605 SEVERE [ajp-nio-127.0.0.1-8009-exec-197] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/harbour]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985) ... Caused by: java.lang.NullPointerException at org.apache.tomcat.websocket.pojo.PojoMethodMapping.(PojoMethodMapping.java:85) at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:147) at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:116) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5245) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 46 more Lastly, below is the interface itself (my programmatic endpoint implements this). public interface HarbourServerEndpoint { void onOpen(Session session, EndpointConfig config); void onMessageMessage(Session session, Message message); void onClose(Session session, CloseReason reason); void onError(Session session, Throwable throwable); } Unfortunately online examples of programmatic endpoints are sparse, and the few to be found very basic. So am quite reliant on those familiar with the WebSocket library, and Tomcat's application of it. Kind regards, Chris. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: OutOfMemory on large file download with AJP and cachingAllowed=false
On 25/04/2019 21:37, Mark Thomas wrote: > On 25/04/2019 21:16, Christopher Schultz wrote: >> On 4/25/19 15:55, Mark Thomas wrote: >> If the resources are caching-aware, then I think the DefaultServlet >> can just always use Resource.getInputStream. >> >> Hmm. That might cause a lot of unnecessary IO if the bytes are >> actually available. > > That is a very tempting solution. The result is a LOT cleaner than the > patch I just wrote. CachingResource is smart enough to cache the bytes > and wrap them in a ByteArrayInputStream if Resource.getInputStream is > called. My only concern is I think this introduces and additional copy > of the data. I need to check that. There was an extra copy but Chris's suggestion got me thinking and I found a much better solution. The patch has been applied to 9.0.x and 8.5.x and will be in the next release of both. 7.0.x is not affected. The patch fixes the OutOfMemoryError and the ArrayIndexOutOfBoundsException. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org