Bug 658256 - "500 Error - Internal Server Error" when scheduling remote commands.
Summary: "500 Error - Internal Server Error" when scheduling remote commands.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: WebUI
Version: 1.2
Hardware: Unspecified
OS: Unspecified
low
high
Target Milestone: ---
Assignee: Lukas Zapletal
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space13
TreeView+ depends on / blocked
 
Reported: 2010-11-29 19:53 UTC by Ron Helzer
Modified: 2011-02-08 08:42 UTC (History)
2 users (show)

Fixed In Version: spacewalk-web-1.3.10-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 658085 658250 (view as bug list)
Environment:
Last Closed: 2011-02-08 08:42:26 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 658250 0 low CLOSED "500 Error - Internal Server Error" upon clicking "Use in SSM" button from System Groups page. 2021-02-22 00:41:40 UTC

Internal Links: 658250

Description Ron Helzer 2010-11-29 19:53:40 UTC
Description of problem:

The following exception occurred while executing this request:
 POST /network/systems/ssm/provisioning/remote_command_conf.pxt HTTP/1.1 (from browser)
 /network/systems/ssm/provisioning/remote_command_conf.pxt (from Apache)

Date:
  Mon Nov 29 14:46:43 2010

Headers:
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Accept-Encoding: gzip,deflate
  Accept-Language: en-us,en;q=0.5
  Connection: keep-alive
  Content-Length: 243
  Content-Type: application/x-www-form-urlencoded
  Cookie: pxt-session-cookie=4438xa5df2cfe34c510c76bb1929ad23ad0c6
  Host: spacewalk.hgvc.com
  Keep-Alive: 115
  Referer: https://spacewalk.hgvc.com/network/systems/ssm/provisioning/remote_command.pxt
  User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 (CK-IBM) Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E)

Form variables:
  am_pm => PM
  day => 29
  formvar_hmac => f8e03c11acfd609e5f9ce92657640bca60f9400c
  group => root
  hour => 2
  minute => 46
  mode => ssm
  month => 11
  schedule_remote_command => Schedule Remote Command
  script => #!/bin/sh
/bin/true
  timeout => 600
  username => root
  year => 2010

User Information:
  User rhelzer (id 1, org_id 1)

Error notes:
  (none)

Initial Request:
  Yes

