pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedjava.net.SocketException: Broken pipe
7+ messages / 5 participants
[nested] [flat]
* java.net.SocketException: Broken pipe
@ 2003-09-22 12:43 Phil.Hourihane@meridianp2p.com
0 siblings, 1 reply; 7+ messages in thread
From: Phil.Hourihane@meridianp2p.com @ 2003-09-22 12:43 UTC (permalink / raw)
To: pgsql-jdbc
Hello, World.
I have an intermittent problem that I am having trouble with, using
postgresql
7.3.4. It manifests itself as a SocketException...
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
at
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
at
org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
at
org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
...etc...
... but it doesn't seem to correspond to the mails on this list that
mention
this trace. The previous mails warn that this can happen if an earlier
statement
includes a null character (char 0). I tried to reproduce the problem that
way but instead I was prevented by...
java.lang.IllegalArgumentException: \0 not allowed
at
org.postgresql.jdbc1.AbstractJdbc1Statement.escapeString(AbstractJdbc1Statement.java:955)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.setString(AbstractJdbc1Statement.java:917)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.setString(AbstractJdbc1Statement.java:900)
...etc...
Now, the problem seems to occur only intermittently, and will 'repair'
itself
with no action on my part. It does however, seem to occur in clumps - it
will
fail a few times in a short space of time before working again.
I have created a statement at boot time for this purpose (it is a
statement
that gets used a lot, so I prefer to cache it), rather than create a new
statement for each invocation. Some posts on the mailing list mention this
as a problem (the backend shutting down the connection), but I have no
idea
how to control this behaviour.
I don't seen to be able to reproduce this behaviour on demand; I have seen
it in logs of a system that is running long-term, not just a development
box
that is working for a little bit at a time.
It doesn't seem to be related to heavy loads on the system either - the
load
has been pretty light when it occurred.
Has anybody else encountered this problem or had any success in dealing
with it?
PHiL
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: java.net.SocketException: Broken pipe
@ 2003-09-22 15:46 Barry Lind <blind@xythos.com>
parent: Phil.Hourihane@meridianp2p.com
0 siblings, 0 replies; 7+ messages in thread
From: Barry Lind @ 2003-09-22 15:46 UTC (permalink / raw)
To: Phil.Hourihane@meridianp2p.com; +Cc: pgsql-jdbc
Phil,
A possible cause is a firewall or some other device between the client
and the server that drops connections after a certain time. (Most
firewall don't allow you to keep connections open indefinitely).
thanks,
--Barry
Phil.Hourihane@meridianp2p.com wrote:
> Hello, World.
>
> I have an intermittent problem that I am having trouble with, using
> postgresql
> 7.3.4. It manifests itself as a SocketException...
>
> java.net.SocketException: Broken pipe
> at java.net.SocketOutputStream.socketWrite0(Native Method)
> at
> java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
> at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
> at
> java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
> at
> java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
> at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
> at
> org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
> at
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
> ...etc...
>
> ... but it doesn't seem to correspond to the mails on this list that
> mention
> this trace. The previous mails warn that this can happen if an earlier
> statement
> includes a null character (char 0). I tried to reproduce the problem that
> way but instead I was prevented by...
>
> java.lang.IllegalArgumentException: \0 not allowed
> at
> org.postgresql.jdbc1.AbstractJdbc1Statement.escapeString(AbstractJdbc1Statement.java:955)
> at
> org.postgresql.jdbc1.AbstractJdbc1Statement.setString(AbstractJdbc1Statement.java:917)
> at
> org.postgresql.jdbc1.AbstractJdbc1Statement.setString(AbstractJdbc1Statement.java:900)
> ...etc...
>
> Now, the problem seems to occur only intermittently, and will 'repair'
> itself
> with no action on my part. It does however, seem to occur in clumps - it
> will
> fail a few times in a short space of time before working again.
>
> I have created a statement at boot time for this purpose (it is a
> statement
> that gets used a lot, so I prefer to cache it), rather than create a new
> statement for each invocation. Some posts on the mailing list mention this
> as a problem (the backend shutting down the connection), but I have no
> idea
> how to control this behaviour.
>
> I don't seen to be able to reproduce this behaviour on demand; I have seen
> it in logs of a system that is running long-term, not just a development
> box
> that is working for a little bit at a time.
>
> It doesn't seem to be related to heavy loads on the system either - the
> load
> has been pretty light when it occurred.
>
> Has anybody else encountered this problem or had any success in dealing
> with it?
>
> PHiL
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: java.net.SocketException: Broken pipe
@ 2003-09-23 16:06 Barry Lind <blind@xythos.com>
0 siblings, 0 replies; 7+ messages in thread
From: Barry Lind @ 2003-09-23 16:06 UTC (permalink / raw)
To: Phil.Hourihane@meridianp2p.com; +Cc: pgsql-jdbc
Phil,
Phil.Hourihane@meridianp2p.com wrote:
>>Phil,
>>
>>A possible cause is a firewall or some other device between the client
>>and the server that drops connections after a certain time. (Most
>>firewall don't allow you to keep connections open indefinitely).
>>
>>thanks,
>>--Barry
>
>
> Thanks, Barrry, for your reply.
>
> Unfortunately, I don't think this is my problem.There is no firewall in
> place which would prevent a connection from lasting for any
> length of time. In fact, the statement that I am caching is built
> around a connection pool, so that the statement should not
> actually be using the same connection each time it is run at all.
>
Here is your problem. A statement object is owned by a connection. You
cannot cache statement objects across different connections. What will
actually happen is if you later use the statement, it will still be
using the connection that created it, even if you have returned that
connection back to the pool. What I suspect is happening is that your
connection pool is occasionally closing connections and it just so
happens that the connection closed is the one used by your cached
statement. If you want to cache a statement like this, you will also
need to cache the connection that goes with that statement.
thanks,
--Barry
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: java.net.SocketException: Broken pipe
@ 2003-09-24 13:25 Phil.Hourihane@meridianp2p.com
0 siblings, 0 replies; 7+ messages in thread
From: Phil.Hourihane@meridianp2p.com @ 2003-09-24 13:25 UTC (permalink / raw)
To: pgsql-jdbc; +Cc: Barry Lind <blind@xythos.com>
Thanks for the reply Barry.
I appreciate the thought you've put into this, and I'm going to switch out
the caching
and retain the use of the pool (rather than keep the caching and not use
the pool
for this problem).
So, thanks for your help
PHiL
^ permalink raw reply [nested|flat] 7+ messages in thread
* java.net.SocketException: Broken pipe
@ 2004-05-13 13:36 Reynir Þór Hübner <reynir@hugsmidjan.is>
0 siblings, 2 replies; 7+ messages in thread
From: Reynir Þór Hübner @ 2004-05-13 13:36 UTC (permalink / raw)
To: pgsql-jdbc
I'm running an engine with 15 databases, with fair amount of load.
Every 4-5 days I'm getting error like this from the java side and the
application stops working (and wont come back unless I restart the
webapplication):
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:110)
at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
at org.postgresql.PG_Stream.Send(PG_Stream.java:87)
at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:184)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:71)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:360)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:176)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:163)
at
org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162)
at
com.eplica.model.persistence.JDBCPersistenceHelper.findByUniqueSql(JDBCPersistenceHelper.java:704)
Does anyone know what this is about ?
I'm using Red hat Enterprise, and all the correct JDBC drivers etc,
using Jakarta DHCP connection pooling, and standard sql sentences.
thanx
-reynir
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: java.net.SocketException: Broken pipe
@ 2004-05-13 14:28 Dave Cramer <pg@fastcrypt.com>
parent: Reynir Þór Hübner <reynir@hugsmidjan.is>
1 sibling, 0 replies; 7+ messages in thread
From: Dave Cramer @ 2004-05-13 14:28 UTC (permalink / raw)
To: Reynir_Þór_Hübner <reynir@hugsmidjan.is>; +Cc: pgsql-jdbc
Generally speaking this is an issue with a firewall dropping the
connection, but given that you are using dbcp, I find this hard to
believe.
Do you have it setup to test for the connection, and to reap dead
connections ?
Dave
On Thu, 2004-05-13 at 09:36, Reynir_Þór_Hübner wrote:
> I'm running an engine with 15 databases, with fair amount of load.
>
> Every 4-5 days I'm getting error like this from the java side and the
> application stops working (and wont come back unless I restart the
> webapplication):
>
>
> java.net.SocketException: Broken pipe
> at java.net.SocketOutputStream.socketWrite0(Native Method)
> at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
> at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
> at java.io.BufferedOutputStream.write(BufferedOutputStream.java:110)
> at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
> at org.postgresql.PG_Stream.Send(PG_Stream.java:87)
> at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:184)
> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:71)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
> at
> org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:360)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
> at
> org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:176)
> at
> org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:163)
> at
> org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162)
> at
> com.eplica.model.persistence.JDBCPersistenceHelper.findByUniqueSql(JDBCPersistenceHelper.java:704)
>
>
>
> Does anyone know what this is about ?
> I'm using Red hat Enterprise, and all the correct JDBC drivers etc,
> using Jakarta DHCP connection pooling, and standard sql sentences.
>
> thanx
> -reynir
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
>
>
> !DSPAM:40a37c72108701489913165!
>
>
--
Dave Cramer
519 939 0336
ICQ # 14675561
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: java.net.SocketException: Broken pipe
@ 2004-05-13 14:43 Kris Jurka <books@ejurka.com>
parent: Reynir Þór Hübner <reynir@hugsmidjan.is>
1 sibling, 0 replies; 7+ messages in thread
From: Kris Jurka @ 2004-05-13 14:43 UTC (permalink / raw)
To: Reynir Þór Hübner <reynir@hugsmidjan.is>; +Cc: pgsql-jdbc
On Thu, 13 May 2004, [ISO-8859-1] Reynir Þór Hübner wrote:
> I'm running an engine with 15 databases, with fair amount of load.
>
> Every 4-5 days I'm getting error like this from the java side and the
> application stops working (and wont come back unless I restart the
> webapplication):
>
> java.net.SocketException: Broken pipe
What else is happening at this time? You shown the Java side of things,
but is there anything of note in the postgresql server logs? Possibly a
restart or crash occurs at this point?
Kris Jurka
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2004-05-13 14:43 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-22 12:43 java.net.SocketException: Broken pipe Phil.Hourihane@meridianp2p.com
2003-09-22 15:46 ` Barry Lind <blind@xythos.com>
2003-09-23 16:06 Re: java.net.SocketException: Broken pipe Barry Lind <blind@xythos.com>
2003-09-24 13:25 Re: java.net.SocketException: Broken pipe Phil.Hourihane@meridianp2p.com
2004-05-13 13:36 java.net.SocketException: Broken pipe Reynir Þór Hübner <reynir@hugsmidjan.is>
2004-05-13 14:28 ` Dave Cramer <pg@fastcrypt.com>
2004-05-13 14:43 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox