Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Check whether JNI plugin is broken due to JNA Gradle migration [JNA bindings] #3758

Closed
1 task
tucek opened this issue Apr 8, 2021 · 19 comments · Fixed by #3825
Closed
1 task

Check whether JNI plugin is broken due to JNA Gradle migration [JNA bindings] #3758

tucek opened this issue Apr 8, 2021 · 19 comments · Fixed by #3825
Assignees
Milestone

Comments

@tucek
Copy link
Contributor

tucek commented Apr 8, 2021

There might still be a reference to Maven in regard to using the JNI plugin.

  • check on which builds the test are running
@tucek tucek changed the title Check whether JNI plugin is broken due to #3 Check whether JNI plugin is broken due to JNA Gradle migration [JNA bindings] Apr 8, 2021
@tucek tucek self-assigned this Apr 8, 2021
@tucek tucek added the lang/java label Apr 8, 2021
@tucek tucek mentioned this issue Apr 8, 2021
6 tasks
@markus2330 markus2330 added this to the 0.9.5 milestone Apr 8, 2021
@markus2330
Copy link
Contributor

Thank you for reporting the problem! Yes, good if you double-check if maven is gone everywhere (except of the external tests, I think we should support also external Maven projects).

@mpranj mpranj modified the milestones: 0.9.5, 0.9.6 Apr 12, 2021
@mpranj
Copy link
Member

mpranj commented Apr 29, 2021

The JNI plugin uses Maven to add the unit tests. Since Maven was removed from most/all Dockerfiles etc. the JNI tests are not executed anywhere to my knowledge.

Can you update JNI to use Gradle?

Edit: You can find the relevant CMake somewhere here

if (ADDTESTING_PHASE)
check_binding_was_added ("jna" BINDING_WAS_ADDED)
find_program (MAVEN_EXECUTABLE mvn)

@markus2330
Copy link
Contributor

Yes, it would be important to get these tests running. They might reveal problems in the JNI plugin.

@tucek
Copy link
Contributor Author

tucek commented May 3, 2021

I will have look at it today...

@tucek
Copy link
Contributor Author

tucek commented May 3, 2021

  • check on which builds the test are running

@markus2330
Copy link
Contributor

markus2330 commented May 3, 2021

You can add TODOs with - [ ] in the top post, then GitHub shows you how many of them were already resolved.

@tucek
Copy link
Contributor Author

tucek commented May 3, 2021

The JNI plugin uses Maven to add the unit tests. Since Maven was removed from most/all Dockerfiles etc. the JNI tests are not executed anywhere to my knowledge.

Can you update JNI to use Gradle?

Edit: You can find the relevant CMake somewhere here

if (ADDTESTING_PHASE)
check_binding_was_added ("jna" BINDING_WAS_ADDED)
find_program (MAVEN_EXECUTABLE mvn)

I'm still trying to get it to work, but to be clear, the tests have been explicitly disabled before because of L42:

if (ADDTESTING_PHASE)
check_binding_was_added ("jna" BINDING_WAS_ADDED)
find_program (MAVEN_EXECUTABLE mvn)
if (ENABLE_BROKEN_TESTS)
if (BUILD_TESTING
AND BINDING_WAS_ADDED
AND MAVEN_EXECUTABLE)
add_plugintest (jni MEMLEAK)

From the git history, it seems to be disabled for years... or does someone build Elektra with ENABLE_BROKEN_TESTS somewhere?

@mpranj
Copy link
Member

mpranj commented May 4, 2021

the tests have been explicitly disabled

Good that you found that. I think it was temporarily disabled and then forgotten.

does someone build Elektra with ENABLE_BROKEN_TESTS somewhere?

It is not tested in our CI, which is what matters. Please remove the ENABLE_BROKEN_TESTS part such that the tests are enabled again.

tucek pushed a commit to tucek/libelektra that referenced this issue May 4, 2021
- removed maven dependency for JNI test
- re-enabled test
- TODO fix test
@tucek
Copy link
Contributor Author

