Re: CrawlerSessionManagerValve only working with default host

2018-04-12 Thread Felix Schumacher

Am 12.04.2018 um 09:27 schrieb Mark Thomas:

On 12/04/18 00:10, Matt Cosentino wrote:

I first noticed it by the large number of sessions in the manager webapp, but 
then I verified it in my logs. Both of my sites are polled every minute by the 
UptimeRobot service. These requests are logged and I can see what session is 
being used. For the default host site, they reuse the same session. For the 
non-default host sites, they create new sessions.

It is a limitation of the CrawlerSessionManagerValve. It only supports
one session per client IP as it maps client IP to session ID internally.
Moving the Valve to the Context (if you want it to apply to every
Context you can define it in CATALINA_BASE/conf/context.xml) is a
workaround.

The proper fix is to change the valve so it maps context+client IP to
session ID. There are several ways to do this. Please open a Bugzilla
enhancement request for this and someone will take a look.


https://bz.apache.org/bugzilla/show_bug.cgi?id=62297

Regards,
 Feli


Mark



04-11 00:00:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.defaulthost.com
04-11 00:01:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.defaulthost.com
04-11 00:02:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.defaulthost.com
04-11 00:03:13 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.defaulthost.com

04-11 00:00:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, C62DCA4E9DC39884E3E82EE19AAEAB4A, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.anotherhost.com
04-11 00:01:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, 542027513FD08CD82C8BEFF3C4E75F8C, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.anotherhost.com
04-11 00:02:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, F93C1929D880DDD446D13E36413544DF, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.anotherhost.com
04-11 00:03:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, 82C3BB415817B8C4761EFEF7EE7591DD, Mozilla/5.0+(compatible; 
UptimeRobot/2.0; http://www.uptimerobot.com/), REFERER: https://www.anotherhost.com

This is with the valve at the engine level, which I assumed meant that it would apply to 
all hosts within that engine. The documentation states "Normally, this Valve would 
be used at the Engine level.", so that's what I did.

https://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Crawler_Session_Manager_Valve

- Matt

-Original Message-
From: Christopher Schultz <ch...@christopherschultz.net>
Sent: Wednesday, April 11, 2018 1:46 PM
To: users@tomcat.apache.org
Subject: Re: CrawlerSessionManagerValve only working with default host

Matt,

On 4/11/18 2:03 PM, Matt Cosentino wrote:

I have CrawlerSessionManagerValve set up at the Engine level, but it only seems 
to be working for the default host and not any other host. Is this expected 
behavior? Should I put it at the host level for each host?

Here is an example of how I have it set up:

 
   
 
   
   
   
   


Tomcat 8.5.24

I don't see anything in the code that suggests it wouldn't work when used at the 
 level, but it also looks like it makes the most sense at the  
level.

Can you describe your testing and the results you got?

When you say "only [...] working for the default host", do you mean that it works for the default host 
within an  (when configured at the  level) or that it doesn't even work with a 
non-default  when configured at the  level?

-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



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additio

RE: CrawlerSessionManagerValve only working with default host

2018-04-12 Thread Matt Cosentino
Ahh, I can see that from the source now, thanks.

- Matt


-Original Message-
From: Mark Thomas <ma...@apache.org> 
Sent: Thursday, April 12, 2018 2:27 AM
To: Tomcat Users List <users@tomcat.apache.org>
Subject: Re: CrawlerSessionManagerValve only working with default host

On 12/04/18 00:10, Matt Cosentino wrote:
> I first noticed it by the large number of sessions in the manager webapp, but 
> then I verified it in my logs. Both of my sites are polled every minute by 
> the UptimeRobot service. These requests are logged and I can see what session 
> is being used. For the default host site, they reuse the same session. For 
> the non-default host sites, they create new sessions.

It is a limitation of the CrawlerSessionManagerValve. It only supports one 
session per client IP as it maps client IP to session ID internally.
Moving the Valve to the Context (if you want it to apply to every Context you 
can define it in CATALINA_BASE/conf/context.xml) is a workaround.

The proper fix is to change the valve so it maps context+client IP to session 
ID. There are several ways to do this. Please open a Bugzilla enhancement 
request for this and someone will take a look.

Mark


> 
> 04-11 00:00:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 04-11 00:01:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 04-11 00:02:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 04-11 00:03:13 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 
> 04-11 00:00:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, C62DCA4E9DC39884E3E82EE19AAEAB4A, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 04-11 00:01:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, 542027513FD08CD82C8BEFF3C4E75F8C, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 04-11 00:02:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, F93C1929D880DDD446D13E36413544DF, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 04-11 00:03:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, 82C3BB415817B8C4761EFEF7EE7591DD, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 
> This is with the valve at the engine level, which I assumed meant that it 
> would apply to all hosts within that engine. The documentation states 
> "Normally, this Valve would be used at the Engine level.", so that's what I 
> did.
> 
> https://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Crawler_Ses
> sion_Manager_Valve
> 
> - Matt
> 
> -Original Message-
> From: Christopher Schultz <ch...@christopherschultz.net>
> Sent: Wednesday, April 11, 2018 1:46 PM
> To: users@tomcat.apache.org
> Subject: Re: CrawlerSessionManagerValve only working with default host
> 
> Matt,
> 
> On 4/11/18 2:03 PM, Matt Cosentino wrote:
>> I have CrawlerSessionManagerValve set up at the Engine level, but it only 
>> seems to be working for the default host and not any other host. Is this 
>> expected behavior? Should I put it at the host level for each host?
>>
>> Here is an example of how I have it set up:
>>
>> 
>>   
>> 
>>   
>>   
>>   
>>   > className="org.apache.catalina.valves.CrawlerSessionManagerValve" 
>> sessionInactiveInterval="300"/>
>>
>>
>> Tomcat 8.5.24
> 
> I don't see anything in the code that suggests it wouldn't work when used at 
> the  level, but it also looks like it makes the most sense at the 
>  level.
> 
> Can you describe your testing and the results you got?
> 
> Wh

Re: CrawlerSessionManagerValve only working with default host

2018-04-12 Thread Mark Thomas
On 12/04/18 00:10, Matt Cosentino wrote:
> I first noticed it by the large number of sessions in the manager webapp, but 
> then I verified it in my logs. Both of my sites are polled every minute by 
> the UptimeRobot service. These requests are logged and I can see what session 
> is being used. For the default host site, they reuse the same session. For 
> the non-default host sites, they create new sessions.

It is a limitation of the CrawlerSessionManagerValve. It only supports
one session per client IP as it maps client IP to session ID internally.
Moving the Valve to the Context (if you want it to apply to every
Context you can define it in CATALINA_BASE/conf/context.xml) is a
workaround.

The proper fix is to change the valve so it maps context+client IP to
session ID. There are several ways to do this. Please open a Bugzilla
enhancement request for this and someone will take a look.

Mark


> 
> 04-11 00:00:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 04-11 00:01:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 04-11 00:02:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 04-11 00:03:13 INFO  LogRequest   >  HEAD: https www.defaulthost.com 
> /, FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.defaulthost.com
> 
> 04-11 00:00:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, C62DCA4E9DC39884E3E82EE19AAEAB4A, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 04-11 00:01:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, 542027513FD08CD82C8BEFF3C4E75F8C, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 04-11 00:02:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, F93C1929D880DDD446D13E36413544DF, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 04-11 00:03:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com 
> /, FROM: 69.162.124.237, 82C3BB415817B8C4761EFEF7EE7591DD, 
> Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
> REFERER: https://www.anotherhost.com
> 
> This is with the valve at the engine level, which I assumed meant that it 
> would apply to all hosts within that engine. The documentation states 
> "Normally, this Valve would be used at the Engine level.", so that's what I 
> did.
> 
> https://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Crawler_Session_Manager_Valve
> 
> - Matt
> 
> -Original Message-
> From: Christopher Schultz <ch...@christopherschultz.net> 
> Sent: Wednesday, April 11, 2018 1:46 PM
> To: users@tomcat.apache.org
> Subject: Re: CrawlerSessionManagerValve only working with default host
> 
> Matt,
> 
> On 4/11/18 2:03 PM, Matt Cosentino wrote:
>> I have CrawlerSessionManagerValve set up at the Engine level, but it only 
>> seems to be working for the default host and not any other host. Is this 
>> expected behavior? Should I put it at the host level for each host?
>>
>> Here is an example of how I have it set up:
>>
>> 
>>   
>> 
>>   
>>   
>>   
>>   > className="org.apache.catalina.valves.CrawlerSessionManagerValve" 
>> sessionInactiveInterval="300"/>
>>
>>
>> Tomcat 8.5.24
> 
> I don't see anything in the code that suggests it wouldn't work when used at 
> the  level, but it also looks like it makes the most sense at the 
>  level.
> 
> Can you describe your testing and the results you got?
> 
> When you say "only [...] working for the default host", do you mean that it 
> works for the default host within an  (when configured at the 
>  level) or that it doesn't even work with a non-default  when 
> configured at the  level?
> 
> -chris
> 
> --

RE: CrawlerSessionManagerValve only working with default host

2018-04-11 Thread Matt Cosentino
I first noticed it by the large number of sessions in the manager webapp, but 
then I verified it in my logs. Both of my sites are polled every minute by the 
UptimeRobot service. These requests are logged and I can see what session is 
being used. For the default host site, they reuse the same session. For the 
non-default host sites, they create new sessions.

04-11 00:00:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.defaulthost.com
04-11 00:01:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.defaulthost.com
04-11 00:02:14 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.defaulthost.com
04-11 00:03:13 INFO  LogRequest   >  HEAD: https www.defaulthost.com /, 
FROM: 69.162.124.237, D21FE7FD2B82B776AB194C278244D79E, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.defaulthost.com

04-11 00:00:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, C62DCA4E9DC39884E3E82EE19AAEAB4A, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.anotherhost.com
04-11 00:01:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, 542027513FD08CD82C8BEFF3C4E75F8C, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.anotherhost.com
04-11 00:02:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, F93C1929D880DDD446D13E36413544DF, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.anotherhost.com
04-11 00:03:32 INFO  LogRequest   >  HEAD: https www.anotherhost.com /, 
FROM: 69.162.124.237, 82C3BB415817B8C4761EFEF7EE7591DD, 
Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/), 
REFERER: https://www.anotherhost.com

