Bug 736661 - simultaneous use of API system.config.createOrUpdatePath for locally managed files causes inconsistency
simultaneous use of API system.config.createOrUpdatePath for locally managed ...
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: Tomas Lestach
Dimitar Yordanov
Depends On:
Blocks: sat550-api
  Show dependency treegraph
Reported: 2011-09-08 07:30 EDT by Stephan Dühr
Modified: 2012-09-21 05:21 EDT (History)
3 users (show)

See Also:
Fixed In Version: spacewalk-java-1.7.54-47 spacewalk-schema-1.7.55-18
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-09-21 05:21:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Script for reproducing the problem (4.02 KB, text/x-python)
2011-09-08 07:31 EDT, Stephan Dühr
no flags Details

  None (edit)
Description Stephan Dühr 2011-09-08 07:30:27 EDT
Description of problem:
When calling system.config.createOrUpdatePath with the same contents for multiple systems, under certain conditions it causes the exception
ORA-00001: unique constraint (RHNSAT.RHNCHECKSUM_CHSUM_UQ) violated
and leaves inconsistend config files that can not be deleted using the Satellite GUI.

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

How reproducible:
always, although not easy to reproduce.
I have written the attached python script reproduce_createOrUpdatePath_bug.py for reproducing the problem by simultaneously executing the API calls. At least as simultaneously as possible.

For reproducing the problem I used 3 system profiles, the system IDs are needed for calling the script.

Steps to Reproduce:
1. run the attached script like this
./reproduce_createOrUpdatePath_bug.py -f snmpd.conf --path=/tmp/test/snmpd.conf -s 1000011819,1000011739,1000011879 -l log.txt -a satellite.your.dom -u satuser -p satpass

This resulted in two successful and one exception of this type:
Fault: <Fault -1: 'redstone.xmlrpc.XmlRpcFault: unhandled internal exception: ORA-00001: unique constraint (RHNSAT.RHN_CFNAME_PATH_UQ) violated\nORA-06512: at "RHNSAT.LOOKUP_CONFIG_FILENAME", line 16\nORA-01403: no data found\nORA-06512: at line 1\n'>

In the Sat GUI I see the locally managed file at 2 of 3 Systems.

2. remove the locally managed files from the systems
3. edit the file (here snmpd.conf)
4. call the script again as in Step 1
Now for 2 of 3 systems you get the following exception:
Fault: <Fault -1: 'redstone.xmlrpc.XmlRpcFault: unhandled internal exception: ORA-00001: unique constraint (RHNSAT.RHNCHECKSUM_CHSUM_UQ) violated\nORA-06512: at "RHNSAT.LOOKUP_CHECKSUM", line 21\nORA-01403: no data found\nORA-06512: at line 1\n'>

In the Satellite GUI you can now see 2 of 3 systems have an inconsistent locally managed config file marked with a "?". Trying to delete it using the Satellite GUI results in an "Internal Server Error".

Fortunately, they can be removed successfully using the API call
client.system.config.deleteFiles(session, sid, ['/tmp/test/snmpd.conf'], True)
Actual results:
depends on the Step for reproducing, see comments above

Expected results:
no exceptions and consistent config files in Satellite

Additional info:
This is probably not common usage of API calls.
Anyway, when using API calls in CGI Scripts, for example to implement pushing locally managed config files directly from client systems using curl, it is possible by using something like clusterssh to call the CGI almost simultaneously. The Workaround is to prevent simultaneous API calls in the CGI Script by using a locking mechanism.
Comment 1 Stephan Dühr 2011-09-08 07:31:51 EDT
Created attachment 522095 [details]
Script for reproducing the problem
Comment 2 Tomas Lestach 2012-05-16 11:26:33 EDT
 * removing rhnOrgQuota and rhn_quota stuff:
 * real fix:
Comment 3 Tomas Lestach 2012-05-18 04:51:02 EDT
rewrite revision creation by config file update ...

spacewalk.git: 4d9a50ed654c7d8195ce02b69f31255d63ea7454
Comment 7 Tomas Lestach 2012-05-25 05:57:23 EDT
fix related unit tests + minor fixes ...

 1ce8c8a7f52a9ea393a7bb5c5741ecd841a5fbef (important)
Comment 10 Dimitar Yordanov 2012-06-24 16:46:47 EDT

See Test: /Core/RHN-Satellite/FrontendAPI/Sanity/bz736661_simultaneous_use_of_API_system_config_createOrUpdatePath
Comment 12 Clifford Perry 2012-09-21 05:21:32 EDT
This issue is resolved with the release of RHN Satellite 5.5. 

As of September 20th 2012, RHN Satellite 5.5 has been generally available. 

Release Notes and other 5.5 documentation can be found here:


The associated Errata for the 5.5 release are:

5.5 Satellite GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1296.html

5.5 Upgrade Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1298.html

5.5 RHN Proxy GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1297.html

5.5 RHN Tools GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1299.html

- Engineering Manager, Satellite

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