Question about suspectTimeout property of pool configuration - possible Bug - does only work with removeAbandoned = true which seems odd

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about suspectTimeout property of pool configuration - possible Bug - does only work with removeAbandoned = true which seems odd

Torsten Krah-2
Hi,

looking at the doc:

https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

there is:

suspectTimeout

(int) Timeout value in seconds. Default value is 0.
Similar to to the removeAbandonedTimeout value but instead of treating
the connection as abandoned, and potentially closing the connection,
this simply logs the warning if logAbandoned is set to true. If this
value is equal or less than 0, no suspect checking will be performed.
Suspect checking only takes place if the timeout value is larger than 0
and the connection was not abandoned or if abandon check is disabled. If
a connection is suspect a WARN message gets logged and a JMX
notification gets sent once.

To me this sounds like i should get a warning if i configure the pool
like this:

 logAbandoned="true"
 suspectTimeout="120"

after 2 minutes.
I don't want to remove the connections, i just want to get them logged.

However i don't see such messages - looking at the code it seems that
suspect() from the connection is called from the pool in:

pool.checkAbandoned();

but this is only called from the PoolCleaner in its run method when the
check:

if (pool.getPoolProperties().isRemoveAbandoned())
                        pool.checkAbandoned();

is true.
But i don't want to get them removed - i just want them logged like
suspect is promising - at least it sounds to me like that.

Any thoughts about that? Shouldn't it read like:

if (pool.getPoolProperties().isRemoveAbandoned() ||
pool.getPoolProperties().getSuspectTimeout() > 0)
                        pool.checkAbandoned();

JavaDoc of setSuspectTimeout:

    /**
     * Similar to {@link #setRemoveAbandonedTimeout(int)} but instead of
treating the connection
     * as abandoned, and potentially closing the connection, this simply
logs the warning if
     * {@link #isLogAbandoned()} returns true. If this value is equal or
less than 0, no suspect
     * checking will be performed. Suspect checking only takes place if
the timeout value is larger than 0 and
     * the connection was not abandoned or if abandon check is disabled.
If a connection is suspect a WARN message gets
     * logged and a JMX notification gets sent once.
     * @param seconds - the amount of time in seconds that has to pass
before a connection is marked suspect.
     */
    public void setSuspectTimeout(int seconds);


does also imply this behaviour i would expect.
It seems you need to remove them (even with a large timeout set to get
suspect working) - javadoc reads i can have suspect without remove.
If this should be the case checkAbandoned() needs some work so that
shouldAbandon() does check the property - removeAbandoned - to make sure
it should really remove it, not just got to suspect in the else case -
or just have to methods ... don't mind which solution, something like
this ;).

Should i open some ticket about that possible Bug or is it working as
intended?

kind regards

Torsten




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Question about suspectTimeout property of pool configuration - possible Bug - does only work with removeAbandoned = true which seems odd

kfujino
2016-08-19 0:52 GMT+09:00 Torsten Krah <[hidden email]>:

> Hi,
>
> looking at the doc:
>
> https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html
>
> there is:
>
> suspectTimeout
>
> (int) Timeout value in seconds. Default value is 0.
> Similar to to the removeAbandonedTimeout value but instead of treating
> the connection as abandoned, and potentially closing the connection,
> this simply logs the warning if logAbandoned is set to true. If this
> value is equal or less than 0, no suspect checking will be performed.
> Suspect checking only takes place if the timeout value is larger than 0
> and the connection was not abandoned or if abandon check is disabled. If
> a connection is suspect a WARN message gets logged and a JMX
> notification gets sent once.
>
> To me this sounds like i should get a warning if i configure the pool
> like this:
>
>  logAbandoned="true"
>  suspectTimeout="120"
>
> after 2 minutes.
> I don't want to remove the connections, i just want to get them logged.
>
> However i don't see such messages - looking at the code it seems that
> suspect() from the connection is called from the pool in:
>
> pool.checkAbandoned();
>
> but this is only called from the PoolCleaner in its run method when the
> check:
>
> if (pool.getPoolProperties().isRemoveAbandoned())
>                         pool.checkAbandoned();
>
> is true.
> But i don't want to get them removed - i just want them logged like
> suspect is promising - at least it sounds to me like that.
>
> Any thoughts about that? Shouldn't it read like:
>
> if (pool.getPoolProperties().isRemoveAbandoned() ||
> pool.getPoolProperties().getSuspectTimeout() > 0)
>                         pool.checkAbandoned();
>
> JavaDoc of setSuspectTimeout:
>
>     /**
>      * Similar to {@link #setRemoveAbandonedTimeout(int)} but instead of
> treating the connection
>      * as abandoned, and potentially closing the connection, this simply
> logs the warning if
>      * {@link #isLogAbandoned()} returns true. If this value is equal or
> less than 0, no suspect
>      * checking will be performed. Suspect checking only takes place if
> the timeout value is larger than 0 and
>      * the connection was not abandoned or if abandon check is disabled.
> If a connection is suspect a WARN message gets
>      * logged and a JMX notification gets sent once.
>      * @param seconds - the amount of time in seconds that has to pass
> before a connection is marked suspect.
>      */
>     public void setSuspectTimeout(int seconds);
>
>
> does also imply this behaviour i would expect.
> It seems you need to remove them (even with a large timeout set to get
> suspect working) - javadoc reads i can have suspect without remove.
> If this should be the case checkAbandoned() needs some work so that
> shouldAbandon() does check the property - removeAbandoned - to make sure
> it should really remove it, not just got to suspect in the else case -
> or just have to methods ... don't mind which solution, something like
> this ;).
>
> Should i open some ticket about that possible Bug or is it working as
> intended?
>
>
Hello Torsten

I'm not sure whether this is a bug.
However, I prefer the suspectTimeout does not depend on the removeAbandoned.
The suspectTimeout should work without abandoned connection.

Please open the bugzilla.




> kind regards
>
> Torsten
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> --
> Keiichi.Fujino
> <[hidden email]>

<[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Question about suspectTimeout property of pool configuration - possible Bug - does only work with removeAbandoned = true which seems odd

Torsten Krah-2
https://bz.apache.org/bugzilla/show_bug.cgi?id=60043

Am Dienstag, den 23.08.2016, 16:32 +0900 schrieb Keiichi Fujino:
> Please open the bugzilla.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]