Subject: runaway pine processes eat cpu

From: [email-masked] (Jenny Barna)
Date: 19 Dec 1995 11:47:39 GMT

We have occasional problems with pine 3.89 on IRIX 5.2 where users'
PCs etc hang while in a pine session. Later, the sysadmin notices
pine processes consuming vast amounts of cpu. From the users'
points of view there are no errors and when they login again
they innocently start a new pine process. It is possible this
is not a pine-specific problem as occasionally other programs produce
runaway processes. I note that we had to alter two routines when
compiling pine on this system viz in ttyin and ttyout termname was
not used but was replaced by mytermname to avoid a clash. 
I previously had pine (3.87?) installed on a SunOS 4 machine without
noticing this problem. Again, this may be fortuitous. I have a suspicion
that the problem we are seeing now is very much associated with terminal
input.  Has anyone any idea what to do about this, including
possibly a suitable process-killing daemon or else code alterations?

Thank you!
-- 
Jenny Barna                      | Internet [email-masked] 
Department of Biochemistry       | Telephone (Office) +44 1223 333596
Tennis Court Road                | FAX       (Dept)   +44 1223 333345
Cambridge, CB2 1QW, UK           | Telephone (Dept)   +44 1223 333600

---

From: Mike Brudenell <[email-masked]>
Date: Wed, 20 Dec 1995 09:12:50 +0000 (GMT)

On 19 Dec 1995, Jenny Barna wrote:

> pine processes consuming vast amounts of cpu.
	... [SNIP!] ...
> Has anyone any idea what to do about this, including

Sure thing... try upgrading to the current version of Pine!

We, too, had the occasional problem with runaway Pine 3.89 sessions.  The 
problem, as far as I recall, was a small bug in the C-client library of 
routines (the problem also affected imapd's as well I think).

However, after Piune 3.89 came 3.90, followed by the current 3.91.  
Indeed, this has been around for a _long_ time now (a year or so) and is 
well worth the upgrade.

Cheers,

Mike Brudenell                                         <[email-masked]>
------------------------------------------------------------------------
The Computing Service, University of York, Heslington, York, YO1 5DD, UK
Tel: +44-1904-433811  FAX: +44-1904-433740  http://www.york.ac.uk/~pmb1/

---

From: Alessandro Miotto <[email-masked]>
Date: Wed, 20 Dec 1995 11:39:44 GMT

> Sure thing... try upgrading to the current version of Pine!

Nice attempt, but the same happens in pine 3.91 and also in a lot of X11 programs.
The problem is a select call returning data present in a socket, and the following 
read call returning 0 bytes read and no error. The program continues ad libitum 
in this loop.

	Alessandro

---------------------------------------------------------------------------
 Alessandro Miotto - CN/DCI/UES      | Tel:    +41 22 767 9576
 CERN - European Laboratory          | Fax:    +41 22 767 7155
 for Particle Physics                | E-mail: [email-masked]
 CH-1211 Geneve 23                   |

---

From: Mike Brudenell <[email-masked]>
Date: Wed, 20 Dec 1995 14:09:39 +0000 (GMT)

It was a nicer try than you seem to think... although we were getting 3 
or 4 runaway Pine 3.89 processes a week, I don't think we've seen a 
single Pine 3.91 runaway over the year or so we've had it.  Could be 
difference in platforms, could just be luck?

Cheers,

---

From: Carolynn Seeley <[email-masked]>
Date: Wed, 20 Dec 1995 10:49:19 -0500 (EST)

Does anyone have a fix for this problem?  We have upgraded to PINE 3.91 
from 3.89 on one system and 3.88 on another.  The Solaris is the one 
exhibiting this SAME problem.  Unfortunately, it shoots our load average 
up and then the system refuses access to PoP mailers. Argh. BIG headaches. 
Can anyone help me or suggest something?

> > Cheers, > 

-------------------------------------------------------------------------------
Carolynn Seeley                     email:  [email-masked]
Consultant, Office Systems Support          [email-masked]
PINE Administrator
Computing and Information Services     
McMaster University, ABB-132
------------------------------------------------------------------------------

---

From: [email-masked] (david hayes)
Date: 21 Dec 1995 15:42:17 GMT

[ lots of stuff snipped ]

we also have a problem with runaway pines eating tons of cpu cycles. 
(we're using pine 3.91 on aix 3.2.5.  as an aside, we didn't have the
problem with pine 3.89.)

to minimize the effects of this, i run a script every 15 minutes that sees
how much cpu time each pine session has used.  if it's over 2:00 minutes,
the session gets killed.  it's a crude solution, but it works. 

happy holidays!

--david

---

From: [email-masked] (Trey Harris)
Date: 20 Dec 1995 17:50:16 GMT

In article <[email-masked]>,
>difference in platforms, could just be luck?

I think not.  My site had the same experience with Unix Pine.  Under 3.89
I would see seven to ten looping Pine processes per day (on a system where
around 3,000 Pine sessions are started per day).  In the past year we've
had 3.91 I can only recall isolated cases where Pine hung, and all were
due to pretty obvious things (e.g., IMAP server or home directory
fileserver going down). 

The problem we're still waiting for (I understand this is already fixed 
in current UW internal versions of Pine 3.92) is where, under AIX (and a 
few other OSs) some unclean disconnections result in a zero-length 
~/.pine-interrupted-mail file (which can in turn result in 
~/.pine-interrupted-mail-lock* files).

A zero-length file is a legal Berkeley ("From "-delimited) mailbox, and
the ~/.pine-interrupted-mail file is stored in that format.  However, Pine
warns the user upon each compose that there is interrupted mail, and then 
if the user agrees to continue it, Pine starts to spit out error 
messages.  In some cases it can go into a loop and hang or dump core.

