-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deadlock in ConfigurationAdminImpl::RemoveConfigurations (#745)
* Fix deadlock in ConfigurationAdminImpl::RemoveConfigurations This is a fix for a deadlock bug caused by the WaitForAllAsync in ConfigurationAdmin::RemoveConfigurations. The Use Case is as follows: A configuration object is defined in the manifest.json file. The User's main thread stopped the bundle which causes the ConfigurationAdminImp::RemoveConfigurations method to remove the configuration object from the ConfigurationAdmin repository and to send an Updated notification to the service instance. RemoveConfigurations would then execute a WaitForAllAsync to wait for all asynchronous threads to complete including the asynchronous thread that was launched as part of the Updated notification. The user's Updated method also tried to stop the bundle. This means that it had to wait for the RemoveConfigurations method to complete. Each thread was waiting for the other to complete. This fix removes the WaitForAllAsync and adds a test case to confirm the deadlock is gone. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com> * Fix compiler error Fix compiler error in Minimum Gcc build. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com> * Change ConfigAdminTests.testManagedServiceRemoveConfigurationsDeadlock Change ConfigAdminTests.testManagedServiceRemoveConfigurationsDeadlock so that it more closely matches the use case that caused the deadlock. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com> * Update TestConfigAdmin.cpp testManagedServiceRemoveConfigurationsDeadlock test. Changed Updated method to make sure that it only stops the bundle containing the cm.testdeadlock configuration object. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com> * Update TestConfigAdmin.cpp Added error checking for the Updated method used in testManagedServiceRemoveConfigurationsDeadlock. Signed-off-by The MathWorks, Inc. <pelliott@mathworks.com>
- Loading branch information
1 parent
e19ff81
commit c141557
Showing
5 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
compendium/test_bundles/TestBundleManagedServiceDeadlock/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
usFunctionCreateDSTestBundle(TestBundleManagedServiceDeadlock) | ||
|
||
usFunctionCreateTestBundleWithResources(TestBundleManagedServiceDeadlock | ||
RESOURCES manifest.json | ||
BUNDLE_SYMBOLIC_NAME TestBundleManagedServiceDeadlock | ||
OTHER_LIBRARIES usTestInterfaces usServiceComponent cm) |
16 changes: 16 additions & 0 deletions
16
compendium/test_bundles/TestBundleManagedServiceDeadlock/resources/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"bundle.symbolic_name": "TestBundleManagedServiceDeadlock", | ||
"bundle.name": "TestBundleManagedServiceDeadlock", | ||
"bundle.activator": false, | ||
"cm": { | ||
"version": 1, | ||
"configurations": [ | ||
{ | ||
"pid": "cm.testdeadlock", | ||
"properties": { | ||
"anInt": 2 | ||
} | ||
} | ||
] | ||
} | ||
} |