Bug 250109 - Using channel.software.setSystemChannels yields ORA-20246: (channel_unsubscribe_child_exists) - Unsubscribe failed because server is subscribed to child channels
Using channel.software.setSystemChannels yields ORA-20246: (channel_unsubscri...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API (Show other bugs)
500
All Linux
low Severity low
: ---
: ---
Assigned To: Justin Sherrill
Brandon Perkins
:
Depends On:
Blocks: 248642
  Show dependency treegraph
 
Reported: 2007-07-30 11:00 EDT by Jan Pazdziora
Modified: 2008-04-02 17:00 EDT (History)
0 users

See Also:
Fixed In Version: sat510
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-02 17:00:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Pazdziora 2007-07-30 11:00:46 EDT
Description of problem:

This is based on mailing-list post:
http://post-office.corp.redhat.com/archives/rhn-satellite/2007-July/msg00110.html

I have reproduced it on Satellite 5.0.0.

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

Satellite 5.0.0

How reproducible:

Nondeterministic.

Steps to Reproduce:
1. Have a system registered to the satellite, with some child channels.
2. Try to run the script
https://rhn-satellite.108.redhat.com/source/browse/*checkout*/rhn-satellite/trunk/api-script-examples/rhn-api-set_system_channel.pl?rev=47
3. Make sure the --channel parameter is different parent channel one than the
existing parent channel of the system.

Actual results:

Sometimes this does through well. However, sometimes you'll get

Channels : rhel-i386-server-5
Fault returned from XML RPC Server, fault code -1: unhandled internal exception:
ORA-20246: (channel_unsubscribe_child_exists) - Unsubscribe failed because
server is subscribed to child channels
ORA-06512: at "RHNSAT.RHN_EXCEPTION", line 23
ORA-06512: at "RHNSAT.RHN_CHANNEL", line 429
ORA-06512: at line 1

It's not completely deterministic and it seems to depend on the order of
channels in the Server object -- if the parent channel is the last in the list,
you are lucky.

Expected results:

No error, system correctly moved to different channels.

Additional info:
Comment 1 Jan Pazdziora 2007-07-30 11:04:51 EDT
Looking at the code in channel/software/ChannelSoftwareHandler.java

        Set currentlySubscribed = server.getChannels();
        for (Iterator itr = currentlySubscribed.iterator(); itr.hasNext();) {
            Channel channel = (Channel) itr.next();
            if (channels.contains(channel)) {
                continue; //no need to unsubscribe
            }
            SystemManager.unsubscribeServerFromChannel(server, channel);
        }

the code unsubscribes the system from channels one-by-one.

However, the PL/SQL procedure rhn_channel.unsubscribe_server is able to
unsubscribe a channel plus its children, if the unsubscribe_children_in
parameter is passed in as 1.

So it would be much better to find the base channel in Java, and just call the
PL/SQL unsubscribe_server with unsubscribe_children_in set and let the PL/SQL
procedure do the job.
Comment 3 Justin Sherrill 2007-10-29 14:43:54 EDT
fixed in 133335.

I ended up going with a purely java solution, since it reduced the change in
that particular api call's code.
Comment 4 Justin Sherrill 2007-10-29 16:07:04 EDT
Moving to on_qa
Comment 5 Brandon Perkins 2007-12-19 15:07:10 EST
Fails QA.  Seems to be the same error message to me:

$ ./rhn-api-set_system_channel.pl --host rlx-3-14.rhndev.redhat.com --user
bdperkin --password redhat --target 1000010005 --channel
clone-rhel-i386-server-5 --channel rhn-tools-rhel-i386-server-5 --channel
rhel-i386-server-vt-5
rlx-3-14.rhndev.redhat.com is running API version is 5.1.0

Channels : clone-rhel-i386-server-5 rhn-tools-rhel-i386-server-5
rhel-i386-server-vt-5
Fault returned from XML RPC Server, fault code -1: redstone.xmlrpc.XmlRpcFault:
unhandled internal exception: ORA-20246: (channel_unsubscribe_child_exists) -
Unsubscribe failed because server is subscribed to child channels
ORA-06512: at "RHNSAT.RHN_EXCEPTION", line 23
ORA-06512: at "RHNSAT.RHN_CHANNEL", line 435
ORA-06512: at line 1

This was done against a server registeed to rhel-i386-server-5 + tools + VT,
then I created a clone of rhel-i386-server-5 and ran the command above.
Comment 6 Justin Sherrill 2007-12-21 15:01:01 EST
should be fixed in rev 135109.

took a bit to reproduce, my reproducer no longer does so... so i'm pretty sure
it's fixed
Comment 7 Brandon Perkins 2008-01-04 23:53:34 EST
Verified.
Comment 8 Pradeep Kilambi 2008-03-25 14:56:03 EDT
$ ./rhn-api-set_system_channel.pl --host rlx-3-12.rhndev.redhat.com --user admin
--password dog8code --target 1000010011 --channel clone-rhel-i386-server-5
--channel rhn-tools-rhel-i386-server-5 
rlx-3-12.rhndev.redhat.com is running API version is 5.1.0

Channels : clone-rhel-i386-server-5 rhn-tools-rhel-i386-server-5
Success: 1

release pending
Comment 9 Brandon Perkins 2008-04-02 17:00:44 EDT
API call Enhancements for 5.1 Sat GA so Closed for Current Release.

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