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):
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)
depends on the Step for reproducing, see comments above
no exceptions and consistent config files in Satellite
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.
Created attachment 522095 [details]
Script for reproducing the problem
* removing rhnOrgQuota and rhn_quota stuff:
* real fix:
rewrite revision creation by config file update ...
fix related unit tests + minor fixes ...
See Test: /Core/RHN-Satellite/FrontendAPI/Sanity/bz736661_simultaneous_use_of_API_system_config_createOrUpdatePath
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
5.5 Upgrade Errata
5.5 RHN Proxy GA Errata
5.5 RHN Tools GA Errata
- Engineering Manager, Satellite