https://bz.apache.org/bugzilla/show_bug.cgi?id=69245
Bug ID: 69245
Summary: Tomcat.addWebapp() doesn't expire sessions after
Tomcat.start()
Product: Tomcat 9
Version: 9.0.93
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -----
Hi,
I'm using Tomcat 9.0.93 (and previously tried 9.0.74) to run an embedded Tomcat
in my JUnit test, using org.apache.catalina.startup.Tomcat.addWebapp(String,
String) and Tomcat.start(). This works just great, with one exception: sessions
do not get expired, possibly because there is no background reaper thread in
the right place.
I have set <session-timeout> to 1 in my web.xml, and made sure in the debugger
that it ends up in
org.apache.tomcat.util.descriptor.web.SessionConfig.sessionTimeout. Also I
manually tested the webapp with an identical web.xml, and verified that
sessions do expire after 1 minute.
Is there perhaps anything I need to massage org.apache.catalina.startup.Tomcat
with so that it runs the background thread and expires sessions as specified in
the web.xml?
This is roughly what I am doing and could serve as steps to reproduce:
tomcat.setPort(8080);
tomcat.setBaseDir("./target/TomcatTest");
tomcat.getHost().setAutoDeploy(true);
tomcat.addWebapp("", webAppDir.toFile().getAbsolutePath());
tomcat.init();
// must call getConnector(), see
https://stackoverflow.com/a/59282431/1245428
tomcat.getConnector();
tomcat.start();
// run server loop that waits for shutdown command
CompletableFuture.supplyAsync(() ->
{
tomcat.getServer().await();
return true;
});
(There is a seemingly related bug
https://bz.apache.org/bugzilla/show_bug.cgi?id=51558 , but that got fixed >10
years ago)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]