gazebosim / gazebosim/gz-plugin

INTEGRATION_WeakPluginPtr test fails

Open
#7 1 comment 0 reactions 0 assignees View on GitHub
bug tests
Dominant language
C++
Stars
47
Forks
31
Avg merge
2d 6h
Merged PRs (30d)
5

Description

**Original report ([archived issue](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-plugin/issues/7)) by Juan Oxoby (Bitbucket: [Juan Oxoby](https://bitbucket.org/%7B7d3743fc-bfd8-4e48-a53b-9cc0a264f66d%7D/)).**

----------------------------------------
# Prerequisites

* \[X \] Put an X between the brackets on this line if you have done all of the following:

* Checked the Q&A board for common solutions: [http://answers.gazebosim.org](http://answers.gazebosim.org)
* Checked that your issue isn't already filed.
* Checked that there is not already an Ignition package that provides the described functionality: [https://ignitionrobotics.org/libs](https://ignitionrobotics.org/libs)

# Description

`INTEGRATION_WeakPluginPtr` is failing on my machine.

# Steps to Reproduce

1. Run `INTEGRATION_WeakPluginPtr`

**Expected behavior:**

PASSED

**Actual behavior:**

```
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from WeakPluginPtr
[ RUN ] WeakPluginPtr.Lifecycle
/home/juan/ignition_workspace/src/ign-plugin/test/integration/WeakPluginPtr.cc:59: Failure
Expected equality of these values:
nullptr
Which is: NULL
dlHandle
Which is: 0x55fdb805a330
[ FAILED ] WeakPluginPtr.Lifecycle (0 ms)
[ RUN ] WeakPluginPtr.CopyMove
[ OK ] WeakPluginPtr.CopyMove (0 ms)
[----------] 2 tests from WeakPluginPtr (0 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (0 ms total)
[ PASSED ] 1 test.
[ FAILED ] 1 test, listed below:
[ FAILED ] WeakPluginPtr.Lifecycle
```

**Reproduces how often:**

Always

# Versions

```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic

$ gcc --version
gcc (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

# Additional Information

The error points to the macro `CHECK_FOR_LIBRARY` defined on `integration/utils.hh`

There’s a comment there saying:

> /////////////////////////////////////////////////
> // Note \(MXG\): According to some online discussions, there is no guarantee
> // that a correct number of calls to dlclose\(void\*\) will actually unload the
> // shared library. In fact, there is no guarantee that a dynamically loaded
> // library from dlopen will ever be unloaded until the program is terminated.
> // This may cause dlopen\(~, RTLD\_NOLOAD\) to return a non-null handle even if
> // we are managing the handles correctly. If the test for
> // EXPECT\_EQ\(nullptr, dlHandle\) is found to fail occasionally, we should
> // consider removing it because it may be unreliable. At the very least, if
> // it fails very infrequently, then we can safely consider the failures to be
> // false negatives and may want to consider relaxing this test.

Avoiding the check `EXPECT_EQ(nullptr, dlHandle)` in the macro `CHECK_FOR_LIBRARY` makes the test pass.

Contributor guide

Open the contributing guide

Research direction

Start with integration/utils.hh and the CHECK_FOR_LIBRARY macro, then run INTEGRATION_WeakPluginPtr to reproduce the failure in test/integration/WeakPluginPtr.cc. Review the EXPECT_EQ(nullptr, dlHandle) check against the documented dlopen/dlclose behavior; done means the test no longer reports this unreliable failure while retaining the intended lifecycle coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.