Welcome to WebmasterWorld Guest from 54.167.58.159

Forum Moderators: bakedjake

Message Too Old, No Replies

what causes broken pipe?

     

newbies

8:37 am on Apr 26, 2004 (gmt 0)

10+ Year Member



Hi all,

I have a program which querys a romote database and distribute results thrugh email to users. I have been using it for quite a while. Recently it stopped working. When I ran it under shell I got broken pipe error after it has run about 2 min, but if I run it as root, it can run much longer (20 min) but still got broken pipe. I wonder what are causes of broken pipe?

I know that you can set up a time limit for user's process, if a process runs longer than the limit, it will get killed. Is the broken pipe the case?

thank you for your help.

Duckula

9:44 am on Apr 26, 2004 (gmt 0)

10+ Year Member



Use the search feature in this site, I already kinda answered that (what causes broken pipe?):

How to use tar for backing up the entire site...
[webmasterworld.com]

In your particular case you seem to have some kind of race condition. See what processes are involved in the race (which one "wins" the race and should have waited for the other one) through pstree or something. Then find a way to delay the winner or make it play nice with the other.

SeanW

1:01 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



A race condition is something else... It's when a non-atomic set of actions can be intercepted to affect the behaviour of the application. For instance, if I check for the existence of a file, and then create it if it doesn't exist, the time between the stat and the open is the race condition.

A broken pipe is like you said, except that it's specifically the input side of the pipe going away. ie, if you pump a bunch of data through more, and kill off more halfway through, the output side loses the file descriptor and gets killed with SIGPIPE.

Sean

Duckula

4:03 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



Hm, got them confused...

newbies

4:42 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



I am confused too.

How do you set up the time limit for which a user can run a process? I want to check that if it's the problem.

My program basically do two things, searching remote database and retrieving the results; sending results by email. Which process could be broken? The strange thing is the time before the pipe is broken is different for a user and a root user, with the latter being able to run the program much longer.

Duckula

5:36 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



If my memory doesn't fail me (again) that's reported using 'ulimit -a' (as root). Maybe you want the "cpu time" value.