Bug 1473257

Summary: db-control sometimes fails with "Unable to connect to database to determine status. If database service started successfully, check configuration in rhn.conf."
Product: Red Hat Satellite 5 Reporter: Lukáš Hellebrandt <lhellebr>
Component: ServerAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED DEFERRED QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: dyordano, jhutar, lhellebr, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-09 15:34:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukáš Hellebrandt 2017-07-20 10:39:41 UTC
Description of problem:
db-control sometimes fails with
"""
Unable to connect to database to determine status.  If database service started successfully, check configuration in rhn.conf.
"""
This is not deterministic. I have tracked the reason to /usr/share/perl5/vendor_perl/Dobby/CLI/MiscCommands.pm , line 117, function command_startstop: "if ($state ne 'OPEN') {". The reason is $state being "OFFLINE". Most likely, postgresql still returns OFFLINE a few moments after starting thus making db-control fail. We should either use some other way to check DB's status or implement a few seconds of waiting for it to return ONLINE.

How reproducible:
Not deterministic, probably a timing issue

Steps to Reproduce:
1. In file /usr/share/perl5/vendor_perl/Dobby/CLI/MiscCommands.pm, put 'print "$state";' on a line 119.
2. while true; do db-control stop && db-control start; ret=$?; [ $ret -ne 0 ] && break; done
3. Wait
4. Wait
5. I was successful running this on 1 machine overnight.

Actual results:
db-control returns ret!=0 and complains (database is started successfully, however)

Expected results:
Database started successfully and without any complaining, db-control returns 0

Additional info:
This doesn't seem to be a regression

Comment 1 Tomas Lestach 2017-07-20 11:38:19 UTC
What Sat 5 version is this reported for?

Comment 2 Lukáš Hellebrandt 2017-07-20 11:51:32 UTC
The reproducer is nondeterministic so it's hard to say but I've only ever seen it on 5.8.

Comment 3 Tomas Lestach 2018-04-09 15:34:36 UTC
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog.

This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED. 

Closing now to help set customer expectations as early as possible. You are welcome to re-open this bug if needed.