Re: [DBCP] Connection just obtained from datasource is invalid

2017-11-18 Thread Phil Steitz
On 11/17/17 3:27 PM, Phil Steitz wrote:
> On 11/17/17 12:22 PM, Shawn Heisey wrote:
>> On 11/16/2017 5:21 PM, Phil Steitz wrote:
 How can a connection that I *just* retrieved from the pool be closed?
>>> Should not happen.  In most cases like this, it turns out not to be
>>> the pool that closed the connection.  The most common causes of this
>>> are network connectivity problems or the server closing the
>>> connection due to idle timeout.  The latter seems unlikely given
>>> that you have idle eviction configured.  Is it possible that some
>>> clients are holding connections for a very long time without using
>>> them?  The evictor only acts on connections that are idle in the
>>> pool (i.e. it does not do anything to connections that are checked
>>> out to clients).
>> Thank you for your reply.
>>
>> My program does its work once a minute, and I had also configured the
>> idle eviction to run once a minute.
>>
>> Just to see what it would do, I slightly changed the run interval for
>> the idle eviction -- for one of the object pools, adding 943
>> milliseconds, and 944 milliseconds for the other.  I've only seen the
>> problem happen once since making that change, where before it would
>> happen several times per day.  This isn't actual evidence, but it is
>> curious.
> See comment below on the config.
>> Although a network problem is always a possibility, it's not likely. 
>> It's a gigabit LAN with Cisco switches.  I will trace the network path
>> and check all the switch logs to see whether that might indeed be the
>> problem.
>>
>>> That should not be possible, as once a connection has been checked
>>> out, it is not eligible for eviction.  And even if it were evicted
>>> by the pool, the pool would set the DelegatingConnection's closed
>>> property to true so isValid would return false rather than
>>> throwing.  It looks like the situation here is that the pool thinks
>>> the connection is open, but the underlying physical connection has
>>> been closed.
>> The code is within a try/catch block that traps all exceptions, so I am
>> 100 percent certain that isValid is not throwing an exception, it's just
>> returning false. 
> OK, sorry I misread your initial post.  That means either the pool
> agrees that the connection is closed (which would point to a pool or
> DBCP bug) or the driver's isValid() on the underlying physical
> connection is returning true (without throwing).
Sorry, I meant "false" above.  DelegatingConnection's isValid is just

public boolean isValid(int timeout) throws SQLException {
    if (isClosed()) {
    return false;
    }
    try {
    return _conn.isValid(timeout);
    }
    catch (SQLException e) {
    handleException(e);
    return false;
    }
    }

Note that the validation query is not executed here.  That query is
only used by the pool lifecycle methods when you have testOnBorrow,
testOnReturn or testWhileIdle set to true.  handleExeption as
overridden by PoolableConnection rethrows.  _conn is the underlying
physical connection,

Phil

>   If it's not too
> hard to do, it would be good to also log what comes back from
> isClosed() on the DelegatingConnection (what dsMaster returns).  If
> that returns true, then either this is a DBCP or pool bug or you
> have somehow closed the DelegatingConnection via another reference
> or something.  If it returns false, that means the pool thinks the
> connection is open so it is unlikely that the pool closed it.
>>  When I first started investigating my strange alarms,
>> I couldn't tell what was wrong at all until I decided to add some code
>> to try a query on the connection that said it wasn't valid.   I fully
>> expected that query to fail, I was just doing it to try and discover why
>> isValid returned false.
>>
>> This is a very recent problem, but the code hasn't had any changes since
>> well before the problem began.  That does lend credibility to the
>> possibility of a network problem, which as I said, I will investigate.
>>
>>> It would be good to see your full pool config and a stack trace of
>>> the exception above.  You might also look at the server logs to see
>>> what is happening on the Mysql side.
>> Tell me exactly what I need to do in order to gather the pool config
>> you're after.  Are you looking for Java code, or some kind of
>> information from the objects that I need to gather?  Here's the code
>> that defines a datasource. 
> What you have below is fine.  I just wanted to see the pool
> configuration settings.  Looks OK, but might end up creating a lot
> of connection churn having maxIdle set to 6 with maxTotal at 30.  I
> guess the idea is that when it runs, you want to have an idle
> connection available for each shard with the ability to add more up
> to a total of 30, but you don't want those idle connections to stay
> in the pool when the work isn't being done.  Do you know how many
> connections actually get opened during the work 

Re: [net] Version 3.7

2017-11-18 Thread Martin Gainty
i assume makato sakaguchi wants to merge 28 github commits to 3.7 to 
svn.apache.org?


3.7 has not yet promoted to 
https://svn.apache.org/repos/asf/commons/proper/net/tags/

mods reviewed?
sign with keys issue?

something else?


I can help out if someone can point out repo locations and jenkins jobs


caveat ..JDK 1.6 is deprecated in Jboss-wildfly..is commons-net listing JDK1.6 
as hard dependency?

M
__




From: Gary Gregory 
Sent: Saturday, November 18, 2017 11:57 AM
To: Commons Users List
Subject: Re: [net] Version 3.7

Nope, we need an RM to volunteer.

Gary

On Nov 18, 2017 10:54, "Robert Paasche"  wrote:

> Hi all,
>
> is there an estimated date of the release?
>
> Best
> Robert Paasche
>
> 2017-10-23 16:29 GMT+02:00 Robert Paasche :
>
> > Hi,
> >
> > is there a release schedule for commons-net 3.7? We need the fix/changes
> > from NET-584, but we are not allowed to use SNAPSHOT versions.
> >
> > Robert Paasche
> >
> >
> >
>


Re: [net] Version 3.7

2017-11-18 Thread Gary Gregory
Nope, we need an RM to volunteer.

Gary

On Nov 18, 2017 10:54, "Robert Paasche"  wrote:

> Hi all,
>
> is there an estimated date of the release?
>
> Best
> Robert Paasche
>
> 2017-10-23 16:29 GMT+02:00 Robert Paasche :
>
> > Hi,
> >
> > is there a release schedule for commons-net 3.7? We need the fix/changes
> > from NET-584, but we are not allowed to use SNAPSHOT versions.
> >
> > Robert Paasche
> >
> >
> >
>


Re: [net] Version 3.7

2017-11-18 Thread Robert Paasche
Hi all,

is there an estimated date of the release?

Best
Robert Paasche

2017-10-23 16:29 GMT+02:00 Robert Paasche :

> Hi,
>
> is there a release schedule for commons-net 3.7? We need the fix/changes
> from NET-584, but we are not allowed to use SNAPSHOT versions.
>
> Robert Paasche
>
>
>