Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 836374

Summary: rhn-search daemon fails to connect to remote postgresql backend
Product: [Community] Spacewalk Reporter: Jorge Luis <redhat>
Component: ServerAssignee: Jan Pazdziora (Red Hat) <jpazdziora>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.7CC: jpazdziora, mmello, msuchy
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: spacewalk-search-1.8.5-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-01 16:18:08 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:
Bug Depends On:    
Bug Blocks: 871344    

Description Jorge Luis 2012-06-28 21:05:22 UTC
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:
Always 

Steps to Reproduce:
1. Install a remote postgresql database
2. Perform any search on spacewalk
3.
  
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 22:21:34 UTC
Fixing component by flipping to the correct product..

Comment 2 Jan Pazdziora (Red Hat) 2012-06-29 13:39:07 UTC
Fixed in Spacewalk master, 04c149159d050fc63fce5f2666c1b8882382e133.

Comment 3 Jorge Luis 2012-06-29 13:43:44 UTC
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 13:45:51 UTC
Nevermind,I just found it on git.

Comment 5 Jan Pazdziora (Red Hat) 2012-10-30 19:23:04 UTC
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 (Red Hat) 2012-11-01 16:18:08 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18