tucek commented May 4, 2021

I've created PR #3825. Test is enabled and maven dependency has been removed. How can i execute the single "testmod_jni" test to see what is the problem?

@markus2330
Copy link
Contributor

ctest -V -R testmod_jni

@mpranj
Copy link
Member

mpranj commented May 4, 2021

On Cirrus CI, Fedora 34 it says:

160/268 Test #110: testmod_jni ...................................Subprocess aborted***Exception:   2.10 sec
JNI          TESTS
==================
free(): double free detected in tcache 2

@tucek
Copy link
Contributor Author

tucek commented May 4, 2021

getting the same thing:

$ ctest -V -R testmod_jni
UpdateCTestConfiguration  from :/mnt/c/Data/libelektra-tucek-next/build/DartConfiguration.tcl
Parse Config file:/mnt/c/Data/libelektra-tucek-next/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :/mnt/c/Data/libelektra-tucek-next/build/DartConfiguration.tcl
Parse Config file:/mnt/c/Data/libelektra-tucek-next/build/DartConfiguration.tcl
Test project /mnt/c/Data/libelektra-tucek-next/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 66
    Start 66: testmod_jni

66: Test command: /mnt/c/Data/libelektra-tucek-next/build/bin/testmod_jni "/mnt/c/Data/libelektra-tucek-next/src/plugins/jni"
66: Environment variables:
66:  LD_LIBRARY_PATH=/mnt/c/Data/libelektra-tucek-next/build/lib
66:  KDB_TEST_BIN_DIR=/mnt/c/Data/libelektra-tucek-next/build/bin
66: Test timeout computed to be: 1500
66: JNI          TESTS
66: ==================
66:
66: free(): double free detected in tcache 2
1/1 Test #66: testmod_jni ......................Child aborted***Exception:   0.47 sec

0% tests passed, 1 tests failed out of 1

Label Time Summary:
memleak    =   0.47 sec*proc (1 test)

Total Test time (real) =   2.76 sec

The following tests FAILED:
         66 - testmod_jni (Child aborted)
Errors while running CTest

Does someone with more C experience has time to debug the test?

@markus2330
Copy link
Contributor

@tucek can you try to reduce which test case causes the double free? Can you run it with valgrind and post the log? (remove MEMLEAK in line 49 and run make run_memcheck).

@tucek
Copy link
Contributor Author

tucek commented May 5, 2021

make run_memcheck

I've changed add_plugintest (jni MEMLEAK) to add_plugintest (jni), but get the following error:

tucek@DESKTOP-FIV77AF:/mnt/c/Data/libelektra-tucek-next/build$ make run_memcheck
   Site: DESKTOP-FIV77AF
   Build name: Linux-c++
Memory check project /mnt/c/Data/libelektra-tucek-next/build
Memory checker (MemoryCheckCommand) not set, or cannot find the specified program.
Errors while running CTest
   Site: DESKTOP-FIV77AF
   Build name: Linux-c++
Memory check project /mnt/c/Data/libelektra-tucek-next/build
Memory checker (MemoryCheckCommand) not set, or cannot find the specified program.
Errors while running CTest
make[3]: *** [tests/CMakeFiles/run_memcheck.dir/build.make:57: tests/CMakeFiles/run_memcheck] Error 16
make[2]: *** [CMakeFiles/Makefile2:16337: tests/CMakeFiles/run_memcheck.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:16344: tests/CMakeFiles/run_memcheck.dir/rule] Error 2
make: *** [Makefile:5839: run_memcheck] Error 2

am I missing a dependency?

Reproduction:
check out branch PR #3825 is based on
enabled plugin jni
make
execute ctest -V -R testmod_jni

@mpranj
Copy link
Member

mpranj commented May 5, 2021

You need valgrind installed, to execute the memcheck.

@tucek
Copy link
Contributor Author

tucek commented May 5, 2021

still getting the same output after successfully installing valgrind:

