Re: Patch to add a socketTimeout property.

Lists: pgsql-jdbc
From: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Patch to add a socketTimeout property.
Date: 2008-04-09 17:52:13
Message-ID: 303D8E43-CC8C-4EF4-8AA5-8C9D0D00B7BB@healthtrio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Several jdbc drivers have recently added a way to set the SOTimeout
on the connections socket. For those of us accessing databases over a
unreliable connections, this can be quite helpful.
Attached is a patch to add support for an additional url property
"socketTimeout" and property in the DataSource classes. The property
is in seconds (like jtds and IBM DB2's driver and unlike the Oracle
driver).

Attachment Content-Type Size
postgresql-jdbc-8.3-603-add_socket_timeout_property.diff application/octet-stream 5.2 KB

From: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
To: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-10 04:36:10
Message-ID: 47FD993A.70809@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc


Art Gramlich wrote:
> Several jdbc drivers have recently added a way to set the SOTimeout on
> the connections socket. For those of us accessing databases over a
> unreliable connections, this can be quite helpful.

Good. Although I submitted setKeepAlive patch to solve network down two month
ago[1], it is not accepted so far. I think socket timeout is reasonable solution
and easy to use.

[1] http://archives.postgresql.org/pgsql-jdbc/2008-02/msg00022.php

Best regards,

--
Toru SHIMOGAKI<shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
NTT Open Source Software Center


From: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
To: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-10 16:50:55
Message-ID: 9947D704-EED3-4A09-AE11-D899E4776CCB@healthtrio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hopefully, it will work for your problem also. We access several
remote databases on the other side of a vpn and network problems used
to cause a lot of issues. With some other drivers, we have been able
to set this property and when these occur, flag in our connection
pools that there are network problems and shut them down until the
problem is corrected.

Art Gramlich
Chief Application Architect
HealthTrio, LLC
art(dot)gramlich(at)healthtrio(dot)com

On Apr 9, 2008, at 9:36 PM, Toru SHIMOGAKI wrote:

>
> Art Gramlich wrote:
>> Several jdbc drivers have recently added a way to set the
>> SOTimeout on the connections socket. For those of us accessing
>> databases over a unreliable connections, this can be quite helpful.
>
> Good. Although I submitted setKeepAlive patch to solve network down
> two month ago[1], it is not accepted so far. I think socket timeout
> is reasonable solution and easy to use.
>
> [1] http://archives.postgresql.org/pgsql-jdbc/2008-02/msg00022.php
>
> Best regards,
>
> --
> Toru SHIMOGAKI<shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
> NTT Open Source Software Center
>


From: Kris Jurka <books(at)ejurka(dot)com>
To: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-10 18:31:26
Message-ID: Pine.BSO.4.64.0804101424310.5861@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 10 Apr 2008, Toru SHIMOGAKI wrote:

>
> Art Gramlich wrote:
>> Several jdbc drivers have recently added a way to set the SOTimeout on the
>> connections socket. For those of us accessing databases over a unreliable
>> connections, this can be quite helpful.
>
> Good. Although I submitted setKeepAlive patch to solve network down two month
> ago[1], it is not accepted so far. I think socket timeout is reasonable
> solution and easy to use.
>

It seems like keepalives are a better solution to dead server
detection. Don't timeouts just cause problems when you have a long
running query?

Kris Jurka


From: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-10 21:59:07
Message-ID: 5B7662E7-FE50-40C5-B1F3-0D01EB08F6BF@healthtrio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

They do. We usually have different connection pools for normal (short
running) and long queries. Since almost all are short running, this
has worked well for us. I actually haven't tried setting keepalive in
this situation. so I can't say much, but the vpn solutions we have
used have at times gotten into some pretty wierd states and sotimeouts
could stop our pools from going crazy.

Art Gramlich
Chief Application Architect
HealthTrio, LLC
art(dot)gramlich(at)healthtrio(dot)com

On Apr 10, 2008, at 11:31 AM, Kris Jurka wrote:

>
>
> On Thu, 10 Apr 2008, Toru SHIMOGAKI wrote:
>
>>
>> Art Gramlich wrote:
>>> Several jdbc drivers have recently added a way to set the
>>> SOTimeout on the connections socket. For those of us accessing
>>> databases over a unreliable connections, this can be quite helpful.
>>
>> Good. Although I submitted setKeepAlive patch to solve network down
>> two month ago[1], it is not accepted so far. I think socket timeout
>> is reasonable solution and easy to use.
>>
>
> It seems like keepalives are a better solution to dead server
> detection. Don't timeouts just cause problems when you have a long
> running query?
>
> Kris Jurka