Error message:
  RHN::Exception: DBD::Oracle::db prepare_cached failed: ORA-00904: "OV"."SERVER_ID": invalid identifier (DBD ERROR: error possibly near <*> indicator at char 704 in '
  SELECT  SERVER_ID AS ID, SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA, OUTDATED_PACKAGES, SERVER_NAME,
          SERVER_ADMINS, GROUP_COUNT, NOTE_COUNT, MODIFIED, CHANNEL_LABELS, CHANNEL_ID, HISTORY_COUNT,
          LAST_CHECKIN_DAYS_AGO, PENDING_UPDATES, OS, RELEASE, SERVER_ARCH_NAME, LAST_CHECKIN, LOCKED,
       ( SELECT  CASE
                   MAX(CASE PS.state WHEN 'OK' THEN 1 WHEN 'PENDING' THEN 2 WHEN 'UNKNOWN' THEN 3 WHEN 'WARNING' THEN 4 WHEN 'CRITICAL' THEN 5 END)
                         WHEN 1 THEN 'OK' WHEN 2 THEN 'PENDING' WHEN 3 THEN 'UNKNOWN' WHEN 4 THEN 'WARNING' WHEN 5 THEN 'CRITICAL' END ST
         FROM  rhn_probe_state PS
         LEFT OUTER JOIN rhn_check_probe CP ON <*>OV.server_id = CP.host_id
          WHERE  PS.probe_id = CP.probe_id
         GROUP BY OV.server_id ) MONITORING_STATUS,
       COALESCE((SELECT 1 FROM rhnServerFeaturesView SFV WHERE SFV.server_id = OV.server_id AND SFV.label = 'ftr_system_grouping'), 0) AS SELECTABLE
    FROM  rhnServerOverview OV
   WHERE  server_id IN (:p2, :p5, :p3, :p1, :p0, :p4, :p6)
ORDER BY  UPPER(NVL(SERVER_NAME, '(none)')), SERVER_ID
') [for Statement "
  SELECT  SERVER_ID AS ID, SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA, OUTDATED_PACKAGES, SERVER_NAME,
          SERVER_ADMINS, GROUP_COUNT, NOTE_COUNT, MODIFIED, CHANNEL_LABELS, CHANNEL_ID, HISTORY_COUNT,
          LAST_CHECKIN_DAYS_AGO, PENDING_UPDATES, OS, RELEASE, SERVER_ARCH_NAME, LAST_CHECKIN, LOCKED,
       ( SELECT  CASE
                   MAX(CASE PS.state WHEN 'OK' THEN 1 WHEN 'PENDING' THEN 2 WHEN 'UNKNOWN' THEN 3 WHEN 'WARNING' THEN 4 WHEN 'CRITICAL' THEN 5 END)
                         WHEN 1 THEN 'OK' WHEN 2 THEN 'PENDING' WHEN 3 THEN 'UNKNOWN' WHEN 4 THEN 'WARNING' WHEN 5 THEN 'CRITICAL' END ST
         FROM  rhn_probe_state PS
         LEFT OUTER JOIN rhn_check_probe CP ON OV.server_id = CP.host_id
          WHERE  PS.probe_id = CP.probe_id
         GROUP BY OV.server_id ) MONITORING_STATUS,
       COALESCE((SELECT 1 FROM rhnServerFeaturesView SFV WHERE SFV.server_id = OV.server_id AND SFV.label = 'ftr_system_grouping'), 0) AS SELECTABLE
    FROM  rhnServerOverview OV
   WHERE  server_id IN (:p2, :p5, :p3, :p1, :p0, :p4, :p6)
ORDER BY  UPPER(NVL(SERVER_NAME, '(none)')), SERVER_ID
"]
  RHN::DB /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB.pm 228 RHN::Exception::DB::throw
  RHN::DB::DataSource /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB/DataSource.pm 73 RHN::DB::handle_error
  RHN::DB::DataSource /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB/DataSource.pm 52 RHN::DB::DataSource::run_query
  RHN::DataSource /usr/lib/perl5/vendor_perl/5.8.8/RHN/DataSource.pm 144 RHN::DB::DataSource::run_complex_query
  Sniglets::ListView::List /usr/lib/perl5/vendor_perl/5.8.8/Sniglets/ListView/List.pm 1220 RHN::DataSource::elaborate
  Sniglets::ListView::List /usr/lib/perl5/vendor_perl/5.8.8/Sniglets/ListView/List.pm 908 Sniglets::ListView::List::default_provider
  Sniglets::Lists /usr/lib/perl5/vendor_perl/5.8.8/Sniglets/Lists.pm 119 Sniglets::ListView::List::render
  PXT::Parser /usr/lib/perl5/vendor_perl/5.8.8/PXT/Parser.pm 160 Sniglets::Lists::listview
  PXT::Parser /usr/lib/perl5/vendor_perl/5.8.8/PXT/Parser.pm 72 PXT::Parser::expand_tag
  PXT::ApacheHandler /usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm 522 PXT::Parser::expand_tags
  PXT::ApacheHandler /usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm 117 PXT::ApacheHandler::pxt_parse_data
  PXT::ApacheHandler /usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm 117 (eval)
  main -e 0 PXT::ApacheHandler::handler
  main -e 0 (eval)


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

1.2

How reproducible:

Every time.

Steps to Reproduce:
1. Attempt to schedule a remote command voa https://spacewalk.hgvc.com/network/systems/ssm/provisioning/remote_command.pxt
2. Receive "500 Error - Internal Server Error" from https://spacewalk.hgvc.com/network/systems/ssm/provisioning/remote_command_conf.pxt
  
Actual results:

No remote command scheduled.

Expected results:

Remote command scheduled.

Additional info:

Comment 1 Johan Segernäs 2010-11-30 14:51:53 UTC
Quick fix:
Change line 1036 in System_queries.xml from:
"FROM  rhn_probe_state PS"

To
"FROM  rhn_probe_state PS, rhnServerOverview OV"

Fixes the problem for me.

Comment 2 Miroslav Suchý 2010-11-30 15:17:44 UTC
Lukas, it is related to commits
163230506ca86de6efb7dd9e5220018c004d6357
7d337c4d88e4057d542601e2fb48099557e13e05
You may want to fix it.

Comment 3 Ron Helzer 2010-11-30 18:43:59 UTC
Johan,

I edited /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB/DataSource/xml/System_queries.xml as you recommended, however I now get the following error when I confirm the scheduled commands:

The following exception occurred while executing this request:
 POST /network/systems/ssm/provisioning/remote_command_conf.pxt HTTP/1.1 (from browser)
 /network/systems/ssm/provisioning/remote_command_conf.pxt (from Apache)

Date:
  Tue Nov 30 13:39:08 2010

Headers:
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Accept-Encoding: gzip,deflate
  Accept-Language: en-us,en;q=0.5
  Connection: keep-alive
  Content-Length: 650
  Content-Type: application/x-www-form-urlencoded
  Cookie: pxt-session-cookie=4443xa249cb265a2d09c16b12a12079db05f0
  Host: spacewalk.hgvc.com
  Keep-Alive: 115
  Referer: https://spacewalk.hgvc.com/network/systems/ssm/provisioning/remote_command_conf.pxt
  User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 (CK-IBM) Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E)