$ sudo apt-get install valgrind
[sudo] password for tucek:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  gdb gdbserver libbabeltrace1 libc6-dbg libdw1
Suggested packages:
  gdb-doc valgrind-dbg valgrind-mpi kcachegrind alleyoop valkyrie
The following NEW packages will be installed:
  gdb gdbserver libbabeltrace1 libc6-dbg libdw1 valgrind
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 34.6 MB of archives.
After this operation, 179 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libdw1 amd64 0.176-1.1build1 [226 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 libbabeltrace1 amd64 1.5.8-1build1 [156 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gdb amd64 9.2-0ubuntu1~20.04 [3221 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gdbserver amd64 9.2-0ubuntu1~20.04 [222 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libc6-dbg amd64 2.31-0ubuntu9.2 [10.5 MB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 valgrind amd64 1:3.15.0-1ubuntu9.1 [20.3 MB]
Fetched 34.6 MB in 3s (10.4 MB/s)
Selecting previously unselected package libdw1:amd64.
(Reading database ... 49975 files and directories currently installed.)
Preparing to unpack .../0-libdw1_0.176-1.1build1_amd64.deb ...
Unpacking libdw1:amd64 (0.176-1.1build1) ...
Selecting previously unselected package libbabeltrace1:amd64.
Preparing to unpack .../1-libbabeltrace1_1.5.8-1build1_amd64.deb ...
Unpacking libbabeltrace1:amd64 (1.5.8-1build1) ...
Selecting previously unselected package gdb.
Preparing to unpack .../2-gdb_9.2-0ubuntu1~20.04_amd64.deb ...
Unpacking gdb (9.2-0ubuntu1~20.04) ...
Selecting previously unselected package gdbserver.
Preparing to unpack .../3-gdbserver_9.2-0ubuntu1~20.04_amd64.deb ...
Unpacking gdbserver (9.2-0ubuntu1~20.04) ...
Selecting previously unselected package libc6-dbg:amd64.
Preparing to unpack .../4-libc6-dbg_2.31-0ubuntu9.2_amd64.deb ...
Unpacking libc6-dbg:amd64 (2.31-0ubuntu9.2) ...
Selecting previously unselected package valgrind.
Preparing to unpack .../5-valgrind_1%3a3.15.0-1ubuntu9.1_amd64.deb ...
Unpacking valgrind (1:3.15.0-1ubuntu9.1) ...
Setting up libdw1:amd64 (0.176-1.1build1) ...
Setting up libc6-dbg:amd64 (2.31-0ubuntu9.2) ...
Setting up libbabeltrace1:amd64 (1.5.8-1build1) ...
Setting up gdbserver (9.2-0ubuntu1~20.04) ...
Setting up valgrind (1:3.15.0-1ubuntu9.1) ...
Setting up gdb (9.2-0ubuntu1~20.04) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
$ valgrind
valgrind: no program specified
valgrind: Use --help for more information.

@markus2330
Copy link
Contributor

@tucek did you try to completely remove the build directory? I don't think cmake checks for valgrind again later.

Btw. if you do this in a PR, we should be also be able to download the artifacts from the buildserver.

@tucek
Copy link
Contributor Author

tucek commented May 6, 2021

@markus2330
Copy link
Contributor

I answered in #3825

tucek pushed a commit to tucek/libelektra that referenced this issue May 9, 2021
* updated gradle to 7.0
* removed debug output
@tucek tucek linked a pull request May 13, 2021 that will close this issue
20 tasks
tucek pushed a commit to tucek/libelektra that referenced this issue May 14, 2021
- removed maven dependency for JNI test
- re-enabled test
- TODO fix test
tucek pushed a commit to tucek/libelektra that referenced this issue May 14, 2021
* updated gradle to 7.0
* removed debug output
tucek pushed a commit to tucek/libelektra that referenced this issue May 19, 2021
- removed maven dependency for JNI test
- re-enabled test
- TODO fix test
tucek pushed a commit to tucek/libelektra that referenced this issue May 19, 2021
* updated gradle to 7.0
* removed debug output
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants