Bug 836374 - rhn-search daemon fails to connect to remote postgresql backend
rhn-search daemon fails to connect to remote postgresql backend
Product: Spacewalk
Classification: Community
Component: Server (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jan Pazdziora
Red Hat Satellite QA List
Depends On:
Blocks: space18
  Show dependency treegraph
Reported: 2012-06-28 17:05 EDT by Jorge Luis
Modified: 2012-11-01 12:18 EDT (History)
3 users (show)

See Also:
Fixed In Version: spacewalk-search-1.8.5-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-11-01 12:18:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jorge Luis 2012-06-28 17:05:22 EDT
Description of problem:
After changing the backend from a local OracleXE to a remote Postgresql rhn-search stopped working.

Although all spacewalk services work correctly with this backend, rhn-search daemon is unable to connect to the database.

This is the stack trace in the /var/log/rhn/search/rhn_search.log
[2012-06-28 17:04:33,273] ERROR - Caught exception: 
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:136)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)
        at org.postgresql.jdbc3g.Jdbc3gConnection.<init>(Jdbc3gConnection.java:24)
        at org.postgresql.Driver.makeConnection(Driver.java:393)
        at org.postgresql.Driver.connect(Driver.java:267)
        at java.sql.DriverManager.getConnection(DriverManager.java:620)
        at java.sql.DriverManager.getConnection(DriverManager.java:200)
I can send the rest of the stack if required

After some digging, I saw that the daemon tries to connect to a postgresql server on localhost, effectively ignoring the db_host parameter on /etc/rhn/rhn.conf to build the java connection URL

As a workaround I setup a xinetd server to redirect that port to the remote server and the daemon now works correctly.

Is it possible that this is a bug on rhn-search package?

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

How reproducible:

Steps to Reproduce:
1. Install a remote postgresql database
2. Perform any search on spacewalk
Actual results:
Fails to search, writes a traceback on the log

Expected results:
Correct search results

Additional info:
Comment 1 Marcelo Moreira de Mello 2012-06-28 18:21:34 EDT
Fixing component by flipping to the correct product..
Comment 2 Jan Pazdziora 2012-06-29 09:39:07 EDT
Fixed in Spacewalk master, 04c149159d050fc63fce5f2666c1b8882382e133.
Comment 3 Jorge Luis 2012-06-29 09:43:44 EDT
Is it possible to publish the diff file so that it can be backported to spacewalk 1.7?
Comment 4 Jorge Luis 2012-06-29 09:45:51 EDT
Nevermind,I just found it on git.
Comment 5 Jan Pazdziora 2012-10-30 15:23:04 EDT
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/
Comment 6 Jan Pazdziora 2012-11-01 12:18:08 EDT
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18

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