Thread: Broken pipe

Broken pipe

From
Ben-Nes Yonatan
Date:
Hi all,

I sent the following email to the php mailing list also but maybe this
is a more appropriate mailing list.

I wrote a php script which is running very long queries (hours) on a
database.
I seem to have a problem to run the code when there are single queries
which take long times (like 5 hours for an update query), from the log
of the database I received the following code:

2005-09-30 17:12:13 IDT postgres : LOG:  00000: duration: 18730038.678
ms  statement: UPDATE product_temp SET nleft=(SELECT
2005-09-30 17:12:13 IDT postgres : LOCATION:  exec_simple_query,
postgres.c:1035
2005-09-30 17:12:13 IDT postgres : LOG:  08006: could not send data to
client: Broken pipe
2005-09-30 17:12:13 IDT postgres : LOCATION:  internal_flush, pqcomm.c:1050
2005-09-30 17:12:13 IDT postgres : LOG:  08P01: unexpected EOF on client
connection
2005-09-30 17:12:13 IDT postgres : LOCATION:  SocketBackend, postgres.c:287
2005-09-30 17:12:13 IDT postgres : LOG:  00000: disconnection: session
time: 6:04:58.52
2005-09-30 17:12:13 IDT postgres : LOCATION:  log_disconnections,
postgres.c:3403

Now after the 5 hours update it need to echo into a log file a line
which say that it ended this command (just for me to know the times), my
assumption is that PHP read the code into memory at start and opened the
connection to the file, after a time which he waited to any given "life
sign" he gave up and closed the connection to the file, and when the
code came back to the file it encountered no connection to the file
(broken pipe).

Am I correct at my assumption? if so how can I set the PHP to wait how
much I tell him?
Ofcourse if im wrong I would like to know the reason also :)


Thanks in advance,
  Ben-Nes Yonatan


Re: Broken pipe

From
Tom Lane
Date:
Ben-Nes Yonatan <nimrod@canaan.co.il> writes:
> I seem to have a problem to run the code when there are single queries
> which take long times (like 5 hours for an update query), from the log
> of the database I received the following code:

> 2005-09-30 17:12:13 IDT postgres : LOG:  08006: could not send data to
> client: Broken pipe

You should install some logging on the client side so you can see what
the client code thinks happened.

If there is a firewall between the database and the client process, one
possibility is that the firewall is timing out the connection.

            regards, tom lane

Re: Broken pipe

From
Nirmalya Lahiri
Date:
Hi all,
 I am not expert in PHP, so my assumption may not correct....
 Can we solve this problem by increasing the "max_execution_time"
value at php.ini file?

--Nirmalya


--- Ben-Nes Yonatan <nimrod@canaan.co.il> wrote:

> Hi all,
>
> I sent the following email to the php mailing list also but maybe
> this
> is a more appropriate mailing list.
>
> I wrote a php script which is running very long queries (hours) on
> a
> database.
> I seem to have a problem to run the code when there are single
> queries
> which take long times (like 5 hours for an update query), from the
> log
> of the database I received the following code:
>
> 2005-09-30 17:12:13 IDT postgres : LOG:  00000: duration:
> 18730038.678
> ms  statement: UPDATE product_temp SET nleft=(SELECT
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  exec_simple_query,
> postgres.c:1035
> 2005-09-30 17:12:13 IDT postgres : LOG:  08006: could not send data
> to
> client: Broken pipe
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  internal_flush,
> pqcomm.c:1050
> 2005-09-30 17:12:13 IDT postgres : LOG:  08P01: unexpected EOF on
> client
> connection
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  SocketBackend,
> postgres.c:287
> 2005-09-30 17:12:13 IDT postgres : LOG:  00000: disconnection:
> session
> time: 6:04:58.52
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  log_disconnections,
> postgres.c:3403
>
> Now after the 5 hours update it need to echo into a log file a line
> which say that it ended this command (just for me to know the
> times), my
> assumption is that PHP read the code into memory at start and
> opened the
> connection to the file, after a time which he waited to any given
> "life
> sign" he gave up and closed the connection to the file, and when
> the
> code came back to the file it encountered no connection to the file
> (broken pipe).
>
> Am I correct at my assumption? if so how can I set the PHP to wait
> how
> much I tell him?
> Ofcourse if im wrong I would like to know the reason also :)
>
>
> Thanks in advance,
>   Ben-Nes Yonatan
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>




__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

Re: Broken pipe

From
Ben-Nes Yonatan
Date:
----- Original Message -----
From: "Nirmalya Lahiri" <nirmalyalahiri@yahoo.com>
To: <pgsql-general@postgresql.org>
Sent: Sunday, October 02, 2005 7:34 PM
Subject: Re: [GENERAL] Broken pipe


Hi all,
 I am not expert in PHP, so my assumption may not correct....
 Can we solve this problem by increasing the "max_execution_time"
value at php.ini file?

--Nirmalya


--- Ben-Nes Yonatan <nimrod@canaan.co.il> wrote:

