Re: [Spacewalk-list] SQL error in SSM after update to 2.9

2019-02-11 Thread Hailer, Christian
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hello all,

it was easier than expected :) 

The XML file containing the statements is included in /usr/share/rhn/lib/rhn.jar

I extracted it, removed the trailing semicolon from 
com/redhat/rhn/common/db/datasource/xml/System_queries.xml (line 2235), 
recreated the JAR archive and restarted Spacewalk.

The problem is now gone :D

I created a pull request in the Spacewalk Github repository:

https://github.com/spacewalkproject/spacewalk/pull/686

Regards, Christian

- -Ursprüngliche Nachricht-
Von: spacewalk-list-boun...@redhat.com  Im 
Auftrag von Hailer, Christian
Gesendet: Montag, 11. Februar 2019 11:14
An: spacewalk-list@redhat.com
Betreff: Re: [Spacewalk-list] SQL error in SSM after update to 2.9

* PGP Signed: 02/11/2019 at 11:14:30 AM

Hi Paul-Andre,

thank you for your response! I did some further debugging and used p6spy to log 
the actual SQL statements before they are processed by the Oracle driver.

Here's what I've seen:

1549872508746|2|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet LEFT JOIN rhnServerEntitlementView ON rhnSet.element = 
rhnServerEntitlementView.server_id   WHERE rhnSet.user_id = ? AND 
rhnSet.label = ? AND (rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
?)|SELECT COUNT(*) as count   FROM rhnSet LEFT JOIN 
rhnServerEntitlementView ON rhnSet.element = rhnServerEntitlementView.server_id 
  WHERE rhnSet.user_id = 5 AND rhnSet.label = 'system_list' AND 
(rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
'enterprise_entitled')

1549872508755|4|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet LEFT JOIN rhnServerEntitlementView ON rhnSet.element = 
rhnServerEntitlementView.server_id   WHERE rhnSet.user_id = ? AND 
rhnSet.label = ? AND (rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
?)|SELECT COUNT(*) as count   FROM rhnSet LEFT JOIN 
rhnServerEntitlementView ON rhnSet.element = rhnServerEntitlementView.server_id 
  WHERE rhnSet.user_id = 5 AND rhnSet.label = 'system_list' AND 
(rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
'enterprise_entitled')

1549872508765|8|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet LEFT JOIN rhnServerEntitlementView ON rhnSet.element = 
rhnServerEntitlementView.server_id   WHERE rhnSet.user_id = ? AND 
rhnSet.label = ? AND (rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
?)|SELECT COUNT(*) as count   FROM rhnSet LEFT JOIN 
rhnServerEntitlementView ON rhnSet.element = rhnServerEntitlementView.server_id 
  WHERE rhnSet.user_id = 5 AND rhnSet.label = 'system_list' AND 
(rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
'enterprise_entitled')

1549872508786|14|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet   WHERE rhnSet.user_id = ? AND rhnSet.label = ? AND 
(   SELECT COUNT(*) FROM rhnServerFeaturesView 
WHERE rhnSet.element = rhnServerFeaturesView.server_id   AND 
rhnServerFeaturesView.label = ? ) = 0;|SELECT COUNT(*) as count   
FROM rhnSet   WHERE rhnSet.user_id = 5 AND rhnSet.label = 
'system_list' AND (   SELECT COUNT(*) FROM 
rhnServerFeaturesView WHERE rhnSet.element = 
rhnServerFeaturesView.server_id   AND rhnServerFeaturesView.label = 
'ftr_kickstart' ) = 0;

==> /var/log/tomcat6/catalina.out <==
2019-02-11 09:08:28,794 [TP-Processor1] ERROR 
com.redhat.rhn.common.db.datasource.CachedStatement - Error while processing 
cached statement sql: SELECT COUNT(*) as count
  FROM rhnSet
  WHERE
