dernasherbrezon / sdr-server

High performant TCP server for rtl-sdr
GNU General Public License v2.0
173 stars 16 forks source link

test_core segfaults #8

Closed nickoe closed 2 years ago

nickoe commented 2 years ago

Hi

I just wanted to try this out and was just mucking around. I noticed that the check package is noted optional as currently mentioned in the readme, but cmake requires it when configuring -- so I just installed it and I built it all successfully.

Because I installed check I just tried to run the test binaries, but test_core segfaults for me:

nickoe@z620 build]$ ./test_core 
Running suite(s): core
loading configuration from: core.config
bias-t: 0
gain mode: 1
gain: 4.200000
ppm: 10
queue_size: 64
band sampling rate: 48000
buffer size: 131072
lpf_cutoff_rate: 24
start listening on 127.0.0.1:8089
read timeout 5s
base path for storing results: /tmp
using gzip: 0
rtl-sdr is starting
the actual nearest supported gain is: 4.300000
[0] dsp_worker is starting
[1] dsp_worker is starting
[1] dsp_worker is stopping
[1] dsp_worker stopped
rtl-sdr is stopping
rtl-sdr stopped
[0] dsp_worker is stopping
[0] dsp_worker stopped
checking: /tmp/0.cf32
checking: /tmp/1.cf32
loading configuration from: core.config
bias-t: 0
gain mode: 1
gain: 4.200000
ppm: 10
queue_size: 64
band sampling rate: 48000
buffer size: 131072
lpf_cutoff_rate: 24
start listening on 127.0.0.1:8089
read timeout 5s
base path for storing results: /tmp
using gzip: 0
<3>cutoff frequency should be positive and less than sampling freq / 2. got: 24500
[0] dsp_worker is stopping
Segmentation fault (core dumped)
[nickoe@z620 build]$ coredumpctl gdb
<<<snip>>>
Core was generated by `./test_core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f3712f67662 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
(gdb) bt
#0  0x00007f3712f67662 in __pthread_clockjoin_ex () from /usr/lib/libpthread.so.0
#1  0x00005644077aa04b in destroy_node ()
#2  0x00005644077aa1f2 in add_client ()
#3  0x00005644077ab891 in test_invalid_lpf_config_fn ()
#4  0x00007f3713460b82 in ?? () from /usr/lib/libcheck.so.0
#5  0x00007f37134611a2 in srunner_run_tagged () from /usr/lib/libcheck.so.0
#6  0x00005644077ac48d in main ()
quit) 
[nickoe@z620 build]$ git describe  --tags
1.0.0-68-gb9cf76f
nickoe commented 2 years ago

Running with with valgrind as the run_tests.sh script does I get an error in the error summary as well:

==1351498== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
dernasherbrezon commented 2 years ago

Can you paste full valgrind output? CI shows no errors: https://app.travis-ci.com/github/dernasherbrezon/sdr-server/jobs/546370841

nickoe commented 2 years ago

@dernasherbrezon Sure. Here is the output from valgrind:

[nickoe@z620 build]$ valgrind -v --error-exitcode=1 -q --tool=memcheck --leak-check=yes --show-reachable=yes ./test_core 
==1356045== Memcheck, a memory error detector
==1356045== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1356045== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==1356045== Command: ./test_core
==1356045== 
Running suite(s): core
loading configuration from: core.config
bias-t: 0
gain mode: 1
gain: 4.200000
ppm: 10
queue_size: 64
band sampling rate: 48000
buffer size: 131072
lpf_cutoff_rate: 24
start listening on 127.0.0.1:8089
read timeout 5s
base path for storing results: /tmp
using gzip: 0
rtl-sdr is starting
the actual nearest supported gain is: 4.300000
[0] dsp_worker is starting
[1] dsp_worker is starting
[1] dsp_worker is stopping
[1] dsp_worker stopped
rtl-sdr is stopping
rtl-sdr stopped
[0] dsp_worker is stopping
[0] dsp_worker stopped
checking: /tmp/0.cf32
checking: /tmp/1.cf32
loading configuration from: core.config
bias-t: 0
gain mode: 1
gain: 4.200000
ppm: 10
queue_size: 64
band sampling rate: 48000
buffer size: 131072
lpf_cutoff_rate: 24
start listening on 127.0.0.1:8089
read timeout 5s
base path for storing results: /tmp
using gzip: 0
<3>cutoff frequency should be positive and less than sampling freq / 2. got: 24500
[0] dsp_worker is stopping
==1356045== Invalid read of size 4
==1356045==    at 0x4D94662: __pthread_clockjoin_ex (in /usr/lib/libpthread-2.33.so)
==1356045==    by 0x10C04A: destroy_node (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10C1F1: add_client (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D890: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045==  Address 0x2d0 is not stack'd, malloc'd or (recently) free'd
==1356045== 
==1356045== 
==1356045== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==1356045==  Access not within mapped region at address 0x2D0
==1356045==    at 0x4D94662: __pthread_clockjoin_ex (in /usr/lib/libpthread-2.33.so)
==1356045==    by 0x10C04A: destroy_node (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10C1F1: add_client (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D890: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045==  If you believe this happened as a result of a stack
==1356045==  overflow in your program's main thread (unlikely but
==1356045==  possible), you can try to increase the size of the
==1356045==  main thread stack using the --main-stacksize= flag.
==1356045==  The main thread stack size used in this run was 8388608.
==1356045== 
==1356045== HEAP SUMMARY:
==1356045==     in use at exit: 132,671 bytes in 46 blocks
==1356045==   total heap usage: 845 allocs, 799 frees, 18,460,763 bytes allocated
==1356045== 
==1356045== 5 bytes in 1 blocks are still reachable in loss record 1 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x10EF5D: read_and_copy_str (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10F6A4: create_server_config (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D78F: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 7 bytes in 1 blocks are still reachable in loss record 2 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x4F7E34E: strdup (in /usr/lib/libc-2.33.so)
==1356045==    by 0x48A6B9B: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 3 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A312F: suite_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E358: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 4 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A335B: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 5 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3366: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 6 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3371: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 7 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A337C: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 8 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3387: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 9 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A38BD: srunner_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E466: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 10 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A38F6: srunner_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E466: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 11 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4BFE: srunner_init_logging (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6D29: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 12 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A33DC: tag_string_to_list (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6D40: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 8 bytes in 1 blocks are still reachable in loss record 13 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4098: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A33DC: tag_string_to_list (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6D53: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 10 bytes in 1 blocks are still reachable in loss record 14 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x10EF5D: read_and_copy_str (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10F4D9: create_server_config (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D78F: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 12 bytes in 1 blocks are still reachable in loss record 15 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A38DD: srunner_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E466: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 16 bytes in 1 blocks are still reachable in loss record 16 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3114: suite_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E358: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 16 bytes in 1 blocks are still reachable in loss record 17 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A36AC: tcase_add_checked_fixture (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E430: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 16 bytes in 1 blocks are still reachable in loss record 18 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A36D4: tcase_add_checked_fixture (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E430: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 19 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A312F: suite_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E358: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 20 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3350: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 21 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A335B: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 22 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3366: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 23 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3371: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 24 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A337C: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 25 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3387: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 26 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A35C4: _tcase_add_test (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E398: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 27 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A35C4: _tcase_add_test (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E3C1: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 28 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A35C4: _tcase_add_test (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E3EA: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 29 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A35C4: _tcase_add_test (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E413: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 30 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A38BD: srunner_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E466: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 31 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A38F6: srunner_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E466: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 32 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4BFE: srunner_init_logging (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6D29: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 33 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4A44: srunner_register_lfun (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4C22: srunner_init_logging (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6D29: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 34 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A33DC: tag_string_to_list (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6D40: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 24 bytes in 1 blocks are still reachable in loss record 35 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A407C: check_list_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A33DC: tag_string_to_list (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6D53: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 32 bytes in 1 blocks are still reachable in loss record 36 of 46
==1356045==    at 0x484383F: realloc (vg_replace_malloc.c:1192)
==1356045==    by 0x48A404A: erealloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A4182: check_list_add_end (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E3EA: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 37 bytes in 1 blocks are still reachable in loss record 37 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x4F7E34E: strdup (in /usr/lib/libc-2.33.so)
==1356045==    by 0x48A5E17: punpack (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A50F7: receive_test_result (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6B24: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 40 bytes in 1 blocks are still reachable in loss record 38 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x10CBB2: create_client_config (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D873: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 56 bytes in 1 blocks are still reachable in loss record 39 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A3A5E: tr_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A5147: receive_test_result (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6B24: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 56 bytes in 1 blocks are still reachable in loss record 40 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x10C0F1: add_client (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D890: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 64 bytes in 1 blocks are still reachable in loss record 41 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A38B4: srunner_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E466: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 64 bytes in 1 blocks are still reachable in loss record 42 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x10EFF9: create_server_config (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D78F: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 72 bytes in 1 blocks are still reachable in loss record 43 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x48A401A: emalloc (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A31E4: tcase_create (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E36B: common_suite (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10E456: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 128 bytes in 1 blocks are still reachable in loss record 44 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x10B6BB: create_core (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D7DA: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 472 bytes in 1 blocks are still reachable in loss record 45 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x4F63980: fdopen@@GLIBC_2.2.5 (in /usr/lib/libc-2.33.so)
==1356045==    by 0x48A508F: open_tmp_file (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A523C: receive_test_result (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A68DB: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A6A3C: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== 131,072 bytes in 1 blocks are still reachable in loss record 46 of 46
==1356045==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
==1356045==    by 0x10B718: create_core (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x10D7DA: test_invalid_lpf_config_fn (in /home/nickoe/sdr-server/build/test_core)
==1356045==    by 0x48A6B81: ??? (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x48A71A1: srunner_run_tagged (in /usr/lib/libcheck.so.0.15.2)
==1356045==    by 0x10E48C: main (in /home/nickoe/sdr-server/build/test_core)
==1356045== 
==1356045== LEAK SUMMARY:
==1356045==    definitely lost: 0 bytes in 0 blocks
==1356045==    indirectly lost: 0 bytes in 0 blocks
==1356045==      possibly lost: 0 bytes in 0 blocks
==1356045==    still reachable: 132,671 bytes in 46 blocks
==1356045==         suppressed: 0 bytes in 0 blocks
==1356045== 
==1356045== For lists of detected and suppressed errors, rerun with: -s
==1356045== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
dernasherbrezon commented 2 years ago

segfault is in pthread, which is coming from libpthread-2.33.so. I found this version only in Ubuntu 21.04. And I cannot reproduce it there:

ubuntu@ip-172-30-0-161:~/sdr-server/build$ valgrind -v --error-exitcode=1 -q --tool=memcheck --leak-check=yes --show-reachable=yes ./test_core
==10444== Memcheck, a memory error detector
==10444== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==10444== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==10444== Command: ./test_core
==10444== 
Running suite(s): core
loading configuration from: core.config
bias-t: 0
gain mode: 1
.............
using gzip: 0
<3>cutoff frequency should be positive and less than sampling freq / 2. got: 24500
[0] dsp_worker is stopping
loading configuration from: core.config
...................
<3>unable to open file for output: /non-existing-directory-in-root/0.cf32
[0] dsp_worker is stopping
100%: Checks: 4, Failures: 0, Errors: 0
==10444== 
==10444== HEAP SUMMARY:
==10444==     in use at exit: 0 bytes in 0 blocks
==10444==   total heap usage: 1,406 allocs, 1,406 frees, 29,467,239 bytes allocated
==10444== 
==10444== All heap blocks were freed -- no leaks are possible
==10444== 
==10444== For lists of detected and suppressed errors, rerun with: -s
==10444== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

What operation system are you using? Is it 100% reproducible?

nickoe commented 2 years ago

Sorry for the delay in response, but yes, it is 100% reproducible. I am using Archlinux on my workstation, I also tried it on my laptop with archlinux as well. test_core also segfaults with the same backtrace in gdb.

I am not sure if the verison of lib rtl sdr is important, but I have local/rtl-sdr-git 1:0.6.0.r32.gd770add-1

dernasherbrezon commented 2 years ago

Yes, I was able to reproduce this on Archlinux. It looks like something to do with glibc version. I will investigate further.

nickoe commented 2 years ago

I can confirm that your fix in 023ed2b552b783b5e8052dfc029812e9a256e48d appears to fix the segfault! :dancers: