Bug 709817 - iwhd initscript continues on in the face of failure
Summary: iwhd initscript continues on in the face of failure
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: CloudForms Cloud Engine
Classification: Retired
Component: iwhd
Version: 0.3.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
Assignee: jrd
QA Contact: wes hayutin
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-01 17:50 UTC by Chris Lalancette
Modified: 2016-04-27 02:59 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)
Here's a complete patch. (1.54 KB, patch)
2011-06-01 19:39 UTC, Jim Meyering
no flags Details | Diff

Description Chris Lalancette 2011-06-01 17:50:19 UTC
Description of problem:
In the iwhd start() function, one of the things it does is to check to make sure that mongo is running by trying to contact mongod.  If it contacts mongod, then everything is good and it goes on and starts iwhd.

The problem is that if mongod never responds, it prints an error and still goes on.  Because iwhd relies on mongo to do underlying operations, this is just setting iwhd up for failure.  If contacting mongod fails, the iwhd initscript probably wants to abort entirely, instead of setting things up in a halfway state.

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

How reproducible:
Always

Steps to Reproduce:
1.  service mongod stop
2.  service iwhd start
  
Actual results:
iwhd starts, but is poised to crash on most (all?) operations.

Expected results:
iwhd doesn't start unless mongod is running.

Comment 1 Jim Meyering 2011-06-01 18:01:48 UTC
Thanks for the report, Chris.
Here's the probable patch.  Does it solve your problem?

diff --git a/iwhd.init.in b/iwhd.init.in
index 59d4032..47f9ceb 100644
--- a/iwhd.init.in
+++ b/iwhd.init.in
@@ -73,7 +73,8 @@ start() {
     mkdir -p @localstatedir@/cache/iwhd
     rm -rf @localstatedir@/cache/iwhd/*
     printf %s $"waiting for mongod to listen on $MONGOD_SERVER_SPEC"
-    wait_for_mongod $MONGOD_N_SECONDS && echo_success || echo_failure
+    wait_for_mongod $MONGOD_N_SECONDS && echo_success \
+       || { echo_failure; echo; return 1; }
     echo

     printf %s $"Starting $SERVICE daemon: "

Comment 2 Jim Meyering 2011-06-01 19:39:39 UTC
Created attachment 502362 [details]
Here's a complete patch.

I've attached a complete patch.

Comment 3 Chris Lalancette 2011-06-02 12:30:18 UTC
Looks good to me.  And I see you have now committed it.  Thanks!

Chris Lalancette

Comment 4 Dave Johnson 2011-06-16 19:57:47 UTC
This is good to go in commit 9e86ebf939a68c37c04004e8248013aab8f8cbb9, moving to verified.

Comment 5 wes hayutin 2011-08-01 19:52:53 UTC
release pending...

Comment 6 wes hayutin 2011-08-01 19:55:18 UTC
release pending...

Comment 8 wes hayutin 2011-12-08 13:50:38 UTC
closing out old bugs

Comment 9 wes hayutin 2011-12-08 14:03:09 UTC
perm close


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