rhnSet.user_id = ? AND
rhnSet.label = ? AND (
  SELECT COUNT(*)
FROM rhnServerFeaturesView
WHERE rhnSet.element = rhnServerFeaturesView.server_id
  AND rhnServerFeaturesView.label = ?
) = 0;
com.redhat.rhn.com

Re: [Spacewalk-list] Continuing issues with ubuntu client and Spacewalk 2.9

2019-02-11 Thread Robert Paschedag
Am 11. Februar 2019 14:18:37 MEZ schrieb James Krych :
>Robert,
>
>I am still getting the emails from the Spacewalk Server complaining
>about
>diffs. Any hints on what I can do to stop it? I did ensure to disable
>diffs
>when I did an apt-get update.

You have to set it in the config file ..*not* on the command line.

Everytime you the spacewalk plugin runs, it uses the configuration files.

Robert
>
>Respectfully,
>
>James
>
>Exception reported from spacewalk
>Time: Mon Feb 11 04:26:58 2019
>Exception type 
>Exception while handling function repodata
>Request object information:
>URI: ///XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
>Remote Host: grouper-dev-loader-v.mdc.musc.edu
>Server Name: spacewalk.mdc.musc.edu:443
>Headers passed in:
>Accept-Encoding: identity
>CONTEXT_DOCUMENT_ROOT: /var/www/html
>CONTEXT_PREFIX:
>DOCUMENT_ROOT: /var/www/html
>GATEWAY_INTERFACE: CGI/1.1
>HTTP_ACCEPT_ENCODING: identity
>HTTP_HOST: spacewalk.mdc.musc.edu
>HTTP_X_RHN_AUTH: ypurldsBntWwk8h4ERfMaKIw7D5U8gkjnAWhhs0/Kyw=
>HTTP_X_RHN_AUTH_EXPIRE_OFFSET: 3600.0
>HTTP_X_RHN_AUTH_SERVER_TIME: 1549877217.79
>HTTP_X_RHN_AUTH_USER_ID:
>HTTP_X_RHN_SERVER_ID: 110001
>HTTP_X_RHN_TRANSPORT_CAPABILITY: follow-redirects=3
>Host: spacewalk.mdc.musc.edu
>PATH_INFO: /GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
>PATH_TRANSLATED:
>/var/www/html/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
>QUERY_STRING:
>REMOTE_ADDR: 128.23.182.201
>REMOTE_PORT: 37160
>REQUEST_METHOD: GET
>REQUEST_SCHEME: https
>REQUEST_URI:
>///XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
>SCRIPT_FILENAME: /usr/share/rhn/wsgi/xmlrpc.py
>SCRIPT_NAME: /XMLRPC
>SCRIPT_URI:
>https://spacewalk.mdc.musc.edu/XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
>SCRIPT_URL:
>/XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
>SERVER_ADDR: 128.23.191.174
>SERVER_ADMIN: root@localhost
>SERVER_NAME: spacewalk.mdc.musc.edu
>SERVER_PORT: 443
>SERVER_PROTOCOL: HTTP/1.1
>SERVER_SIGNATURE:
>SERVER_SOFTWARE: Apache
>UNIQUE_ID: XGE-4kPmPEtzDHi66YmkFAE
>X-RHN-Auth: ypurldsBntWwk8h4ERfMaKIw7D5U8gkjnAWhhs0/Kyw=
>X-RHN-Auth-Expire-Offset: 3600.0
>X-RHN-Auth-Server-Time: 1549877217.79
>X-RHN-Auth-User-Id:
>X-RHN-Server-Id: 110001
>X-RHN-Transport-Capability: follow-redirects=3
>mod_wsgi.application_group: spacewalk.mdc.musc.edu|/xmlrpc
>mod_wsgi.callable_object: application
>mod_wsgi.enable_sendfile: 0
>mod_wsgi.handler_script:
>mod_wsgi.input_chunked: 0
>mod_wsgi.listener_host:
>mod_wsgi.listener_port: 443
>mod_wsgi.process_group:
>mod_wsgi.queue_start: 1549877218030134
>mod_wsgi.request_handler: wsgi-script
>mod_wsgi.script_reloading: 1
>mod_wsgi.version: (3, 4)
>wsgi.errors: 
>wsgi.file_wrapper: mod_wsgi.Adapter object at 0x7f505871b0a8>
>wsgi.input: 
>wsgi.multiprocess: True
>wsgi.multithread: False
>wsgi.run_once: False
>wsgi.url_scheme: https
>wsgi.version: (1, 0)
>Extra information about this error:
>Response sent back to the caller:
>While running 'repodata': caught
> : repodata() takes exactly 2 arguments (3
>given)
>
>
>
>Exception Handler Information
>Traceback (most recent call last):
>  File
>"/usr/lib/python2.7/site-packages/spacewalk/server/apacheRequest.py",
>line
>135, in call_function
>response = func(*params)
>TypeError: repodata() takes exactly 2 arguments (3 given)
>
>Local variables by frame
>Frame call_function in
>/usr/lib/python2.7/site-packages/spacewalk/server/apacheRequest.py at
>line
>154
>   fault =  1
>self = 
>0x7f50526497e8>
>  force_rollback =  1
>  method =  repodata
>  exctype =  
> params =  ('Packages.diff', 'Index')
>   e_type =  
>func =  Repository.repodata of instance
>at 0x7f505226cc68>>
> e_value =  repodata()
>takes exactly 2 arguments (3 given)
>  response =  running 'repodata': caught\n : repodata()
>takes exactly 2 arguments (3 given)\n">
>
>Frame process in
>/usr/lib/python2.7/site-packages/spacewalk/server/apacheRequest.py at
>line
>593
>self = 
>0x7f50526497e8>
> params =  ('Packages.diff', 'Index')
>  method =  repodata
>
>Frame handler in
>/usr/lib/python2.7/site-packages/spacewalk/server/apacheHandler.py at
>line
>203
>   h = 
>0x7f5052649908>
>self = 
>0x7f50569b9ab8>
>   