On my machines, if I look at the hardware error logs (which under AIX
includes some firmware and kernel errors as well), any errors which I
might find interesting are drowned out by the logs of fifty or more Pine
coredumps every day. 

*Very* much looking forward to 3.92 here. :)
-- 
Trey Harris                             http://sunsite.unc.edu/harris/
  System Administrator, Project Isis, Office of Information Technology
                       The University of North Carolina at Chapel Hill

---

From: [email-masked] (Steve Howie)
Date: 20 Dec 1995 14:50:32 GMT

Mike Brudenell ([email-masked]) wrote:
: On 19 Dec 1995, Jenny Barna wrote:
: 
: > We have occasional problems with pine 3.89 on IRIX 5.2 where users'
: > PCs etc hang while in a pine session. Later, the sysadmin notices
: > pine processes consuming vast amounts of cpu.
: 	... [SNIP!] ...
: > Has anyone any idea what to do about this, including
: > possibly a suitable process-killing daemon or else code alterations?
: 
: Sure thing... try upgrading to the current version of Pine!
: 
: We, too, had the occasional problem with runaway Pine 3.89 sessions.  The 
: problem, as far as I recall, was a small bug in the C-client library of 
: routines (the problem also affected imapd's as well I think).
: 
: However, after Piune 3.89 came 3.90, followed by the current 3.91.  
: Indeed, this has been around for a _long_ time now (a year or so) and is 
: well worth the upgrade.
: 

I also found if you are running Unix Pine 3.91, and start it on a screen
where for some reason the environment variables LINES and COLUMNS set to
wierd values such as LINES=1 and COLUMNS=1, or LINES =231 and COLUMNS=231,
then Pine will Loop when it tries to open the main screen. 

This can be a problem on HP systems, because the command 'ttytype' is 
busted under certain circumstances.

-- 
Scotty 
=================================================================
Steve Howie                             Email:  [email-masked]
NetNews and Gopher Admin.               Phone:  (519) 824-4120 x2556
Computing and Communications Svcs.      Fax:    (519) 763-6143
University of Guelph

If it's not Scottish its CRRRRRAAAAAAAAAAAAAAPPPPP
=================================================================

---

From: [email-masked] (Bob Rahe)
Date: 28 Dec 1995 19:24:02 GMT

In article <[email-masked]>,

>read call returning 0 bytes read and no error. The program continues ad libitum 

  I've implemented this patch and I haven't seen a runaway pine since - over
many (4 or so) months:

From: [email-masked] (Sean Vickery)
Newsgroups: comp.mail.pine
Subject: Runaway Pine bug solved, patch included
Date: 13 Aug 1995 23:15:19 -0700
Organization: PSGnet mail to news gate
Lines: 69
Sender: [email-masked]

[If you reply or followup to this, could you please Cc: me as I read neither
 pine-info nor comp.mail.pine.]

Fellow Pine users,

After some frustrating months of tracking down runaway Pine processes each
day and killing them by hand, I decided to find and fix the cause of the
problem in the Pine sources.

Some debugging revealed that the hanging Pines are doing a tight loop
in read_with_timeout().  The logic in this function is slightly awry;
it does not cater for read(terminal) returning zero bytes.  My patch is at
the end of this message;  it's a one-line fix.  Not one Pine has run away
since I patched them a week ago.  Before I patched Pine, I was getting
about one runaway Pine per day per machine on average.

I saw the problem only with Pine 3.91.  Pine 3.89, which we still use
on some of our machines, has never runaway on us.  Pine 3.91 was running
away on both Solaris 2.3 and 2.4.

If there are any Pine developers reading this, perhaps you could fix the
bug in the next release of Pine.

Cheers for now,
Sean.

-- 
Sean Vickery <[email-masked]>   Ph: +61 (0)7 3875 6410
Systems Programmer   Information Services   Griffith University
===================================================================
RCS file: /opt/cvs/pd/pine/pine/ttyin.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** 1.1.1.1	1995/01/13 00:16:30
--- 1.2	1995/08/14 05:57:29
***************
*** 1,5 ****
  #if !defined(lint) && !defined(DOS)
! static char rcsid[] = "$Id: ttyin.c,v 4.56 1994/10/11 22:53:43 mikes Exp $";
  #endif
  /*----------------------------------------------------------------------
  
--- 1,5 ----
  #if !defined(lint) && !defined(DOS)
! static char rcsid[] = "$Id: ttyin.c,v 1.1.1.1 1995/01/13 00:16:30 seanv Exp $";
  #endif
  /*----------------------------------------------------------------------
  
***************
*** 389,395 ****
           dprint(1, (debugfile, "\n\n** Error reading from tty : %s\n\n",
                  error_description(errno)));
  
!          if(errno == EINTR)
             return(NO_OP_COMMAND);
  
           if(ps_global->inbox_stream != NULL){
--- 389,395 ----
           dprint(1, (debugfile, "\n\n** Error reading from tty : %s\n\n",
                  error_description(errno)));
  
!          if(res < 0 && errno == EINTR)
             return(NO_OP_COMMAND);
  
           if(ps_global->inbox_stream != NULL){
-- 
Sean Vickery <[email-masked]>   Ph: +61 (0)7 3875 6410
Systems Programmer   Information Services   Griffith University

-- 
----------------------------------------------------------------------------
|Bob Rahe, Delaware Tech&Comm Coll.| The American Bald Eagle is protected  |
|Computer Center, Dover, Delaware| by law, the unborn American baby isn't. |
|Internet: [email-masked] | Some of our laws are really for the birds.|
----------------------------------------------------------------------------