Bug 736661 - simultaneous use of API system.config.createOrUpdatePath for locally managed files causes inconsistency
Summary: simultaneous use of API system.config.createOrUpdatePath for locally managed ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API
Version: 541
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Tomas Lestach
QA Contact: Dimitar Yordanov
URL:
Whiteboard:
Depends On:
Blocks: sat550-api
TreeView+ depends on / blocked
 
Reported: 2011-09-08 11:30 UTC by Stephan Dühr
Modified: 2018-11-14 11:04 UTC (History)
3 users (show)

Fixed In Version: spacewalk-java-1.7.54-47 spacewalk-schema-1.7.55-18
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-21 09:21:32 UTC
Target Upstream Version:
Embargoed:


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

Description Stephan Dühr 2011-09-08 11:30:27 UTC
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):
spacewalk-java-lib-1.2.39-97.el5sat

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 11:31:51 UTC
Created attachment 522095 [details]
Script for reproducing the problem

Comment 2 Tomas Lestach 2012-05-16 15:26:33 UTC
spacewalk.git:
 * removing rhnOrgQuota and rhn_quota stuff:
   147806e8aacf9453bd8ce4757399914c3452d1e5
   c9978f08c13d9c04db320f71405dc517d2f132e2
   96ef53677eba4e9bac18165b9f286af1d0ff9eab
   a7de3acb5958c53abdc4cedc22505251bcee9981
   45d6f153a3b6e7805efa2fcb14e67fc3b84c131b
   4ddfa29e15bfb9e5df918f2208b832882665894a
   93f0a247c067f99e713ff6aeb4b5b8911dc4b9dd
   00b60bb1a0178c17b7eebcd943d5e76565183a20
   9fdc77c114081608ab2ca7968734e5079ca10664
   4b801a6620865e100a7c8eac2438c646ab782271
   6639d4855416edec2358adecc3aabfe44baa3c8a
   58c335948728ce409ef1d3f3e56618d7d740ab2b
 * real fix:
   ad44c766557d33af310858bf60246b8774451dbe

Comment 3 Tomas Lestach 2012-05-18 08:51:02 UTC
rewrite revision creation by config file update ...

spacewalk.git: 4d9a50ed654c7d8195ce02b69f31255d63ea7454

Comment 7 Tomas Lestach 2012-05-25 09:57:23 UTC
fix related unit tests + minor fixes ...

spacewalk.git:
 87f03bc923e346eeec20a39785598b3945ae874e
 38295d46216af56a6ff517de30c4a169c874aeb4
 f67945ed65091983ea9a8328b69b0ebf1b65760a
 1ce8c8a7f52a9ea393a7bb5c5741ecd841a5fbef (important)

Comment 10 Dimitar Yordanov 2012-06-24 20:46:47 UTC
Verified.
spacewalk-java-1.7.54-67

See Test: /Core/RHN-Satellite/FrontendAPI/Sanity/bz736661_simultaneous_use_of_API_system_config_createOrUpdatePath

Comment 12 Clifford Perry 2012-09-21 09:21:32 UTC
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:

 https://access.redhat.com/knowledge/docs/Red_Hat_Network_Satellite/

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

Regards,
Clifford
- Engineering Manager, Satellite


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