Re: [Spacewalk-list] Continuing issues with ubuntu client and Spacewalk 2.9

2019-02-11 Thread James Krych
Robert,

I am still getting the emails from the Spacewalk Server complaining about
diffs. Any hints on what I can do to stop it? I did ensure to disable diffs
when I did an apt-get update.

Respectfully,

James

Exception reported from spacewalk
Time: Mon Feb 11 04:26:58 2019
Exception type 
Exception while handling function repodata
Request object information:
URI: ///XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
Remote Host: grouper-dev-loader-v.mdc.musc.edu
Server Name: spacewalk.mdc.musc.edu:443
Headers passed in:
Accept-Encoding: identity
CONTEXT_DOCUMENT_ROOT: /var/www/html
CONTEXT_PREFIX:
DOCUMENT_ROOT: /var/www/html
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT_ENCODING: identity
HTTP_HOST: spacewalk.mdc.musc.edu
HTTP_X_RHN_AUTH: ypurldsBntWwk8h4ERfMaKIw7D5U8gkjnAWhhs0/Kyw=
HTTP_X_RHN_AUTH_EXPIRE_OFFSET: 3600.0
HTTP_X_RHN_AUTH_SERVER_TIME: 1549877217.79
HTTP_X_RHN_AUTH_USER_ID:
HTTP_X_RHN_SERVER_ID: 110001
HTTP_X_RHN_TRANSPORT_CAPABILITY: follow-redirects=3
Host: spacewalk.mdc.musc.edu
PATH_INFO: /GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
PATH_TRANSLATED:
/var/www/html/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
QUERY_STRING:
REMOTE_ADDR: 128.23.182.201
REMOTE_PORT: 37160
REQUEST_METHOD: GET
REQUEST_SCHEME: https
REQUEST_URI:
///XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
SCRIPT_FILENAME: /usr/share/rhn/wsgi/xmlrpc.py
SCRIPT_NAME: /XMLRPC
SCRIPT_URI:
https://spacewalk.mdc.musc.edu/XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
SCRIPT_URL:
/XMLRPC/GET-REQ/ubuntu_16_security/repodata/Packages.diff/Index
SERVER_ADDR: 128.23.191.174
SERVER_ADMIN: root@localhost
SERVER_NAME: spacewalk.mdc.musc.edu
SERVER_PORT: 443
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE:
SERVER_SOFTWARE: Apache
UNIQUE_ID: XGE-4kPmPEtzDHi66YmkFAE
X-RHN-Auth: ypurldsBntWwk8h4ERfMaKIw7D5U8gkjnAWhhs0/Kyw=
X-RHN-Auth-Expire-Offset: 3600.0
X-RHN-Auth-Server-Time: 1549877217.79
X-RHN-Auth-User-Id:
X-RHN-Server-Id: 110001
X-RHN-Transport-Capability: follow-redirects=3
mod_wsgi.application_group: spacewalk.mdc.musc.edu|/xmlrpc
mod_wsgi.callable_object: application
mod_wsgi.enable_sendfile: 0
mod_wsgi.handler_script:
mod_wsgi.input_chunked: 0
mod_wsgi.listener_host:
mod_wsgi.listener_port: 443
mod_wsgi.process_group:
mod_wsgi.queue_start: 1549877218030134
mod_wsgi.request_handler: wsgi-script
mod_wsgi.script_reloading: 1
mod_wsgi.version: (3, 4)
wsgi.errors: 
wsgi.file_wrapper: 
wsgi.input: 
wsgi.multiprocess: True
wsgi.multithread: False
wsgi.run_once: False
wsgi.url_scheme: https
wsgi.version: (1, 0)
Extra information about this error:
Response sent back to the caller:
While running 'repodata': caught
 : repodata() takes exactly 2 arguments (3
given)