Form variables:
  alphabar_column => SERVER_NAME
  am_pm => PM
  day => 30
  filter_value =>
  first_lower => 1
  first_upper => 50
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  formvars => hour
  group => root
  hour => 1
  last_lower => 1
  last_upper => 26
  list_action_label_schedule_command => Schedule commands
  list_action_url_schedule_command =>
  list_mode => ssm_remote_commandable
  lower => 1
  minute => 38
  month => 11
  next_lower => 1
  next_upper => 26
  prev_filter_value =>
  prev_lower => 1
  prev_upper => 50
  pxt:trap => rhn:system_list_cb
  script => #!/bin/sh
/bin/true
  timeout => 600
  upper => 26
  username => root
  year => 2010

User Information:
  User rhelzer (id 1, org_id 1)

Error notes:
  (none)

Initial Request:
  Yes

Error message:
  Died at /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB.pm line 545.

Comment 4 Johan Segernäs 2010-11-30 19:40:51 UTC
Hi! That's another bug, I can't find the bug report right now but here's a patch for it

"
--- /driften/down/DB.pm	2010-11-29 14:35:47.000000000 +0100
+++ DB.pm	2010-11-29 14:36:06.000000000 +0100
@@ -542,7 +542,8 @@
 
     if (ref $v and blessed($v) and $v->isa("RHN::DB::Type::BLOB")) {
       if ($self->{Database}->{Driver}->{Name} eq 'Oracle') {
-        eval 'use DBD::Oracle ()' or die $@;
+        eval 'use DBD::Oracle ()';
+        if ($@) { die $@; }
         $attr->{ora_type} = DBD::Oracle::ORA_BLOB();
         if (defined $v->{ora_field}) {
           $attr->{ora_field} = $v->{ora_field};
"

Change line 545 in /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB.pm and then it'll actually work. I hope. =)

Good luck!

Comment 5 Ron Helzer 2010-11-30 20:34:28 UTC
Johan,

I can confirm, applying both the System_queries.xml change and the DB.pm patch and restarting Spacewalk finally allows one to schedule remote commands without 500 errors.

Thank you for your assistance!

Comment 6 Lukas Zapletal 2010-12-01 14:04:59 UTC
Fixed and cherry picked into Spacewalk 1.2.

commit 5acd110b749d0f948b8aca26935f7d8c434ff200
Author: Lukas Zapletal <lzap+git@redhat.com>
Date:   Wed Dec 1 14:59:52 2010 +0100

    658256 - Error 500 - ISE - when scheduling remote commands
    
    (cherry picked from commit 5db2eedb1f8247360da182983dbf012dfd09e57b)

Comment 7 Lukas Zapletal 2010-12-02 08:04:51 UTC
Oh the commit is not fixing the issue properly. Reverted.

Comment 8 Lukas Zapletal 2010-12-02 09:22:41 UTC
Fixed in master

commit 3589dbc33ea667fc7e5d17ec5ee8e91eaeb0c8d4
Author: Lukas Zapletal <lzap+git@redhat.com>
Date:   Thu Dec 2 10:11:26 2010 +0100

    658256 - Error 500 - ISE - when scheduling remote commands (proper fix)
    
    Proper fix for reverted commit 01595ed07a3db9bc51a14d74a0b031378c12d3b0

@Ron @Jonas: Your solution is not doing what you expect. The workaround is to rewrite whole query to the ANSI compatible syntax notation:

http://git.fedorahosted.org/git/?p=spacewalk.git;a=blob;f=web/modules/rhn/RHN/DB/DataSource/xml/System_queries.xml;h=e261064bef88283b3e01ce5ef673e6c53be2959e;hb=3589dbc33ea667fc7e5d17ec5ee8e91eaeb0c8d4#l1027

See the line 1027.

Comment 9 Ron Helzer 2010-12-03 22:33:01 UTC
Lukáš,

I can confirm, replacing the "system_overview" query in System_queries.xml with the version you suggested works and appears to perform much better than the previously suggested fix.

This also corrects #658250.

- Ron -

Comment 10 Tomas Lestach 2011-02-03 12:21:46 UTC
Moving ON_QA ...

Comment 11 Tomas Lestach 2011-02-08 08:42:26 UTC
This bug has been fixed in Spacewalk 1.3.


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