Bug 852976

Summary: Race condition : one of the embedded cartridges will be corrupt when adding two cartridges to same app at same time
Product: OKD Reporter: Meng Bo <bmeng>
Component: ContainersAssignee: Rob Millner <rmillner>
Status: CLOSED UPSTREAM QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: dmace, jinzhang, mfisher
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-11 15:36:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
race_add_cartridges none

Description Meng Bo 2012-08-30 07:14:14 UTC
Created attachment 608060 [details]
race_add_cartridges

Description of problem:
Add to embedded cartridges two a same app at the same time, eg. mysql and mongodb.
All the action will exit with correct result. But when trying to check the application info via rhc app show, only one cartridge will show in the app info.
And then try too remove the missing one from the app, will get the cartridge doesn't embed to the app, and try to embed the missing one to the app again, it can not be embedded.

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

How reproducible:
always

Steps to Reproduce:
1.Create an app
$rhc app create -a php1 -t php-5.3
2.Add mysql and mongodb to the app at the same time
Open two terminals and send the commands rapidly
3.Check the app info via 'rhc app show'
4.Try to remove the missing cartridge
5.Try to add the missing cartridge again

  
Actual results:
3.Only one cartridge can be list in the app info.
4.Cannot remove the missing one.
5.Cannot add the missing one again.

Expected results:
Both of the two carts can be added to the app.

Additional info:
Attached the development log for debug.

Comment 1 joycezhang 2012-09-05 02:57:11 UTC
When add postgresql and mongodb to an app at the same time, incorrect error message is shown as below:

# rhc app cartridge add -a myscapp2 -c postgresql-8.4 -p ab
Problem reported from server. Response code was 500.
Re-run with -d for more information.
RESULT:
Only 1 embedded database permitted - application currently has 'mongodb'

Expected results:
Both of the db cartridge can be added to the app.

Comment 2 Dan McPherson 2012-09-05 14:48:15 UTC
I am missing in the code how the issue from comment 2 is happening appears to be mongodb is being set as the env var for db type.  The original issue from comment 1 is still there and being fixed upstream in kraman/features/model_refactor.  Sending to the runtime team to look at item 2.

Comment 3 Dan Mace 2012-09-11 15:36:27 UTC
Closing, as the originally reported issue is being fixed upstream in the broker. The runtime does not yet support adding multiple DB carts to an application, so bugs shouldn't be filed against that functionality.