Libelektra: ASAN: Some Tests Fail on macOS with Enabled Leak Detection

Created on 23 Jul 2018  路  10Comments  路  Source: ElektraInitiative/libelektra

Steps to Reproduce the Problem

Enter the commands below at the root directory of the repository.

brew install llvm
export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
export ASAN_OPTIONS=detect_leaks=1
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

mkdir build
cd build
cmake .. -GNinja -DENABLE_ASAN=ON -DBUILD_TESTING=ON -DTOOLS='kdb' -DBINDINGS='cpp' -DPLUGINS='ALL'
ninja
ninja test

Expected Result

All tests finish successfully.

Actual Result

The following tests fail:

  • testtool_backendbuilder
  • testtool_plugindatabase
  • testmod_augeas
  • testmod_dbus
  • testmod_type
  • testscr_check_kdb_internal_check
  • testkdb_allplugins

.

System Information

  • Elektra Version: master
  • Operating System: macOS 10.13.6

Further Log Files and Output

Travis: Build with Enabled Leak Detection
Log Files:

bug build low priority

Most helpful comment

I'm on it. IMHO testmod_dbus is handling the unavailable dbus daemon rather gracefully (i.e. the test prints a warning and returns 0 errors) but the dbus library is producing a memory leak at least on macOS.
On Linux (stretch container) there is no leak without a dbus daemon.
API use seems fine (i.e. the error is freed before return) but I'll check if a call to dbus_shutdown() will fix this.

All 10 comments

Thank you for reporting this problem! What did change so that these errors occurred? Or were they always present and simply never reported before?

What did change so that these errors occurred?

The environment variable ASAN_OPTIONS.

Or were they always present and simply never reported before?

The tests failed before too. I was just to lazy to report the issue. Since the build system now excludes all problematic tests on Linux, I thought it would make sense to do the same on macOS.

Yes, it makes sense to automatically exclude tests that cannot work because of the platform/compiler/...

Let us discuss this tomorrow.

Is now augeas the only test case that fails or do still all of them fail?

All of them fail. The tests testscr_check_kdb_internal_check, testkdb_allplugins, and testtool_plugindatabase do fail because of the augeas plugin though.

The reason why testmod_dbus failed on my machine was that I did not start dbus beforehand:

brew services start dbus

. I still think it would make sense to handle this situation more gracefully, if it does not require that much work.

@waht Can you maybe take a look at the dbus issue?

I'm on it. IMHO testmod_dbus is handling the unavailable dbus daemon rather gracefully (i.e. the test prints a warning and returns 0 errors) but the dbus library is producing a memory leak at least on macOS.
On Linux (stretch container) there is no leak without a dbus daemon.
API use seems fine (i.e. the error is freed before return) but I'll check if a call to dbus_shutdown() will fix this.

It seems like dbus_shutdown() does the job: Travis Build Log
@sanssecours Do you want add the quite trivial fix to a PR of yours of should I create one?

@sanssecours Do you want add the quite trivial fix to a PR of yours of should I create one?

Thanks for taking care of the problem. I cherry-picked your commit in PR #2201.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sanssecours picture sanssecours  路  4Comments

markus2330 picture markus2330  路  3Comments

markus2330 picture markus2330  路  4Comments

dominicjaeger picture dominicjaeger  路  3Comments

e1528532 picture e1528532  路  4Comments