This is with the valve at the engine level, which I assumed meant that it would 
apply to all hosts within that engine. The documentation states "Normally, this 
Valve would be used at the Engine level.", so that's what I did.

https://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Crawler_Session_Manager_Valve

- Matt

-Original Message-
From: Christopher Schultz <ch...@christopherschultz.net> 
Sent: Wednesday, April 11, 2018 1:46 PM
To: users@tomcat.apache.org
Subject: Re: CrawlerSessionManagerValve only working with default host

Matt,

On 4/11/18 2:03 PM, Matt Cosentino wrote:
> I have CrawlerSessionManagerValve set up at the Engine level, but it only 
> seems to be working for the default host and not any other host. Is this 
> expected behavior? Should I put it at the host level for each host?
> 
> Here is an example of how I have it set up:
> 
> 
>   
> 
>   
>   
>   
>className="org.apache.catalina.valves.CrawlerSessionManagerValve" 
> sessionInactiveInterval="300"/>
>
> 
> Tomcat 8.5.24

I don't see anything in the code that suggests it wouldn't work when used at 
the  level, but it also looks like it makes the most sense at the 
 level.

Can you describe your testing and the results you got?

When you say "only [...] working for the default host", do you mean that it 
works for the default host within an  (when configured at the  
level) or that it doesn't even work with a non-default  when configured 
at the  level?

-chris

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



Re: CrawlerSessionManagerValve only working with default host

2018-04-11 Thread Christopher Schultz
Matt,

On 4/11/18 2:03 PM, Matt Cosentino wrote:
> I have CrawlerSessionManagerValve set up at the Engine level, but it only 
> seems to be working for the default host and not any other host. Is this 
> expected behavior? Should I put it at the host level for each host?
> 
> Here is an example of how I have it set up:
> 
> 
>   
> 
>   
>   
>   
>className="org.apache.catalina.valves.CrawlerSessionManagerValve" 
> sessionInactiveInterval="300"/>
>
> 
> Tomcat 8.5.24

I don't see anything in the code that suggests it wouldn't work when
used at the  level, but it also looks like it makes the most
sense at the  level.

Can you describe your testing and the results you got?

When you say "only [...] working for the default host", do you mean that
it works for the default host within an  (when configured at the
 level) or that it doesn't even work with a non-default 
when configured at the  level?

-chris

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