MariaDB 10.2 mysql_install_db hangs - mariadb

I'm running MariaDB (10.2.13) in a docker container based on Alpine (https://github.com/wodby/mariadb) and from time to time the initial start just hangs when running /usr/bin/mysql_install_db. I've found out that it hangs in function mysqld_install_cmd_line when running mysqld for the first time with --bootstrap.
Any ideas what could it be? Didn't happen with MariaDB 10.2.11
+ mysql_install_db --datadir=/var/lib/mysql/ --rpm
+ basedir=
+ builddir=
+ ldata=/var/lib/mysql
+ langdir=
+ srcdir=
+ args=
+ defaults=
+ defaults_group_suffix=
+ mysqld_opt=
+ user=
+ silent_startup=--silent-startup
+ force=0
+ in_rpm=0
+ ip_only=0
+ cross_bootstrap=0
+ install_params=
+ auth_root_authentication_method=normal
+ auth_root_socket_user=root
+ parse_arguments --datadir=/var/lib/mysql/ --rpm
+ pick_args=
+ test --datadir=/var/lib/mysql/ = PICK-ARGS-FROM-ARGV
+ parse_arg --datadir=/var/lib/mysql/
+ echo --datadir=/var/lib/mysql/
+ sed -e s/^[^=]*=//
+ ldata=/var/lib/mysql/
+ in_rpm=1
+ test -n
+ test -n
+ test -n
+ print_defaults=/usr/bin/my_print_defaults
+ test ! -x /usr/bin/my_print_defaults
+ /usr/bin/my_print_defaults --mysqld mysql_install_db
+ parse_arguments --user=mysql --bind-address=0.0.0.0 --basedir=/usr --datadir=/var/lib/mysql --socket=/var/run/mysqld/mysqld.sock --log-warnings --collation-server=utf8_unicode_ci --init_connect=SET NAMES utf8 --character_set_server=utf8 --character_set_filesystem=utf8 --symbolic-links=0 --default_storage_engine=InnoDB --skip-character-set-client-handshake --skip-name-resolve --back_log=100 --join_buffer_size=8M --max_heap_table_size=16M --query_cache_limit=1M --query_cache_min_res_unit=4K --query_cache_size=128M --query_cache_type=ON --sort_buffer_size=2M --table_definition_cache=400 --table_open_cache=4096 --thread_cache_size=75 --tmp_table_size=16M --max_allowed_packet=256M --max_connect_errors=100000 --max_connections=100 --innodb_buffer_pool_instances=4 --innodb_buffer_pool_size=1G --innodb_data_file_path=ibdata1:10M:autoextend:max:10G --innodb_file_per_table=1 --innodb_flush_method=O_DIRECT --innodb_flush_log_at_trx_commit=2 --innodb_io_capacity=200 --innodb_lock_wait_timeout=50 --innodb_log_buffer_size=8M --innodb_log_file_size=128M --innodb_log_files_in_group=2 --innodb_old_blocks_time=1000 --innodb_open_files=1024 --innodb_read_io_threads=4 --innodb_stats_on_metadata=OFF --innodb_strict_mode=OFF --innodb_write_io_threads=4 --innodb_force_load_corrupted=0 --innodb_fast_shutdown=1 --performance_schema=OFF --long_query_time=2 --slow_query_log=OFF --general_log=0 --net_write_timeout=90 --net_read_timeout=90 --wait_timeout=420 --interactive_timeout=420 --relay_log_recovery=0
+ pick_args=
+ test --user=mysql = PICK-ARGS-FROM-ARGV
+ parse_arg --user=mysql
+ echo --user=mysql
+ sed -e s/^[^=]*=//
+ user=mysql
+ test -n
+ parse_arg --basedir=/usr
+ echo --basedir=/usr
+ sed -e s/^[^=]*=//
+ basedir=/usr
+ parse_arg --datadir=/var/lib/mysql
+ echo --datadir=/var/lib/mysql
+ sed -e s/^[^=]*=//
+ ldata=/var/lib/mysql
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ ip_only=1
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ test -n
+ parse_arguments PICK-ARGS-FROM-ARGV --datadir=/var/lib/mysql/ --rpm
+ pick_args=
+ test PICK-ARGS-FROM-ARGV = PICK-ARGS-FROM-ARGV
+ pick_args=1
+ shift
+ parse_arg --datadir=/var/lib/mysql/
+ echo --datadir=/var/lib/mysql/
+ sed -e s/^[^=]*=//
+ ldata=/var/lib/mysql/
+ in_rpm=1
+ test -n
+ test -n /usr
+ bindir=/usr/bin
+ find_in_dirs resolveip /usr/bin /usr/bin
+ file=resolveip
+ shift
+ test -f /usr/bin/resolveip
+ test -n
+ echo /usr/bin/resolveip
+ break
+ resolveip=/usr/bin/resolveip
+ test -z /usr/bin/resolveip
+ find_in_dirs mysqld /usr/bin /usr/libexec /usr/sbin /usr/bin
+ file=mysqld
+ shift
+ test -f /usr/bin/mysqld
+ test -n
+ echo /usr/bin/mysqld
+ break
+ mysqld=/usr/bin/mysqld
+ test -z /usr/bin/mysqld
+ find_in_dirs --dir errmsg.sys /usr/share/mysql/english /usr/share/english /usr/share/mysql/english
+ return_dir=1
+ shift
+ file=errmsg.sys
+ shift
+ test -f /usr/share/mysql/english/errmsg.sys
+ test -n 1
+ echo /usr/share/mysql/english
+ break
+ langdir=/usr/share/mysql/english
+ test -z /usr/share/mysql/english
+ find_in_dirs --dir fill_help_tables.sql /usr/share/mysql /usr/share /usr/share/mysql
+ return_dir=1
+ shift
+ file=fill_help_tables.sql
+ shift
+ test -f /usr/share/mysql/fill_help_tables.sql
+ test -n 1
+ echo /usr/share/mysql
+ break
+ srcpkgdatadir=/usr/share/mysql
+ buildpkgdatadir=/usr/share/mysql
+ test -z /usr/share/mysql
+ fill_help_tables=/usr/share/mysql/fill_help_tables.sql
+ create_system_tables=/usr/share/mysql/mysql_system_tables.sql
+ create_system_tables2=/usr/share/mysql/mysql_performance_tables.sql
+ fill_system_tables=/usr/share/mysql/mysql_system_tables_data.sql
+ maria_add_gis_sp=/usr/share/mysql/maria_add_gis_sp_bootstrap.sql
+ test ! -f /usr/share/mysql/fill_help_tables.sql
+ test ! -f /usr/share/mysql/mysql_system_tables.sql
+ test ! -f /usr/share/mysql/mysql_performance_tables.sql
+ test ! -f /usr/share/mysql/mysql_system_tables_data.sql
+ test ! -f /usr/share/mysql/maria_add_gis_sp_bootstrap.sql
+ test ! -x /usr/bin/mysqld
+ test -n /usr/share/mysql/english
+ test ! -f /usr/share/mysql/english/errmsg.sys
+ mysqld_opt=--lc-messages-dir=/usr/share/mysql/english/..
+ hostname
+ hostname=mariadb-4070839347-8qx3q
+ test 0 -eq 0 -a 1 -eq 0 -a 0 -eq 0
+ test 1 -eq 1
+ echo
+ awk / /{print $6}
+ hostname=
+ test ! -d /var/lib/mysql/
+ test -n mysql
+ chown mysql /var/lib/mysql/
+ test 0 -ne 0
+ test ! -d /var/lib/mysql//mysql
+ mkdir -p /var/lib/mysql//mysql
+
+ chmod 700 /var/lib/mysql//mysql
+ test -n mysql
+ chown mysql /var/lib/mysql//mysql
+ test 0 -ne 0
+ test ! -d /var/lib/mysql//test
+ mkdir -p /var/lib/mysql//test
+
+ chmod 700 /var/lib/mysql//test
+ test -n mysql
+ chown mysql /var/lib/mysql//test
+ test 0 -ne 0
+ test -n mysql
+ args= --user=mysql
+ test 0 -eq 1
+ filter_cmd_line=cat
+ mysqld_bootstrap=/usr/bin/mysqld
+ s_echo Installing MariaDB/MySQL system tables in '/var/lib/mysql/' ...
+ test 1 -eq 0 -a 0 -eq 0
+ install_params=
SET #skip_auth_root_nopasswd=NULL;
SET #auth_root_socket=NULL;
+ echo use mysql;
SET #skip_auth_root_nopasswd=NULL;
SET #auth_root_socket=NULL;
+ cat /usr/share/mysql/mysql_system_tables.sql /usr/share/mysql/mysql_performance_tables.sql /usr/share/mysql/mysql_system_tables_data.sql /usr/share/mysql/fill_help_tables.sql /usr/share/mysql/maria_add_gis_sp_bootstrap.sql
+ mysqld_install_cmd_line
+ /usr/bin/mysqld --lc-messages-dir=/usr/share/mysql/english/.. --bootstrap --basedir=/usr --datadir=/var/lib/mysql/ --enforce-storage-engine= --user=mysql --max_allowed_packet=8M --net_buffer_length=16K
+ eval cat
+ cat
2018-02-20 8:25:22 140043505183624 [Note] /usr/bin/mysqld (mysqld 10.2.13-MariaDB) starting as process 59 ...
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Uses event mutexes
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Using Linux native AIO
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Number of pools: 1
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Using SSE2 crc32 instructions
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 4, chunk size = 128M
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Completed initialization of buffer pool
2018-02-20 8:25:22 140042030324456 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Setting file './ibdata1' size to 10 MB. Physically writing the file full; Please wait ...
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: File './ibdata1' size is now 10 MB.
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Setting log file ./ib_logfile101 size to 134217728 bytes
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Setting log file ./ib_logfile1 size to 134217728 bytes
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: New log files created, LSN=45790
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Doublewrite buffer created
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: 128 out of 128 rollback segments are active.
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Creating foreign key constraint system tables.
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Creating sys_virtual system tables.
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: Waiting for purge to start
2018-02-20 8:25:22 140043505183624 [Note] InnoDB: 5.7.21 started; log sequence number 0
2018-02-20 8:25:22 140043505183624 [Note] Plugin 'FEEDBACK' is disabled.
UPDATED:
I compiled MariaDB with CMAKE_BUILD_TYPE=Debug mode but couldn't reproduce this bug, tried RelWithDebInfo as was suggested by #elenst here and this is what I got:
# ps aux
PID USER TIME COMMAND
1 mysql 0:00 bash /docker-entrypoint.sh mysqld
13 mysql 0:00 {init_mariadb} /bin/bash /usr/local/bin/init_mariadb mysqld
25 mysql 0:00 {mysql_install_d} /bin/sh /usr/bin/mysql_install_db --datadir=/var/lib/mysql/ --rpm
59 mysql 0:00 {mysql_install_d} /bin/sh /usr/bin/mysql_install_db --datadir=/var/lib/mysql/ --rpm
61 mysql 0:00 /usr/bin/mysqld --lc-messages-dir=/usr/share/mysql/english/.. --bootstrap --basedir=/usr --datadir=/var/lib/mysql/ --debug --enforce-storage-engine= --user
159 root 0:00 sh
167 root 0:00 ps aux
# strace -p 61
strace: Process 61 attached
restart_syscall(<... resuming interrupted nanosleep ...>) = 0
nanosleep({tv_sec=0, tv_nsec=100000000}, NULL) = 0
nanosleep({tv_sec=0, tv_nsec=100000000}, NULL) = 0
nanosleep({tv_sec=0, tv_nsec=100000000}, NULL) = 0
nanosleep({tv_sec=0, tv_nsec=100000000}, NULL) = 0
...
strace of all other processes shows wait4(-1,
UPDATED 2:
# gdb --batch --eval-command="thread apply all bt full" /usr/bin/mysqld 61
[New LWP 62]
[New LWP 63]
[New LWP 64]
[New LWP 65]
[New LWP 66]
[New LWP 67]
[New LWP 68]
[New LWP 69]
[New LWP 70]
[New LWP 71]
[New LWP 72]
[New LWP 73]
[New LWP 76]
[New LWP 92]
0x00007fc86ec6af33 in __clone () from /lib/ld-musl-x86_64.so.1
Thread 15 (LWP 92):
#0 0x00007fc86ec6af33 in __clone () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#1 0x00007fc86ec68663 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#2 0x00007fc817d53b30 in ?? ()
No symbol table info available.
#3 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 14 (LWP 76):
#0 0x00007fc86ec6af33 in __clone () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#1 0x00007fc86ec68663 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#2 0x00007fc816fd4b30 in ?? ()
No symbol table info available.
#3 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 13 (LWP 73):
#0 0x00007fc86ec6af33 in __clone () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#1 0x00007fc86ec68663 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#2 0x00007fc817019b30 in ?? ()
No symbol table info available.
#3 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 12 (LWP 72):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 11 (LWP 71):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 10 (LWP 70):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 9 (LWP 69):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 8 (LWP 68):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 7 (LWP 67):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 6 (LWP 66):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 5 (LWP 65):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 4 (LWP 64):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 3 (LWP 63):
#0 0x00007fc86ea15585 in ?? () from /usr/lib/libaio.so.1
No symbol table info available.
#1 0x000055e3f43759c1 in ?? ()
No symbol table info available.
#2 0x000055e3f4375f12 in ?? ()
No symbol table info available.
#3 0x000055e3f4377831 in ?? ()
No symbol table info available.
#4 0x000055e3f450ca5a in ?? ()
No symbol table info available.
#5 0x000055e3f440f9a8 in ?? ()
No symbol table info available.
#6 0x00007fc86ec68ff8 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#7 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 2 (LWP 62):
#0 0x00007fc86ec6af33 in __clone () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#1 0x00007fc86ec68663 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#2 0x00007fc86ee9db30 in ?? ()
No symbol table info available.
#3 0x0000000000000000 in ?? ()
No symbol table info available.
Thread 1 (LWP 61):
#0 0x00007fc86ec6af33 in __clone () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#1 0x00007fc86ec68663 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#2 0x00007fc86eea2bd0 in ?? () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#3 0x0000000000000000 in ?? ()
No symbol table info available.

Related

Deadlock in Berkeley DB?

I'm using berkeley db to store 100 milion keys and theirs values. There is one instance of berkeley db on the server. One writer adds and removes records and five readers (five independent applications) read proper values.
Sometimes one of my readers stucks and I have to kill it and run it again. I attached to it using gdb:
[Switching to LWP 100674 of process 54232]
0x0000000000886771 in __lock_ohash ()
(gdb) where
#0 0x0000000000886771 in __lock_ohash ()
#1 0x000000000087a1c4 in __lock_get_internal ()
#2 0x00000000008793d4 in __lock_vec ()
#3 0x000000000078e094 in __db_lget ()
#4 0x00000000007ff26d in __bam_search ()
#5 0x00000000007f07f6 in __bamc_search ()
#6 0x00000000007edb13 in __bamc_get ()
#7 0x0000000000783091 in __dbc_iget ()
#8 0x000000000078b793 in __dbc_get_pp ()
#9 0x0000000000762a5a in Dbc::get(Dbt*, Dbt*, unsigned int) ()
...
Why does it stuck in __lock_ohash() function? When it stucks the whole application freezes until I kill it. Is it a deadlock? Why database does not manage and solve it?
Version of berkeley db: 18.1.40
Flags used by writer and readers:
uint32_t flags = DB_INIT_LOCK | DB_INIT_MPOOL | DB_SYSTEM_MEM | DB_INIT_TXN |
DB_CREATE | DB_REGISTER;
OS: FreeBSD 13.0-RELEASE-p6
Shared memory info:
[adg#ovhs8 ~]$ ipcs -M
shminfo:
shmmax: 4294967296 (max shared memory segment size)
shmmin: 1 (min shared memory segment size)
shmmni: 192 (max number of shared memory identifiers)
shmseg: 128 (max shared memory segments per process)
shmall: 1048576 (max amount of shared memory in pages)
Database size - 4,6 GB:
[adg#ovhs8 ~/adg_db/Database/database]$ ls -ltrh
total 3349522
-rw-r----- 1 adg adg 10M Mar 13 23:11 log.0000000001
-rw-r----- 1 adg adg 4.6G Mar 14 09:26 adgdatabase.db
-rw-r----- 1 adg adg 24B Mar 14 09:29 __db.001
-rw-r----- 1 adg adg 200B Mar 14 09:30 __db.register

Address Sanitizer on a python extension result in AddressSanitizer:DEADLYSIGNAL

c source code as below:
#include<stdlib.h>
#include<stdio.h>
#include "demo_c.h"
void func(data_pair* pair) {
printf("func called");
pair->len=4;
pair->data = (char*)malloc(pair->len + 1);
memset(pair->data, 0, pair->len + 1);
memcpy(pair->data, "test", 4);
return;
}
gcc -fpic -c demo_c.c -fno-omit-frame-pointer -fsanitize=address -fsanitize-recover=address
gcc --share demo_c.o -o libdemo_c.so
then I import this library in python like this:
from ctypes import *
demo_c = CDLL('/xxx/libdemo_c.so', RTLD_GLOBAL)
libc = CDLL('libc.so.6')
libc.free.argtypes = [c_void_p]
class entry(Structure):
_fields_ = [('len',c_int),
('data', c_void_p)]
v = entry()
demo_c.func.argtypes = [c_void_p]
demo_c.func(byref(v))
libc.free(v.data)
then I run:
LD_PRELOAD=/lib64/libasan.so.5 python demo.py
output is:
AddressSanitizer:DEADLYSIGNAL
=================================================================
==432489==ERROR: AddressSanitizer: BUS on unknown address 0x000000000000 (pc 0x7f281c9c90fe bp 0x200000000000003 sp 0x7ffe0c369b20 T0)
#0 0x7f281c9c90fd in _int_free (/lib64/libc.so.6+0x810fd)
#1 0x7f281356cdcb in ffi_call_unix64 (/lib64/libffi.so.6+0x5dcb)
#2 0x7f281356c6f4 in ffi_call (/lib64/libffi.so.6+0x56f4)
#3 0x7f281377fc6a in _ctypes_callproc (/usr/lib64/python2.7/lib-dynload/_ctypes.so+0x10c6a)
#4 0x7f2813779a64 (/usr/lib64/python2.7/lib-dynload/_ctypes.so+0xaa64)
#5 0x7f281d687072 in PyObject_Call (/lib64/libpython2.7.so.1.0+0x4c072)
#6 0x7f281d71b845 in PyEval_EvalFrameEx (/lib64/libpython2.7.so.1.0+0xe0845)
#7 0x7f281d72264c in PyEval_EvalCodeEx (/lib64/libpython2.7.so.1.0+0xe764c)
#8 0x7f281d722751 in PyEval_EvalCode (/lib64/libpython2.7.so.1.0+0xe7751)
#9 0x7f281d73bb8e (/lib64/libpython2.7.so.1.0+0x100b8e)
#10 0x7f281d73cd5d in PyRun_FileExFlags (/lib64/libpython2.7.so.1.0+0x101d5d)
#11 0x7f281d73dfe8 in PyRun_SimpleFileExFlags (/lib64/libpython2.7.so.1.0+0x102fe8)
#12 0x7f281d74f19e in Py_Main (/lib64/libpython2.7.so.1.0+0x11419e)
#13 0x7f281c96a554 in __libc_start_main (/lib64/libc.so.6+0x22554)
#14 0x40068d (/usr/bin/python2.7+0x40068d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: BUS (/lib64/libc.so.6+0x810fd) in _int_free
==432489==ABORTING
But if I wrap libc.so's free in demo_c.c and call it instead of directly calling free directly in python code, it works fine.
Problem is that you allocate your memory with Asan's malloc and later try to release it with libc's free. This is not going to work as different allocators are generally incompatible.

How to resolve error " Hunk #2 FAILED at 456. 1 out of 2 hunks FAILED"

I am trying to run the following command in ubuntu terminal
patch -p0 -i adjustmentFile.patch
That is giving the following error
patching file ./src/helpStructures/CastaliaModule.cc
patching file ./src/node/communication/mac/tunableMac/TunableMAC.cc
Hunk #2 FAILED at 456.
1 out of 2 hunks FAILED -- saving rejects to file ./src/node/communication/mac/tunableMac/TunableMAC.cc.rej
I tried almost all the ways suggested in the link Hunk #1 FAILED at 1. What's that mean?. However, nothing worked.
Here is my version detail
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
Included patches: 1-1453
The patch file:
diff -r -u ./src/helpStructures/CastaliaModule.cc ./src/helpStructures/CastaliaModule.cc
--- ./src/helpStructures/CastaliaModule.cc 2010-12-09 09:56:47.000000000 -0300
+++ ./src/helpStructures/CastaliaModule.cc 2011-12-20 00:16:39.944320051 -0300
## -180,6 +180,8 ##
classPointers.resourceManager = getParentModule()->getParentModule()->getSubmodule("ResourceManager");
else if (name.compare("SensorManager") == 0)
classPointers.resourceManager = getParentModule()->getSubmodule("ResourceManager");
+ else if (name.compare("Routing") == 0)
+ classPointers.resourceManager = getParentModule()->getParentModule()->getSubmodule("ResourceManager");
else
opp_error("%s module has no rights to call drawPower() function", getFullPath().c_str());
if (!classPointers.resourceManager)
Only in ./src/helpStructures: CastaliaModule.cc~
diff -r -u ./src/node/communication/mac/tunableMac/TunableMAC.cc ./src/node/communication/mac/tunableMac/TunableMAC.cc
--- ./src/node/communication/mac/tunableMac/TunableMAC.cc 2011-03-30 02:14:34.000000000 -0300
+++ ./src/node/communication/mac/tunableMac/TunableMAC.cc 2011-12-19 23:57:43.894686687 -0300
## -405,6 +405,8 ##
void TunableMAC::fromRadioLayer(cPacket * pkt, double rssi, double lqi)
{
TunableMacPacket *macFrame = dynamic_cast <TunableMacPacket*>(pkt);
+ macFrame->getMacRadioInfoExchange().RSSI = rssi;
+ macFrame->getMacRadioInfoExchange().LQI = lqi;
if (macFrame == NULL){
collectOutput("TunableMAC packet breakdown", "filtered, other MAC");
return;
## -454,7 +456,8 ##
}
case DATA_FRAME:{
- toNetworkLayer(macFrame->decapsulate());
+ cPacket *netPkt = decapsulatePacket(macFrame);
+ toNetworkLayer(netPkt);
collectOutput("TunableMAC packet breakdown", "received data pkts");
if (macState == MAC_STATE_RX) {
cancelTimer(ATTEMPT_TX);
Only in ./src/node/communication/mac/tunableMac: TunableMAC.cc~
Patching takes some changes made to a file X, and applies them to a different instance of file X. That is, suppose you start with generation 1 of file X; you make changes to get generation 2-a, and someone else starts with generation 1 to make generation 2-b. Now you want to take his edits that created his generation 2-b, and apply them to your generation 2-a.
If 'his' changes clash with 'your' changes, they cannot be automatically patched.
You'll need to look at the changes being made in hunk 2.
- toNetworkLayer(macFrame->decapsulate());
+ cPacket *netPkt = decapsulatePacket(macFrame);
+ toNetworkLayer(netPkt);
and figure out what you want the result to look like. Someone needs to know what the result is supposed to be. You can't resolve conflicts without knowledge of intent.

'testthat', how should I interpret this failure?

I want to use 'testthat' to add tests to my package.
This is my test-file:
library(RBaseX)
test_that("Credentials are accepted", {
skip_unless_socket_available()
expect_error(BasexClient$new("localhost", 1984L, username = "admin", password = "denied"), "Access denied")
Session <- BasexClient$new("localhost", 1984L, username = "admin", password = "admin")
expect_equal(class(Session)[[1]], "BasexClient")
})
skip_unless_socket_available is defined in a separate helper.R-file:
skip_unless_socket_available <- function() {
tryCatch({
Socket <- socketConnection(host = "localhost", 1984,
open = "w+b", server = FALSE, blocking = TRUE, encoding = "utf-8")
close(Socket)
TRUE
}, error = function(e) {
skip(paste0("basexserver not available:\n'", conditionMessage(e), "'"))
})
}
When the program is executed I get this output:
Loading RBaseX
Testing RBaseX
✓ | OK F W S | Context
✓ | 2 | test_RbaseX [0.2 s]
⠹ | 2 1 | test_RbaseX
══ Results ═══════════════════════════════
Duration: 0.3 s
OK: 2
Failed: 1
Warnings: 0
Skipped: 0
No matter what I do, I still get 1 failure. Both exceptions, however, are handled correctly.
How should I act upon this failure?
Ben
After inserting 3 contexts() in test_RBaseX.R, I now get this output:
Loading RBaseX
Testing RBaseX
✓ | OK F W S | Context
✓ | 2 | Access [0.1 s]
✓ | 2 | Create Session [0.1 s]
⠏ | 0 | Check setter/getter (and BasexClient$Execute())
✓ | 2 | Check setter/getter (and BasexClient$Execute())
⠏ | 0 | Intercept set/get is handled correctlyDatabase 'TestOpen' is niet gevonden.
Database 'TestOpen' is niet gevonden.
Database 'TestOpen' is niet gevonden.
✓ | 1 | Intercept set/get is handled correctly
⠙ | 1 1 | Intercept set/get is handled correctly
══ Results ════════════════════════════════════════════
Duration: 0.4 s
OK: 7
Failed: 1
Warnings: 0
Skipped: 0
All tests give the expected result but then 1 failure is added. I still haven't seen any indication why.
Does this help?
Ben
(By the way, thanks to these testing-activities, I found and fixed serveral errors :-))
After moving the file 'testthat.R' from the '/tests/testthat'-directory, to the '/tests'-directory, there were no failures detected anymore.
Ben

yosys fails at ABC pass (on counter.v demo)

I hope someone can help me with this...
This is my first encounter with yosys. For the start, I'm trying to run the very same demo as Clifford explained in his presentation. I downloaded the demo at the following location: https://github.com/cliffordwolf/yosys/tree/master/manual/PRESENTATION_Intro
yosys run beaks at the ABC pass with following message:
12. Executing ABC pass (technology mapping using ABC).
12.1. Extracting gate netlist of module `\counter' to `<abc-temp-dir>/input.blif'..
Extracted 6 gates and 12 wires to a netlist network with 4 inputs and 2 outputs.
12.1.1. Executing ABC.
Running ABC command: <yosys-exe-dir>/yosys-abc -s -f <abc-temp-dir>/abc.script 2>&1
ABC: ABC command line: "source <abc-temp-dir>/abc.script".
ABC:
ABC: + read_blif <abc-temp-dir>/input.blif
ABC: + read_lib -w /home/boris/Documents/Self Learning/yosys_synthesys/mycells.lib
ABC: usage: read_lib [-SG float] [-M num] [-dnvwh] <file>
ABC: reads Liberty library from file
ABC: -S float : the slew parameter used to generate the library [default = 0.00]
ABC: -G float : the gain parameter used to generate the library [default = 0.00]
ABC: -M num : skip gate classes whose size is less than this [default = 0]
ABC: -d : toggle dumping the parsed library into file "*_temp.lib" [default = no]
ABC: -n : toggle replacing gate/pin names by short strings [default = no]
ABC: -v : toggle writing verbose information [default = yes]
ABC: -v : toggle writing information about skipped gates [default = yes]
ABC: -h : prints the command summary
ABC: <file> : the name of a file to read
ABC: ** cmd error: aborting 'source <abc-temp-dir>/abc.script'
ERROR: Can't open ABC output file `/tmp/yosys-abc-KDGya6/output.blif'.
[boris#E7440 yosys_synthesys]$
I have had a look at the file location mentioned in the error statement above, there is no output.blif in there:
[boris#E7440 yosys_synthesys]$ ll /tmp/yosys-abc-KDGya6/
total 12K
-rw-rw-r--. 1 boris boris 542 Jul 5 11:21 abc.script
-rw-rw-r--. 1 boris boris 526 Jul 5 11:21 input.blif
-rw-rw-r--. 1 boris boris 852 Jul 5 11:21 stdcells.genlib
[boris#E7440 yosys_synthesys]$
Buy the way, here is some system/tools info that might be relevant for debugging:
Linux E7440.DELL 4.4.13-200.fc22.x86_64 #1 SMP Wed Jun 8 15:59:40 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Yosys 0.6+141 (git sha1 080f95f, gcc 5.3.1 -fPIC -Os)
UC Berkeley, ABC 1.01 (compiled Mar 8 2015 01:00:49)
The issue has been resolved...
Solution =
Changed rundir from:
/home/boris/Documents/Self Learning/yosys_synthesys/mycells.lib
to:
/home/boris/Documents/SelfLearning/yosys_synthesys/mycells.lib
Lesson learned =
ABC tool does not accept space characters in the path/file name.

Resources