You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by "PengZheng (via GitHub)" <gi...@apache.org> on 2023/04/27 14:33:38 UTC

[GitHub] [celix] PengZheng opened a new pull request, #529: Fix double-dlclose and remove dead code.

PengZheng opened a new pull request, #529:
URL: https://github.com/apache/celix/pull/529

   Note that all opened shared object come from `celix_module_loadLibrary`, which will add the handle to `module->libraryHandles`.
   Also note that for all installed bundles, `celix_module_closeLibraries` will close all opened shared object in `module->libraryHandles` when `framework_destroy`. Thus call `celix_libloader_close` on any shared object opened by `celix_module_loadLibrary` without removing it from `module->libraryHandles` must be a double-close.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [WIP]Some module layer fixes (celix)

Posted by "pnoltes (via GitHub)" <gi...@apache.org>.
pnoltes commented on code in PR #529:
URL: https://github.com/apache/celix/pull/529#discussion_r1180391553


##########
libs/framework/src/module.c:
##########
@@ -251,12 +251,12 @@ celix_status_t module_getGroup(module_pt module, const char **symbolicName) {
     return status;
 }
 
-celix_status_t module_getDescription(module_pt module, const char **symbolicName) {
+celix_status_t module_getDescription(module_pt module, const char **descriptoin) {
     celix_status_t status = CELIX_SUCCESS;
     if (module == NULL) {
         status = CELIX_ILLEGAL_ARGUMENT;
     } else {
-        *symbolicName = module->description;
+        *descriptoin = module->description;

Review Comment:
   nitpick: typo in `descriptoin` variable. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [celix] PengZheng commented on a diff in pull request #529: Fix double-dlclose and remove dead code.

Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on code in PR #529:
URL: https://github.com/apache/celix/pull/529#discussion_r1179262262


##########
libs/framework/src/module.c:
##########
@@ -501,8 +494,6 @@ celix_status_t celix_module_loadLibraries(celix_module_t* module) {
             celixThreadMutex_lock(&module->handlesLock);
             module->bundleActivatorHandle = activatorHandle;
             celixThreadMutex_unlock(&module->handlesLock);
-        } else if (activatorHandle != NULL) {
-            celix_libloader_close(fwCtx, activatorHandle);

Review Comment:
   This is indeed a double close. Suppose that we have two private libraries a.so and b.so and that a.so is an activator,
   what will happen if a.so is opened successfully while loading b.so fails? 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [WIP]Some module layer fixes (celix)

Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on code in PR #529:
URL: https://github.com/apache/celix/pull/529#discussion_r1180958569


##########
libs/framework/src/module.c:
##########
@@ -501,8 +494,6 @@ celix_status_t celix_module_loadLibraries(celix_module_t* module) {
             celixThreadMutex_lock(&module->handlesLock);
             module->bundleActivatorHandle = activatorHandle;
             celixThreadMutex_unlock(&module->handlesLock);
-        } else if (activatorHandle != NULL) {
-            celix_libloader_close(fwCtx, activatorHandle);

Review Comment:
   Yes, I'll add a test case for this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Some module layer fixes (celix)

Posted by "pnoltes (via GitHub)" <gi...@apache.org>.
pnoltes commented on code in PR #529:
URL: https://github.com/apache/celix/pull/529#discussion_r1181718179


##########
libs/framework/src/celix_libloader.c:
##########
@@ -29,9 +29,9 @@ celix_library_handle_t* celix_libloader_open(celix_bundle_context_t *ctx, const
 #endif
     celix_library_handle_t* handle = NULL;
     bool noDelete = celix_bundleContext_getPropertyAsBool(ctx, CELIX_LOAD_BUNDLES_WITH_NODELETE, defaultNoDelete);
-    int flags = RTLD_LAZY|RTLD_LOCAL;
+    int flags = RTLD_NOW|RTLD_LOCAL;

Review Comment:
   I agree with the change. I think we added the LAZY because it was needed when the dependency manager was a separate library, but this should not be an issue anymore. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Some module layer fixes (celix)

Posted by "pnoltes (via GitHub)" <gi...@apache.org>.
pnoltes commented on PR #529:
URL: https://github.com/apache/celix/pull/529#issuecomment-1529948510

   LGTM. 
   
   Note that the new requirement-capability model will take some time before this is introduced. So if a quicker fix is needed, an other option should be looked into. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [celix] codecov-commenter commented on pull request #529: [WIP]Some module layer fixes

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #529:
URL: https://github.com/apache/celix/pull/529#issuecomment-1526919362

   ## [Codecov](https://codecov.io/gh/apache/celix/pull/529?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#529](https://codecov.io/gh/apache/celix/pull/529?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8410db1) into [master](https://codecov.io/gh/apache/celix/commit/335935c31473311906d62599c62dbd7f2f787ef8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (335935c) will **decrease** coverage by `0.03%`.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #529      +/-   ##
   ==========================================
   - Coverage   75.64%   75.62%   -0.03%     
   ==========================================
     Files         225      225              
     Lines       34451    34445       -6     
   ==========================================
   - Hits        26060    26048      -12     
   - Misses       8391     8397       +6     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/529?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [libs/framework/src/celix\_libloader.c](https://codecov.io/gh/apache/celix/pull/529?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlicy9mcmFtZXdvcmsvc3JjL2NlbGl4X2xpYmxvYWRlci5j) | `94.73% <100.00%> (ø)` | |
   | [libs/framework/src/module.c](https://codecov.io/gh/apache/celix/pull/529?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlicy9mcmFtZXdvcmsvc3JjL21vZHVsZS5j) | `73.55% <100.00%> (+0.14%)` | :arrow_up: |
   
   ... and [4 files with indirect coverage changes](https://codecov.io/gh/apache/celix/pull/529/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [WIP]Some module layer fixes (celix)

Posted by "pnoltes (via GitHub)" <gi...@apache.org>.
pnoltes commented on code in PR #529:
URL: https://github.com/apache/celix/pull/529#discussion_r1180397651


##########
libs/framework/src/module.c:
##########
@@ -501,8 +494,6 @@ celix_status_t celix_module_loadLibraries(celix_module_t* module) {
             celixThreadMutex_lock(&module->handlesLock);
             module->bundleActivatorHandle = activatorHandle;
             celixThreadMutex_unlock(&module->handlesLock);
-        } else if (activatorHandle != NULL) {
-            celix_libloader_close(fwCtx, activatorHandle);

Review Comment:
   Is it possible to create a test case for this, maybe using the a error injection when loading the b.so?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [celix] PengZheng commented on a diff in pull request #529: Fix double-dlclose and remove dead code.

Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on code in PR #529:
URL: https://github.com/apache/celix/pull/529#discussion_r1179259071


##########
libs/framework/src/module.c:
##########
@@ -454,10 +452,7 @@ static celix_status_t celix_module_loadLibrariesInManifestEntry(celix_module_t*
 
         if ( (status == CELIX_SUCCESS) && (activator != NULL) && (strcmp(trimmedLib, activator) == 0) ) {
             *activatorHandle = handle;
-        } else if ((status != CELIX_SUCCESS) && (handle != NULL)) {
-            celix_libloader_close(fwCtx, handle);

Review Comment:
   Note this is dead code, i.e. when handle != NULL we must have status == CELIX_SUCCESS.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Some module layer fixes (celix)

Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng merged PR #529:
URL: https://github.com/apache/celix/pull/529


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org