From 2c42cbffa210cee4b55b8b220ae61f2e7f39b649 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 7 Jan 2020 22:56:08 +0100 Subject: [PATCH] pytest: Fix optimistic locking in valgrind - developer config Valgrind doesn't really like crashes if compiled without DEVELOPER since that seems to compile out the debug symbols, resulting in the following error: ``` Optimistic lock on the database failed. There may be a concurrent access to the database. Aborting since concurrent access is unsafe. lightningd: FATAL SIGNAL 6 (version 0.0.99) lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd: FATAL SIGNAL 11 (version 0.0.99) lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable lightningd/lightningd: libbacktrace: no debug info in ELF executable 2020-01-07 15:26:03.539 EST [11583] LOG: unexpected EOF on client connection with an open transaction --------------------------- Captured stdout teardown --------------------------- DEBUG:root:Calling stop with payload None ------------------------------- Valgrind errors -------------------------------- Valgrind error file: valgrind-errors.11409 ==11409== Jump to the invalid address stated on the next line ==11409== at 0x0: ??? ==11409== by 0x1C00A8: backtrace_full (backtrace.c:127) ==11409== by 0x147B0A: send_backtrace (daemon.c:46) ==11409== by 0x147B55: crashdump (daemon.c:54) ==11409== by 0x6071F1F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so) ==11409== by 0x6071E96: __libc_signal_restore_set (nptl-signals.h:80) ==11409== by 0x6071E96: raise (raise.c:48) ==11409== by 0x6073800: abort (abort.c:79) ==11409== by 0x12B2FF: fatal (log.c:819) ==11409== by 0x16FA3B: db_data_version_incr (db.c:826) ==11409== by 0x16FA9E: db_commit_transaction (db.c:841) ==11409== by 0x124D20: io_loop_with_timers (io_loop_with_timers.c:34) ==11409== by 0x129260: main (lightningd.c:860) ==11409== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==11409== ==11409== ==11409== Process terminating with default action of signal 11 (SIGSEGV) ==11409== Bad permissions for mapped region at address 0x0 ==11409== at 0x0: ??? ==11409== by 0x1C00A8: backtrace_full (backtrace.c:127) ==11409== by 0x147B0A: send_backtrace (daemon.c:46) ==11409== by 0x147B55: crashdump (daemon.c:54) ==11409== by 0x6071F1F: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so) -------------------------------------------------------------------------------- ``` --- tests/test_db.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_db.py b/tests/test_db.py index c1e0c4edc..8379dd348 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -1,7 +1,7 @@ from fixtures import * # noqa: F401,F403 from fixtures import TEST_NETWORK from pyln.client import RpcError -from utils import wait_for, sync_blockheight, COMPAT +from utils import wait_for, sync_blockheight, COMPAT, VALGRIND, DEVELOPER import os import pytest import time @@ -140,6 +140,7 @@ def test_scid_upgrade(node_factory, bitcoind): assert l1.db_query('SELECT failchannel from payments;') == [{'failchannel': '103x1x1'}] +@unittest.skipIf(VALGRIND and not DEVELOPER, "Without developer valgrind will complain about debug symbols missing") def test_optimistic_locking(node_factory, bitcoind): """Have a node run against a DB, then change it under its feet, crashing it.