Exception Handler Information
Traceback (most recent call last):
  File
"/usr/lib/python2.7/site-packages/spacewalk/server/apacheRequest.py", line
135, in call_function
response = func(*params)
TypeError: repodata() takes exactly 2 arguments (3 given)

Local variables by frame
Frame call_function in
/usr/lib/python2.7/site-packages/spacewalk/server/apacheRequest.py at line
154
   fault =  1
self = 

  force_rollback =  1
  method =  repodata
 exctype =  
  params =  ('Packages.diff', 'Index')
  e_type =  
func =  >
 e_value =  repodata()
takes exactly 2 arguments (3 given)
response =   : repodata()
takes exactly 2 arguments (3 given)\n">

Frame process in
/usr/lib/python2.7/site-packages/spacewalk/server/apacheRequest.py at line
593
self = 

  params =  ('Packages.diff', 'Index')
  method =  repodata

Frame handler in
/usr/lib/python2.7/site-packages/spacewalk/server/apacheHandler.py at line
203
   h = 

self = 

 req = 

 ret =  1
 templateStrings =  {'email_account_info':
'\nAccount Information:\n  Your Spacewalk login: \n  Your
Spacewalk email address: ', 'email_footer': '--the
Spacewalk Team', 'hostname': 'spacewalk.mdc.musc.edu'}
 row =  None

Frame handle in /usr/share/rhn/wsgi/wsgiHandler.py at line 44
replacements =  {'Xml': 'XML', 'Actualuri':
'ActualURI', 'Md5Sum': 'MD5sum', '_': '-', 'Rhn': 'RHN'}
  co

Re: [Spacewalk-list] SQL error in SSM after update to 2.9

2019-02-11 Thread Hailer, Christian
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi Paul-Andre,

thank you for your response! I did some further debugging and used p6spy to log 
the actual SQL statements before they are processed by the Oracle driver.

Here's what I've seen:

1549872508746|2|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet LEFT JOIN rhnServerEntitlementView ON rhnSet.element = 
rhnServerEntitlementView.server_id   WHERE rhnSet.user_id = ? AND 
rhnSet.label = ? AND (rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
?)|SELECT COUNT(*) as count   FROM rhnSet LEFT JOIN 
rhnServerEntitlementView ON rhnSet.element = rhnServerEntitlementView.server_id 
  WHERE rhnSet.user_id = 5 AND rhnSet.label = 'system_list' AND 
(rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
'enterprise_entitled')

1549872508755|4|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet LEFT JOIN rhnServerEntitlementView ON rhnSet.element = 
rhnServerEntitlementView.server_id   WHERE rhnSet.user_id = ? AND 
rhnSet.label = ? AND (rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
?)|SELECT COUNT(*) as count   FROM rhnSet LEFT JOIN 
rhnServerEntitlementView ON rhnSet.element = rhnServerEntitlementView.server_id 
  WHERE rhnSet.user_id = 5 AND rhnSet.label = 'system_list' AND 
(rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
'enterprise_entitled')

1549872508765|8|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet LEFT JOIN rhnServerEntitlementView ON rhnSet.element = 
rhnServerEntitlementView.server_id   WHERE rhnSet.user_id = ? AND 
rhnSet.label = ? AND (rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
?)|SELECT COUNT(*) as count   FROM rhnSet LEFT JOIN 
rhnServerEntitlementView ON rhnSet.element = rhnServerEntitlementView.server_id 
  WHERE rhnSet.user_id = 5 AND rhnSet.label = 'system_list' AND 
(rhnServerEntitlementView.is_base IS NULL OR 
rhnServerEntitlementView.is_base = 'Y') AND 
(rhnServerEntitlementView.label IS NULL OR rhnServerEntitlementView.label <> 
'enterprise_entitled')

1549872508786|14|statement|connection 4|url 
jdbc:p6spy:oracle:oci:@//DB-FQDN/SCHEMA|SELECT COUNT(*) as count   FROM 
rhnSet   WHERE rhnSet.user_id = ? AND rhnSet.label = ? AND 
(   SELECT COUNT(*) FROM rhnServerFeaturesView 
WHERE rhnSet.element = rhnServerFeaturesView.server_id   AND 
rhnServerFeaturesView.label = ? ) = 0;|SELECT COUNT(*) as count   
FROM rhnSet   WHERE rhnSet.user_id = 5 AND rhnSet.label = 
'system_list' AND (   SELECT COUNT(*) FROM 
rhnServerFeaturesView WHERE rhnSet.element = 
rhnServerFeaturesView.server_id   AND rhnServerFeaturesView.label = 
'ftr_kickstart' ) = 0;

==> /var/log/tomcat6/catalina.out <==
2019-02-11 09:08:28,794 [TP-Processor1] ERROR 
com.redhat.rhn.common.db.datasource.CachedStatement - Error while processing 
cached statement sql: SELECT COUNT(*) as count
  FROM rhnSet
  WHERE
rhnSet.user_id = ? AND
rhnSet.label = ? AND (
  SELECT COUNT(*)
FROM rhnServerFeaturesView
WHERE rhnSet.element = rhnServerFeaturesView.server_id
  AND rhnServerFeaturesView.label = ?
) = 0;
com.redhat.rhn.common.db.WrappedSQLException: ORA-00933: SQL command not 
properly ended


As you can see, the first 3 statements are processed without any problems, but 
the 4th one is reported as "not properly ended". This one is the only one using 
a ";" at the end.
I looked up the source code, and the mentioned statement is the only one with a 
semicolon at the end:

https://github.com/spacewalkproject/spacewalk/blob/SPACEWALK-2.9/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml#L2235

The responsible commit was added with version 2.9, and maybe the Postgres 
driver doesn't complain about the extra semicolon, so no one else reported 
something similar as I'm the only one using Oracle? :)

I'll try to find the Java class using the statement a