Bug 912774 - whiptail consumes 100% CPU
Summary: whiptail consumes 100% CPU
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: newt
Version: rawhide
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-19 15:59 UTC by Mario
Modified: 2013-02-25 10:36 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-02-25 10:36:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Handle newtGetKey() errors. (561 bytes, patch)
2013-02-22 13:32 UTC, Mario
no flags Details | Diff
Handle newtGetKey() errors. (562 bytes, patch)
2013-02-22 13:36 UTC, Mario
no flags Details | Diff

Description Mario 2013-02-19 15:59:30 UTC
Description of problem:

whiptail consumes 100% CPU when it loses TTY.

Version-Release number of selected component (if applicable):

0.53.14

How reproducible:

Run a background whiptail within a sub-shell, then close the terminal.  SIGHUP is not propagated (since its parent is now pid 1) and whiptail is not killed.

The steps used to reproduce do not represent legitimate use of whiptail just a reconstruction of the above condition.  Google seems to agree that this seems to be a common issue.

Example:
http://stackoverflow.com/questions/8784891/why-whiptail-is-consuming-100-of-my-cpu-on-fedora-on-ec2

Steps to Reproduce:
1. Open terminal
2. execute "( whiptail & ); exit"
3. check top
  
Actual results:

whiptail consumed 100% CPU and never quits

Expected results:

whiptail should quit or at least not consume 100% CPU.

Additional info:

Comment 1 Mario 2013-02-22 13:32:05 UTC
Created attachment 701192 [details]
Handle newtGetKey() errors.

After further investigation, I discovered that newtGetKey() is able to detect the loss of stdin and returns NEWT_KEY_ERROR when this happens.  This is clearly commented in newt.c and should, in my opinion, be handled by whiptail.

Comment 2 Mario 2013-02-22 13:36:04 UTC
Created attachment 701194 [details]
Handle newtGetKey() errors.

Comment 3 Miroslav Lichvar 2013-02-22 13:57:22 UTC
A similar code to what you propose is couple lines later after the newtGetKey() call, I'm wondering why it doesn't catch this.

Comment 4 Mario 2013-02-25 10:28:45 UTC
You are right.  The code was fixed in b8b8a86f back in late 2010 but my compilation was linking with the system libnewt.so which is older than that.

Sorry but I didn't realise the code was part of libnewt, not part of whiptail itself.

Comment 5 Miroslav Lichvar 2013-02-25 10:36:37 UTC
Ok, thanks for the response. I'm closing this bug.


Note You need to log in before you can comment on or make changes to this bug.