From: Kris Jurka <books(at)ejurka(dot)com>
To: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
Cc: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-11 00:51:44
Message-ID: Pine.BSO.4.64.0804102041440.29336@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 10 Apr 2008, Art Gramlich wrote:

> They do. We usually have different connection pools for normal (short
> running) and long queries. Since almost all are short running, this has
> worked well for us. I actually haven't tried setting keepalive in this
> situation. so I can't say much, but the vpn solutions we have used have at
> times gotten into some pretty wierd states and sotimeouts could stop our
> pools from going crazy.
>

I can see how keepalives are generally useful while sotimeouts are only
useful in the specific situation where you can set a global limit on your
query times. On the other hand the sotimeout is configurable while the
keepalive timeout isn't configurable (at least in Java). I'm not
particularly excited about either option, but I don't need them either.
I don't see a danger with exposing them as options as long as the pros
and cons are clearly explained.

Kris Jurka


From: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-11 17:02:53
Message-ID: 65D7DC3D-F175-4E8D-8383-0B0086DDFCB4@healthtrio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

I agree completely that keepalive is the more correct solution but
that the ability to set the timeout to something reasonable is a plus
for sotimeout.
That said, I'll take a shot at listing a few pros and cons for
allowing access to either.

Cons:
1. It could be confusing to a developer when the connection if a
connection is dropped (especially when doing a long running query).
2. I'm assuming (and please correct me if not) that postgresql will
continue to run a long query until trying to access the socket again.
If true, code could be written where it leads to a user submitting the
same long running queries to the database thinking there is just a
transient problem.

Pros:
1. Either or both are useful in unusual/unreliable networking
situations.
2. With correct settings and infrastructure, allowing the socket close
itself, can keep a connection pool from filling and threads from
hanging.
3. Setting sotimeout is available in some other major drivers (Oracle
odbc5, IBM db2jcc and jdts).

Art Gramlich
Chief Application Architect
HealthTrio, LLC
art(dot)gramlich(at)healthtrio(dot)com

On Apr 10, 2008, at 5:51 PM, Kris Jurka wrote:

>
>
> On Thu, 10 Apr 2008, Art Gramlich wrote:
>
>> They do. We usually have different connection pools for normal
>> (short running) and long queries. Since almost all are short
>> running, this has worked well for us. I actually haven't tried
>> setting keepalive in this situation. so I can't say much, but the
>> vpn solutions we have used have at times gotten into some pretty
>> wierd states and sotimeouts could stop our pools from going crazy.
>>
>
> I can see how keepalives are generally useful while sotimeouts are
> only useful in the specific situation where you can set a global
> limit on your query times. On the other hand the sotimeout is
> configurable while the keepalive timeout isn't configurable (at
> least in Java). I'm not particularly excited about either option,
> but I don't need them either.
> I don't see a danger with exposing them as options as long as the
> pros and cons are clearly explained.
>
> Kris Jurka


From: "Toru SHIMOGAKI" <shimogaki(dot)toru(at)gmail(dot)com>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: "Art Gramlich" <art(dot)gramlich(at)healthtrio(dot)com>, "Toru SHIMOGAKI" <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-12 00:27:07
Message-ID: e43b8e4f0804111727j535b62e3i4e356295b19b0023@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

2008/4/11, Kris Jurka <books(at)ejurka(dot)com>:

> I don't see a danger with exposing them as options as long as the pros and
> cons are clearly explained.

How about the following list to compare keepalive and socket timeout?
Please add other topics, if any.

keepalive socket timeout
------------------------------------------------------------------
Configurability No in Java Yes
(depend on OS setting)

Target All connections Each connection

Standard timer 2 hours Depend on users
setting

Influence All of applications Long running query
on a same OS using a same connection

Overhead Network for CPU for timer
keepalive proves

On the other hand, should we provide the both properties and users
chose either of them depend on their requirement?

--
Toru SHIMOGAKI <shimogaki(dot)toru(at)gmail(dot)com>


From: Kris Jurka <books(at)ejurka(dot)com>
To: Toru SHIMOGAKI <shimogaki(dot)toru(at)gmail(dot)com>
Cc: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>, Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org, oliver(at)opencloud(dot)com
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-13 13:57:41
Message-ID: Pine.BSO.4.64.0804130950080.9928@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Sat, 12 Apr 2008, Toru SHIMOGAKI wrote:

> On the other hand, should we provide the both properties and users
> chose either of them depend on their requirement?
>

My inclination is to apply the keepalive patch now and see where Oliver is
with implementing setQueryTimeout. Right now keepalives provide
functionality we can't get and isn't covered by the JDBC API while
sotimeout is just a brute force global query timeout. If we're going to
get real query timeout support soon then we don't need to bother with
sotimeout.

