Bug 1322962 - 500 Internal Server Error on snapshot rollback
Summary: 500 Internal Server Error on snapshot rollback
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: WebUI
Version: 570
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Grant Gainey
QA Contact: Pavel Studeník
URL:
Whiteboard:
Depends On: 1221059
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-31 19:01 UTC by Shannon Hughes
Modified: 2019-11-14 07:42 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1221059
Environment:
Last Closed: 2016-06-02 12:33:45 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2215711 0 None None None 2016-03-31 21:35:38 UTC
Red Hat Product Errata RHBA-2016:1200 0 normal SHIPPED_LIVE Satellite 5.7 bug fix update 2016-06-02 16:32:31 UTC

Description Shannon Hughes 2016-03-31 19:01:34 UTC
+++ This bug was initially created as a clone of Bug #1221059 +++

Description of problem:
When trying to rollback a package profile on the "Systems => Provisioning => Snapshots" page, I get a 500 internal server error. This only occurs when there are packages to rollback. A rollback of a group or channel change works.

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

How reproducible:
Always

Steps to Reproduce:
1. Update package on client registered with Spacewalk 2.3.
2. Try to rollback to an earlier snapshot with an older version of the installed package.
3. After clicking "Rollback to Snapshot" an internal server error is generated 

Actual results:
Return internal server error

Expected results:
Schedule package rollback

Additional info:
Using Spacewalk 2.3 on CentOS 7 with Oracle DB

Tomcat log shows:
May 13, 2015 10:24:51 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [action] in context with path [/rhn] threw exception [java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer] with root cause
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
        at com.redhat.rhn.domain.server.ServerSnapshot.preparePackagesForSync(ServerSnapshot.java:462)
        at com.redhat.rhn.domain.server.ServerSnapshot.rollbackPackages(ServerSnapshot.java:369)
        at com.redhat.rhn.frontend.action.systems.sdc.SnapshotRollbackAction.rollback(SnapshotRollbackAction.java:108)
        at com.redhat.rhn.frontend.action.systems.sdc.SnapshotRollbackAction.execute(SnapshotRollbackAction.java:79)

Comment 1 Shannon Hughes 2016-03-31 19:06:21 UTC
looks like we need to pull in this commit: 

[shughes@dhcp145-192 spacewalk{master}]$ git show a729b9f4b32c0238b210924cadb70739576eed55
commit a729b9f4b32c0238b210924cadb70739576eed55
Author: Tomas Lestach <tlestach>
Date:   Wed May 20 16:17:59 2015 +0200

    expect a Number instead of an Integer
    
    addressing issue when Spacewalk with ORA backend fails with:
    Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
        at com.redhat.rhn.domain.server.ServerSnapshot.preparePackagesForSync(ServerSnapshot.java:462)
        at com.redhat.rhn.domain.server.ServerSnapshot.rollbackPackages(ServerSnapshot.java:369)
        at com.redhat.rhn.frontend.action.systems.sdc.SnapshotRollbackAction.rollback(SnapshotRollbackAction.java:108)
        at com.redhat.rhn.frontend.action.systems.sdc.SnapshotRollbackAction.execute(SnapshotRollbackAction.java:79)

diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerSnapshot.java b/java/code/src/com/redhat/rhn/domain/server/ServerSnapshot.java
index d4f8a6b..ac0cad7 100644
--- a/java/code/src/com/redhat/rhn/domain/server/ServerSnapshot.java
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerSnapshot.java
@@ -459,7 +459,7 @@ public class ServerSnapshot extends BaseDomainHelper {
 
             PackageMetadata pm = new PackageMetadata(systemPkg, snapshotPkg);
             int comparison;
-            switch ((Integer) pkgDiff.get("comparison")) {
+            switch (((Number) pkgDiff.get("comparison")).intValue()) {
             case -2: comparison = PackageMetadata.KEY_OTHER_ONLY;
                      break;
             case -1: comparison = PackageMetadata.KEY_OTHER_NEWER;

Comment 2 Tomas Lestach 2016-03-31 20:54:57 UTC
Shannon, thanks for the great investigation!

Moving to MODIFIED, since according to Comment 1 the fix is available in upstream ...

spacewalk.git: a729b9f4b32c0238b210924cadb70739576eed55

Comment 3 Tomas Lestach 2016-04-01 07:26:52 UTC
I assume the BZ was switched over to NEW by accident, so switching back to MODIFIED.

Comment 8 Pavel Studeník 2016-05-27 14:44:47 UTC
Reproducer is only with Oracle db.

Verified with spacewalk-java-2.3.8-142.el6sat.noarch.rpm

Comment 10 errata-xmlrpc 2016-06-02 12:33:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1200


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