Bug 709817

Summary: iwhd initscript continues on in the face of failure
Product: [Retired] CloudForms Cloud Engine Reporter: Chris Lalancette <clalance>
Component: iwhdAssignee: jrd <jrd>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.3.1CC: dajohnso, deltacloud-maint, meyering, mkoci, ssachdev
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Here's a complete patch. none

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