Oliver are you still planning to work on query timeouts as discussed here?
http://archives.postgresql.org/pgsql-jdbc/2008-02/msg00114.php

Kris Jurka


From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Toru SHIMOGAKI <shimogaki(dot)toru(at)gmail(dot)com>, Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>, Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-13 22:21:58
Message-ID: 48028786.5000309@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Kris Jurka wrote:

> Oliver are you still planning to work on query timeouts as discussed here?
> http://archives.postgresql.org/pgsql-jdbc/2008-02/msg00114.php

It's still on my todo list but I've been too swamped with other work to
make any progress on it yet :(

-O


From: Kris Jurka <books(at)ejurka(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Toru SHIMOGAKI <shimogaki(dot)toru(at)gmail(dot)com>, Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>, Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-14 04:45:12
Message-ID: Pine.BSO.4.64.0804140043200.12120@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, 14 Apr 2008, Oliver Jowett wrote:

> Kris Jurka wrote:
>
>> Oliver are you still planning to work on query timeouts as discussed here?
>> http://archives.postgresql.org/pgsql-jdbc/2008-02/msg00114.php
>
> It's still on my todo list but I've been too swamped with other work to make
> any progress on it yet :(
>

OK, then I'll hold the sotimeout patch until close to the 8.4 release. If
query timeouts are still unimplemented (or we only have the soft version),
we'll re-open the discussion for this patch.

Kris Jurka


From: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, Toru SHIMOGAKI <shimogaki(dot)toru(at)gmail(dot)com>, Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-14 05:28:28
Message-ID: 4802EB7C.9080907@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc


Kris,

Thank you for applying the keepalive patch.

Kris Jurka wrote:

> OK, then I'll hold the sotimeout patch until close to the 8.4 release.
> If query timeouts are still unimplemented (or we only have the soft
> version), we'll re-open the discussion for this patch.

Agreed. I hope the duscussion will go ahead.

--
Toru SHIMOGAKI<shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
NTT Open Source Software Center


From: Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
To: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Kris Jurka <books(at)ejurka(dot)com>, Oliver Jowett <oliver(at)opencloud(dot)com>, Toru SHIMOGAKI <shimogaki(dot)toru(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property.
Date: 2008-04-14 15:49:16
Message-ID: FC2AB2B8-802D-48C9-BF60-253B53014015@healthtrio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Thanks everyone.

Art Gramlich
Chief Application Architect
HealthTrio, LLC
art(dot)gramlich(at)healthtrio(dot)com

On Apr 13, 2008, at 10:28 PM, Toru SHIMOGAKI wrote:

>
> Kris,
>
> Thank you for applying the keepalive patch.
>
> Kris Jurka wrote:
>
>> OK, then I'll hold the sotimeout patch until close to the 8.4
>> release. If query timeouts are still unimplemented (or we only
>> have the soft version), we'll re-open the discussion for this patch.
>
> Agreed. I hope the duscussion will go ahead.
>
> --
> Toru SHIMOGAKI<shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
> NTT Open Source Software Center
>


From: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
To: Kris Jurka <books(at)ejurka(dot)com>, Oliver Jowett <oliver(at)opencloud(dot)com>, Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Patch to add a socketTimeout property. -- again
Date: 2009-05-28 07:47:37
Message-ID: 4A1E4199.2070601@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc


Hi,

In the following thread:

http://archives.postgresql.org/pgsql-jdbc/2008-04/msg00080.php

Kris Jurka wrote:

> OK, then I'll hold the sotimeout patch until close to the 8.4 release.
> If query timeouts are still unimplemented (or we only have the soft
> version), we'll re-open the discussion for this patch.

The 8.4 will be released soon, so I think it's time to re-open the discussion;
Does anyone try to implement setQueryTimeout()? Should we commit the sotimeout
patch?

regards,

--
Toru SHIMOGAKI<shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
NTT Open Source Software Center


From: Kris Jurka <books(at)ejurka(dot)com>
To: Toru SHIMOGAKI <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, Art Gramlich <art(dot)gramlich(at)healthtrio(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch to add a socketTimeout property. -- again
Date: 2009-06-02 00:23:59
Message-ID: alpine.BSO.2.00.0906012023090.23483@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 28 May 2009, Toru SHIMOGAKI wrote:

>> OK, then I'll hold the sotimeout patch until close to the 8.4 release. If
>> query timeouts are still unimplemented (or we only have the soft version),
>> we'll re-open the discussion for this patch.
>
> The 8.4 will be released soon, so I think it's time to re-open the
> discussion; Does anyone try to implement setQueryTimeout()? Should we commit
> the sotimeout patch?

No progress has been maded on setQueryTimeout, so I've commited the
sotimeout patch.

Kris Jurka