You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2020/12/01 08:57:57 UTC
[GitHub] [celix] PengZheng opened a new pull request #301: Fix double dlclose when uninstalling bundle without activator
PengZheng opened a new pull request #301:
URL: https://github.com/apache/celix/pull/301
I kept playing with the export_import example, and found that the handle to libhello_test2libd.so.3 has been closed twice, but opened only once.
```
248 Thread 3 "helloworld_with" hit Breakpoint 2, framework_loadLibrary (framework=0x55555558a1e0, library=0x7ffff62a42a0 "libhello_test2libd.so.3", archive=0x55555558e950, handle=0x7ffff62a4270) at /home/peng/D ownloads/git/celix/libs/framework/src/framework.c:2307
1 2307▸ if (*handle == NULL) {
2 $23 = ".cache/bundle1/version0.5/libhello_test2libd.so.3", '\000' <repeats 206 times>
3 $24 = (void *) 0x7fffe8011750
4 #0 framework_loadLibrary (framework=0x55555558a1e0, library=0x7ffff62a42a0 "libhello_test2libd.so.3", archive=0x55555558e950, handle=0x7ffff62a4270) at /home/peng/Downloads/git/celix/libs/framework/src/fra mework.c:2307
5 #1 0x00007ffff7f9c065 in framework_loadLibraries (framework=0x55555558a1e0, librariesIn=0x7fffe800f1d0 "libhello_test2libd.so.3", activator=0x7fffe800e3d0 "1", archive=0x55555558e950, activatorHandle=0x7ff ff62a4360) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:2252
6 #2 0x00007ffff7f9be1e in framework_loadBundleLibraries (framework=0x55555558a1e0, bundle=0x55555558bfc0) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:2200 7 #3 0x00007ffff7f9aa2e in framework_markBundleResolved (framework=0x55555558a1e0, module=0x7fffe8010b00) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:1761
8 #4 0x00007ffff7f9a8d5 in framework_markResolvedModules (framework=0x55555558a1e0, resolvedModuleWireMap=0x7fffe8010c80) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:1727
9 #5 0x00007ffff7f9830d in fw_startBundle (framework=0x55555558a1e0, bndId=1, options=1) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:862
10 #6 0x00007ffff7f98ba0 in framework_updateBundle (framework=0x55555558a1e0, bundle=0x55555558bfc0, inputFile=0x7ffff62a4670 "update0pQNqz") at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:1 011
11 #7 0x00007ffff7f8db0b in bundle_update (bundle=0x55555558bfc0, inputFile=0x7ffff62a4670 "update0pQNqz") at /home/peng/Downloads/git/celix/libs/framework/src/bundle.c:286
12 #8 0x00007ffff7f23413 in updateCommand_execute (handle=0x5555555946d0, const_line=0x7ffff62a4950 "update 1 file:/home/peng/Downloads/git/celix/build/examples/export_import/hello_export-Debug.zip", outStrea m=0x7ffff7e096a0 <_IO_2_1_stdout_>, errStream=0x7ffff7e095c0 <_IO_2_1_stderr_>) at /home/peng/Downloads/git/celix/bundles/shell/shell/src/update_command.c:60
13 #9 0x00007ffff7f21c20 in shell_executeCommand (shell=0x555555595940, commandLine=0x7ffff62a4950 "update 1 file:/home/peng/Downloads/git/celix/build/examples/export_import/hello_export-Debug.zip", out=0x7ff ff7e096a0 <_IO_2_1_stdout_>, err=0x7ffff7e095c0 <_IO_2_1_stderr_>) at /home/peng/Downloads/git/celix/bundles/shell/shell/src/shell.c:277
14 #10 0x00007ffff7f153c0 in shellTui_parseInput (shellTui=0x55555559d7f0, ctx=0x7ffff62a4950) at /home/peng/Downloads/git/celix/bundles/shell/shell_tui/private/src/shell_tui.c:259 15 #11 0x00007ffff7f151fe in shellTui_runnable (data=0x55555559d7f0) at /home/peng/Downloads/git/celix/bundles/shell/shell_tui/private/src/shell_tui.c:220
16 #12 0x00007ffff7e18609 in start_thread (arg=<optimized out>) at pthread_create.c:477
17 #13 0x00007ffff7d3f293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
18
19 Thread 3 "helloworld_with" hit Breakpoint 1, celix_libloader_close (handle=0x7fffe8011750) at /home/peng/Downloads/git/celix/libs/framework/src/celix_library_loader.c:40 20 40▸ dlclose(handle);
21 $25 = (celix_library_handle_t *) 0x7fffe8011750
22 #0 celix_libloader_close (handle=0x7fffe8011750) at /home/peng/Downloads/git/celix/libs/framework/src/celix_library_loader.c:40
23 #1 0x00007ffff7f9c0c9 in framework_loadLibraries (framework=0x55555558a1e0, librariesIn=0x7fffe800f1d0 "libhello_test2libd.so.3", activator=0x7fffe800e3d0 "1", archive=0x55555558e950, activatorHandle=0x7ff ff62a4360) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:2258 24 #2 0x00007ffff7f9be1e in framework_loadBundleLibraries (framework=0x55555558a1e0, bundle=0x55555558bfc0) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:2200
25 #3 0x00007ffff7f9aa2e in framework_markBundleResolved (framework=0x55555558a1e0, module=0x7fffe8010b00) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:1761 26 #4 0x00007ffff7f9a8d5 in framework_markResolvedModules (framework=0x55555558a1e0, resolvedModuleWireMap=0x7fffe8010c80) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:1727
27 #5 0x00007ffff7f9830d in fw_startBundle (framework=0x55555558a1e0, bndId=1, options=1) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:862
28 #6 0x00007ffff7f98ba0 in framework_updateBundle (framework=0x55555558a1e0, bundle=0x55555558bfc0, inputFile=0x7ffff62a4670 "update0pQNqz") at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:1 011
29 #7 0x00007ffff7f8db0b in bundle_update (bundle=0x55555558bfc0, inputFile=0x7ffff62a4670 "update0pQNqz") at /home/peng/Downloads/git/celix/libs/framework/src/bundle.c:286
30 #8 0x00007ffff7f23413 in updateCommand_execute (handle=0x5555555946d0, const_line=0x7ffff62a4950 "update 1 file:/home/peng/Downloads/git/celix/build/examples/export_import/hello_export-Debug.zip", outStrea m=0x7ffff7e096a0 <_IO_2_1_stdout_>, errStream=0x7ffff7e095c0 <_IO_2_1_stderr_>) at /home/peng/Downloads/git/celix/bundles/shell/shell/src/update_command.c:60
31 #9 0x00007ffff7f21c20 in shell_executeCommand (shell=0x555555595940, commandLine=0x7ffff62a4950 "update 1 file:/home/peng/Downloads/git/celix/build/examples/export_import/hello_export-Debug.zip", out=0x7ff ff7e096a0 <_IO_2_1_stdout_>, err=0x7ffff7e095c0 <_IO_2_1_stderr_>) at /home/peng/Downloads/git/celix/bundles/shell/shell/src/shell.c:277
32 #10 0x00007ffff7f153c0 in shellTui_parseInput (shellTui=0x55555559d7f0, ctx=0x7ffff62a4950) at /home/peng/Downloads/git/celix/bundles/shell/shell_tui/private/src/shell_tui.c:259
33 #11 0x00007ffff7f151fe in shellTui_runnable (data=0x55555559d7f0) at /home/peng/Downloads/git/celix/bundles/shell/shell_tui/private/src/shell_tui.c:220 34 #12 0x00007ffff7e18609 in start_thread (arg=<optimized out>) at pthread_create.c:477
35 #13 0x00007ffff7d3f293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
36
37 Thread 3 "helloworld_with" hit Breakpoint 1, celix_libloader_close (handle=0x7fffe8011750) at /home/peng/Downloads/git/celix/libs/framework/src/celix_library_loader.c:40
38 40▸ dlclose(handle);
39 $26 = (celix_library_handle_t *) 0x7fffe8011750
40 #0 celix_libloader_close (handle=0x7fffe8011750) at /home/peng/Downloads/git/celix/libs/framework/src/celix_library_loader.c:40
41 #1 0x00007ffff7f993a3 in fw_uninstallBundleEntry (framework=0x55555558a1e0, entry=0x55555558df10) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:1183
42 #2 0x00007ffff7f9cc50 in celix_framework_uninstallBundle (fw=0x55555558a1e0, bndId=1) at /home/peng/Downloads/git/celix/libs/framework/src/framework.c:2494
43 #3 0x00007ffff7f93e75 in celix_bundleContext_uninstallBundle (ctx=0x5555555946d0, bundleId=1) at /home/peng/Downloads/git/celix/libs/framework/src/bundle_context.c:713
44 #4 0x00007ffff7f237a6 in uninstallCommand_execute (handle=0x5555555946d0, const_command=0x7ffff62a4950 "uninstall 1", outStream=0x7ffff7e096a0 <_IO_2_1_stdout_>, errStream=0x7ffff7e095c0 <_IO_2_1_stderr_>) at /home/peng/Downloads/git/celix/bundles/shell/shell/src/uninstall_command.c:52
45 #5 0x00007ffff7f21c20 in shell_executeCommand (shell=0x555555595940, commandLine=0x7ffff62a4950 "uninstall 1", out=0x7ffff7e096a0 <_IO_2_1_stdout_>, err=0x7ffff7e095c0 <_IO_2_1_stderr_>) at /home/peng/Down loads/git/celix/bundles/shell/shell/src/shell.c:277
46 #6 0x00007ffff7f153c0 in shellTui_parseInput (shellTui=0x55555559d7f0, ctx=0x7ffff62a4950) at /home/peng/Downloads/git/celix/bundles/shell/shell_tui/private/src/shell_tui.c:259
47 #7 0x00007ffff7f151fe in shellTui_runnable (data=0x55555559d7f0) at /home/peng/Downloads/git/celix/bundles/shell/shell_tui/private/src/shell_tui.c:220
48 #8 0x00007ffff7e18609 in start_thread (arg=<optimized out>) at pthread_create.c:477
49 #9 0x00007ffff7d3f293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [celix] pnoltes commented on a change in pull request #301: Fix double dlclose when uninstalling bundle without activator
Posted by GitBox <gi...@apache.org>.
pnoltes commented on a change in pull request #301:
URL: https://github.com/apache/celix/pull/301#discussion_r537034141
##########
File path: libs/framework/src/framework.c
##########
@@ -2307,16 +2317,6 @@ static celix_status_t framework_loadLibrary(framework_pt framework, const char *
if (*handle == NULL) {
error = celix_libloader_getLastError();
status = CELIX_BUNDLE_EXCEPTION;
- } else {
Review comment:
Removing this and moving this to loadLibraries (and only for the activator libraries) means that not all libraries mentioned in Private-Library and Import-Library are added to the handles list.
I think this is not the desired result.
I expected this issues to be solved during the stopping if a bundle (i.e. during the closing of a library).
Could you first add an unit test to reproduce this issue. We already have some test for starting/stopping bundles. See
https://github.com/apache/celix/blob/40e33daaeb12f3bc38d19a477a861ffffe72b734/libs/framework/gtest/src/bundle_context_bundles_tests.cpp#L38
https://github.com/apache/celix/blob/40e33daaeb12f3bc38d19a477a861ffffe72b734/libs/framework/gtest/subdir/CMakeLists.txt#L18
https://github.com/apache/celix/blob/40e33daaeb12f3bc38d19a477a861ffffe72b734/libs/framework/gtest/CMakeLists.txt#L18
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [celix] PengZheng commented on pull request #301: Fix double dlclose when uninstalling bundle without activator
Posted by GitBox <gi...@apache.org>.
PengZheng commented on pull request #301:
URL: https://github.com/apache/celix/pull/301#issuecomment-739137563
@pnoltes @Oipo
Could you have a look at this? It seems like a bug.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [celix] codecov-io commented on pull request #301: Fix double dlclose when uninstalling bundle without activator
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #301:
URL: https://github.com/apache/celix/pull/301#issuecomment-736330271
# [Codecov](https://codecov.io/gh/apache/celix/pull/301?src=pr&el=h1) Report
> Merging [#301](https://codecov.io/gh/apache/celix/pull/301?src=pr&el=desc) (2142389) into [master](https://codecov.io/gh/apache/celix/commit/2546c643b98550a6fc22b5b4eb98ce772f955d79?el=desc) (2546c64) will **not change** coverage.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/celix/pull/301/graphs/tree.svg?width=650&height=150&src=pr&token=JdsiThga8P)](https://codecov.io/gh/apache/celix/pull/301?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #301 +/- ##
=======================================
Coverage 66.74% 66.74%
=======================================
Files 147 147
Lines 29947 29947
=======================================
Hits 19987 19987
Misses 9960 9960
```
| [Impacted Files](https://codecov.io/gh/apache/celix/pull/301?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/301/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `75.53% <100.00%> (ø)` | |
| [.../pubsub\_admin\_zmq/v2/src/pubsub\_zmq\_topic\_sender.c](https://codecov.io/gh/apache/celix/pull/301/diff?src=pr&el=tree#diff-YnVuZGxlcy9wdWJzdWIvcHVic3ViX2FkbWluX3ptcS92Mi9zcmMvcHVic3ViX3ptcV90b3BpY19zZW5kZXIuYw==) | `73.46% <0.00%> (-0.59%)` | :arrow_down: |
| [libs/utils/src/hash\_map.c](https://codecov.io/gh/apache/celix/pull/301/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvaGFzaF9tYXAuYw==) | `93.08% <0.00%> (-0.58%)` | :arrow_down: |
| [libs/framework/src/service\_tracker.c](https://codecov.io/gh/apache/celix/pull/301/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfdHJhY2tlci5j) | `77.13% <0.00%> (-0.19%)` | :arrow_down: |
| [.../pubsub/pubsub\_admin\_zmq/v2/src/pubsub\_zmq\_admin.c](https://codecov.io/gh/apache/celix/pull/301/diff?src=pr&el=tree#diff-YnVuZGxlcy9wdWJzdWIvcHVic3ViX2FkbWluX3ptcS92Mi9zcmMvcHVic3ViX3ptcV9hZG1pbi5j) | `56.35% <0.00%> (+0.37%)` | :arrow_up: |
| [...dmin\_websocket/src/pubsub\_websocket\_topic\_sender.c](https://codecov.io/gh/apache/celix/pull/301/diff?src=pr&el=tree#diff-YnVuZGxlcy9wdWJzdWIvcHVic3ViX2FkbWluX3dlYnNvY2tldC9zcmMvcHVic3ViX3dlYnNvY2tldF90b3BpY19zZW5kZXIuYw==) | `83.24% <0.00%> (+1.11%)` | :arrow_up: |
| [bundles/pubsub/pubsub\_utils/src/pubsub\_utils.c](https://codecov.io/gh/apache/celix/pull/301/diff?src=pr&el=tree#diff-YnVuZGxlcy9wdWJzdWIvcHVic3ViX3V0aWxzL3NyYy9wdWJzdWJfdXRpbHMuYw==) | `69.31% <0.00%> (+1.13%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/301?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/301?src=pr&el=footer). Last update [2546c64...2142389](https://codecov.io/gh/apache/celix/pull/301?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org