> Hi all,
>
> I sent the following email to the php mailing list also but maybe
> this
> is a more appropriate mailing list.
>
> I wrote a php script which is running very long queries (hours) on
> a
> database.
> I seem to have a problem to run the code when there are single
> queries
> which take long times (like 5 hours for an update query), from the
> log
> of the database I received the following code:
>
> 2005-09-30 17:12:13 IDT postgres : LOG:  00000: duration:
> 18730038.678
> ms  statement: UPDATE product_temp SET nleft=(SELECT
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  exec_simple_query,
> postgres.c:1035
> 2005-09-30 17:12:13 IDT postgres : LOG:  08006: could not send data
> to
> client: Broken pipe
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  internal_flush,
> pqcomm.c:1050
> 2005-09-30 17:12:13 IDT postgres : LOG:  08P01: unexpected EOF on
> client
> connection
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  SocketBackend,
> postgres.c:287
> 2005-09-30 17:12:13 IDT postgres : LOG:  00000: disconnection:
> session
> time: 6:04:58.52
> 2005-09-30 17:12:13 IDT postgres : LOCATION:  log_disconnections,
> postgres.c:3403
>
> Now after the 5 hours update it need to echo into a log file a line
> which say that it ended this command (just for me to know the
> times), my
> assumption is that PHP read the code into memory at start and
> opened the
> connection to the file, after a time which he waited to any given
> "life
> sign" he gave up and closed the connection to the file, and when
> the
> code came back to the file it encountered no connection to the file
> (broken pipe).
>
> Am I correct at my assumption? if so how can I set the PHP to wait
> how
> much I tell him?
> Ofcourse if im wrong I would like to know the reason also :)
>
>
> Thanks in advance,
>   Ben-Nes Yonatan
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

Well I set the max_execution_time to 0 which is supposed to be endlessly,
but I think that after sometime even that get closed.....
I really dont know if its a postgresql problem or php....

Shana Tova! (hebrew happy new year :))
  Ben-Nes Yonatan




Re: Broken pipe

From
Nirmalya Lahiri
Date:
OK..change another thing and try again.....
1> Increase "Timeout" value in the file "/etc/httpd/conf/httpd.conf".
2> Restart http server by "/sbin/service httpd restart" command.
3> Now run your PHP script again.

 I think the problem is not in PostgreSQL, the problem is somewhere
in PHP or http server. OK..lets try the process written above. I am
waiting for your reply.

--Nirmalya


--- Ben-Nes Yonatan <da@canaan.co.il> wrote:

> ----- Original Message -----
> From: "Nirmalya Lahiri" <nirmalyalahiri@yahoo.com>
> To: <pgsql-general@postgresql.org>
> Sent: Sunday, October 02, 2005 7:34 PM
> Subject: Re: [GENERAL] Broken pipe
>
>
> Hi all,
>  I am not expert in PHP, so my assumption may not correct....
>  Can we solve this problem by increasing the "max_execution_time"
> value at php.ini file?
>
> --Nirmalya
>
>
> --- Ben-Nes Yonatan <nimrod@canaan.co.il> wrote:
>
> > Hi all,
> >
> > I sent the following email to the php mailing list also but maybe
> > this
> > is a more appropriate mailing list.
> >
> > I wrote a php script which is running very long queries (hours)
> on
> > a
> > database.
> > I seem to have a problem to run the code when there are single
> > queries
> > which take long times (like 5 hours for an update query), from
> the
> > log
> > of the database I received the following code:
> >
> > 2005-09-30 17:12:13 IDT postgres : LOG:  00000: duration:
> > 18730038.678
> > ms  statement: UPDATE product_temp SET nleft=(SELECT
> > 2005-09-30 17:12:13 IDT postgres : LOCATION:  exec_simple_query,
> > postgres.c:1035
> > 2005-09-30 17:12:13 IDT postgres : LOG:  08006: could not send
> data
> > to
> > client: Broken pipe
> > 2005-09-30 17:12:13 IDT postgres : LOCATION:  internal_flush,
> > pqcomm.c:1050
> > 2005-09-30 17:12:13 IDT postgres : LOG:  08P01: unexpected EOF on
> > client
> > connection
> > 2005-09-30 17:12:13 IDT postgres : LOCATION:  SocketBackend,
> > postgres.c:287
> > 2005-09-30 17:12:13 IDT postgres : LOG:  00000: disconnection:
> > session
> > time: 6:04:58.52
> > 2005-09-30 17:12:13 IDT postgres : LOCATION:  log_disconnections,
> > postgres.c:3403
> >
> > Now after the 5 hours update it need to echo into a log file a
> line
> > which say that it ended this command (just for me to know the
> > times), my
> > assumption is that PHP read the code into memory at start and
> > opened the
> > connection to the file, after a time which he waited to any given
> > "life
> > sign" he gave up and closed the connection to the file, and when
> > the
> > code came back to the file it encountered no connection to the
> file
> > (broken pipe).
> >
> > Am I correct at my assumption? if so how can I set the PHP to
> wait
> > how
> > much I tell him?
> > Ofcourse if im wrong I would like to know the reason also :)
> >
> >
> > Thanks in advance,
> >   Ben-Nes Yonatan
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
>
> Well I set the max_execution_time to 0 which is supposed to be
> endlessly,
> but I think that after sometime even that get closed.....
> I really dont know if its a postgresql problem or php....
>
> Shana Tova! (hebrew happy new year :))
>   Ben-Nes Yonatan
>
>
>
>




__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com