rpm-software-management/createrepo_c

Sending SIGTERM to "createrepo_c --workers 2" sometimes leads to a crash

TheStoryEnd opened this issue · 6 comments

[root@localhost ~]# coredumpctl gdb 436077
PID: 436077 (createrepo)
UID: 0 (root)
GID: 0 (root)
Signal: 6 (ABRT)
Timestamp: Wed 2023-08-16 14:40:29 CST (20h ago)
Command Line: createrepo -g tmp_77qdn6f/repodata/product.xml tmp_77qdn6f
Executable: /usr/bin/createrepo_c
Control Group: /system.slice/sshd.service
Unit: sshd.service
Slice: system.slice
Boot ID: 4cbe0d6267ad40818367a2275efbbb00
Machine ID: f40b7fa2c0f84f0aaa01f712d9172244
Hostname: localhost.localdomain
Storage: /var/lib/systemd/coredump/core.createrepo.0.4cbe0d6267ad40818367a2275efbbb00.436077.1692168029000000.lz4 (present)
Disk Size: 4.9M
Message: Process 436077 (createrepo) of user 0 dumped core.

Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-openEuler-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/createrepo_c...
Reading symbols from /usr/lib/debug//usr/bin/createrepo_c-0.17.6-1.h3.x86_64.debug...
[New LWP 436077]
[New LWP 436094]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Core was generated by `createrepo -g tmp_77qdn6f/repodata/product.xml tmp_77qdn6f'.
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
[Current thread is 1 (Thread 0x7f6ad8ddb840 (LWP 436077))]
Missing separate debuginfos, use: dnf debuginfo-install attr-2.5.1-2.h2.x86_64 brotli-1.0.9-2.x86_64 bzip2-1.0.8-4.h6.x86_64 cyrus-sasl-lib-2.1.27-13.h8.x86_64 drpm-0.5.0-2.h1.x86_64 e2fsprogs-1.46.4-7.h17.x86_64 file-libs-5.41-1.h1.x86_64 keyutils-libs-1.6.3-3.h3.x86_64 krb5-libs-1.19.2-2.h15.x86_64 libacl-2.3.1-1.h1.x86_64 libcap-2.61-1.h4.x86_64 libcurl-7.79.1-2.h22.x86_64 libidn2-2.3.2-2.h4.x86_64 libnghttp2-1.46.0-1.h3.x86_64 libpsl-0.21.1-4.h3.x86_64 libselinux-3.3-1.h5.x86_64 libssh-0.9.6-2.h10.x86_64 libunistring-0.9.10-8.x86_64 libxcrypt-4.4.26-2.h2.x86_64 libxml2-2.9.12-5.h23.x86_64 lua-5.4.3-3.h7.x86_64 openssl-libs-1.1.1m-2.h31.x86_64 pcre-8.45-2.h1.x86_64 pcre2-10.39-1.h6.x86_64 popt-1.18-1.h3.x86_64 rpm-libs-4.17.0-8.h24.x86_64 sqlite-3.37.2-3.h2.x86_64 xz-libs-5.2.5-2.h1.x86_64
(gdb) bt
#0 __pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1 0x00007f6ad96ea2b3 in __pthread_kill_internal (signo=6, threadid=) at pthread_kill.c:78
#2 0x00007f6ad969e146 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007f6ad96894f7 in __GI_abort () at abort.c:79
#4 0x00007f6ada0cadd8 in _g_log_abort (breakpoint=0) at ../glib/gmessages.c:558
#5 g_logv (log_domain=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=G_LOG_LEVEL_MESSAGE, format=, args=) at ../glib/gmessages.c:1409
#6 0x00007f6ada10828f in g_log (log_domain=log_domain@entry=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=log_level@entry=G_LOG_LEVEL_MESSAGE, format=format@entry=0x7f6ada20cd66 "%s caught: Terminating...")
at ../glib/gmessages.c:1451
#7 0x00007f6ada1f01b8 in sigint_catcher (sig=) at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64 /src/createrepo_shared.c:63
#8
#9 0x00007f6ad975a55f in __GI___libc_write (nbytes=17, buf=0x564ce194b7e0, fd=2) at ../sysdeps/unix/sysv/linux/write.c:26
#10 __GI___libc_write (fd=2, buf=0x564ce194b7e0, nbytes=17) at ../sysdeps/unix/sysv/linux/write.c:24
#11 0x00007f6ad96e005d in _IO_new_file_write (f=0x7f6ad984f4c0 <IO_2_1_stderr>, data=0x564ce194b7e0, n=17) at fileops.c:1181
#12 0x00007f6ad96df3c6 in new_do_write (fp=fp@entry=0x7f6ad984f4c0 <IO_2_1_stderr>, data=data@entry=0x564ce194b7e0 "C_CREATEREPOLIB: ", to_do=to_do@entry=17) at libioP.h:947
#13 0x00007f6ad96e077e in _IO_new_file_xsputn (n=17, data=, f=) at fileops.c:1255
#14 _IO_new_file_xsputn (f=0x7f6ad984f4c0 <IO_2_1_stderr>, data=, n=17) at fileops.c:1197
#15 0x00007f6ad96d547d in __GI__IO_fputs (str=str@entry=0x564ce194b7e0 "C_CREATEREPOLIB: ", fp=0x7f6ad984f4c0 <IO_2_1_stderr>) at libioP.h:947
#16 0x00007f6ada109fc2 in g_printerr (format=format@entry=0x7f6ada20e6e9 "%s: ") at ../glib/gmessages.c:3392
#17 0x00007f6ada1f75a6 in cr_log_fn (log_domain=log_domain@entry=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=log_level@entry=G_LOG_LEVEL_WARNING,
message=message@entry=0x564ce19540a0 "Cannot parse repomd: tmp_77qdn6f/repodata/repomd.xml", user_data=user_data@entry=0x80) at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64 /src/misc.c:1000
#18 0x00007f6ada107fde in g_logv (log_domain=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=G_LOG_LEVEL_WARNING, format=, args=) at ../glib/gmessages.c:1382
#19 0x00007f6ada10828f in g_log (log_domain=log_domain@entry=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7f6ada20ddad "Cannot parse repomd: %s")
at ../glib/gmessages.c:1451
#20 0x00007f6ada1f402b in cr_repodata_excludelist (err=0x7ffd015922f8, excludelist=0x7ffd01592098, retain=, repodata_path=0x564ce18f2b30 "tmp_77qdn6f/repodata/")
at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64/src/helpers.c:224
#21 cr_old_metadata_retention (old_repo=0x564ce18f2b30 "tmp_77qdn6f/repodata/", new_repo=0x564ce18f2be0 "tmp_77qdn6f/.repodata/", type=(unknown: 0x15920a8), val=, err=0x7ffd015922f8)
at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64/src/helpers.c:411
#22 0x0000564ce0e11798 in main (argc=, argv=) at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64 /src/createrepo_c.c:2013

The bt full display is as follows:

(gdb) bt full
#0 __pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
tid = 436077
ret = 0
pd =
old_mask = {__val = {140724626070128, 6538853397869222656, 32, 18446744073709551472, 2, 34, 35, 140096891626868, 140724626066448, 140096891626868, 140096902161341, 18446744073709551615, 94888202085360,
140096891626868, 34, 18446744073709551615}}
ret =
#1 0x00007f6ad96ea2b3 in __pthread_kill_internal (signo=6, threadid=) at pthread_kill.c:78
No locals.
#2 0x00007f6ad969e146 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
ret =
#3 0x00007f6ad96894f7 in __GI_abort () at abort.c:79
save_stage = 1
act = {__sigaction_handler = {sa_handler = 0x564ce19423f0, sa_sigaction = 0x564ce19423f0}, sa_mask = {__val = {140096901772843, 60710171587380, 140096891223568, 140724626070128, 6538853397869222656,
2334385650107901261, 7310312468656779816, 10596, 17, 140096892630208, 32, 94888201759232, 140096902842425, 5, 6538853397869222656, 35}}, sa_flags = -635385799, sa_restorer = 0x5}
sigs = {__val = {32, 1, 140096892630208, 10, 140096902842425, 140724626066704, 140724626066672, 140096891130089, 10, 140096891131155, 10, 140096892630208, 10, 140096891111715, 32, 140096892630208}}
#4 0x00007f6ada0cadd8 in _g_log_abort (breakpoint=0) at ../glib/gmessages.c:558
debugger_present = 1
debugger_present =
#5 g_logv (log_domain=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=G_LOG_LEVEL_MESSAGE, format=, args=) at ../glib/gmessages.c:1409
domain = 0x0
data = 0x0
depth =
log_func = 0x7f6ada107520 <_g_log_fallback_handler>
domain_fatal_mask =
masquerade_fatal = 0
test_level =
was_fatal =
was_recursion =
buffer =
msg = 0x564ce19423f0 "Broken pipe caught: Terminating..."
msg_alloc = 0x564ce19423f0 "Broken pipe caught: Terminating..."
i = 5
size =
#6 0x00007f6ada10828f in g_log (log_domain=log_domain@entry=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=log_level@entry=G_LOG_LEVEL_MESSAGE, format=format@entry=0x7f6ada20cd66 "%s caught: Terminating...")
at ../glib/gmessages.c:1451
args = {{gp_offset = 32, fp_offset = 48, overflow_arg_area = 0x7ffd01590f30, reg_save_area = 0x7ffd01590e70}}
#7 0x00007f6ada1f01b8 in sigint_catcher (sig=) at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64/src/createrepo_shared.c:63
No locals.
#8
No locals.
#9 0x00007f6ad975a55f in __GI___libc_write (nbytes=17, buf=0x564ce194b7e0, fd=2) at ../sysdeps/unix/sysv/linux/write.c:26
sc_ret = -32
sc_cancel_oldtype = 0
__arg3 =
_a2 =
sc_ret =
__value =
sc_ret =
__arg1 =
_a3 =
resultvar =
__arg2 =
_a1 =
#10 __GI___libc_write (fd=2, buf=0x564ce194b7e0, nbytes=17) at ../sysdeps/unix/sysv/linux/write.c:24
No locals.
#11 0x00007f6ad96e005d in _IO_new_file_write (f=0x7f6ad984f4c0 <IO_2_1_stderr>, data=0x564ce194b7e0, n=17) at fileops.c:1181
count =
to_do = 17
#12 0x00007f6ad96df3c6 in new_do_write (fp=fp@entry=0x7f6ad984f4c0 <IO_2_1_stderr>, data=data@entry=0x564ce194b7e0 "C_CREATEREPOLIB: ", to_do=to_do@entry=17) at libioP.h:947
count =
#13 0x00007f6ad96e077e in _IO_new_file_xsputn (n=17, data=, f=) at fileops.c:1255
block_size =
do_write =
s = 0x564ce194b7e0 "C_CREATEREPOLIB: "
to_do = 17
must_flush =
count =
s =
to_do =
must_flush =
count =
p =
block_size =
do_write =
#14 _IO_new_file_xsputn (f=0x7f6ad984f4c0 <IO_2_1_stderr>, data=, n=17) at fileops.c:1197
s =
to_do = 17
must_flush = 0
count = 0
p =
block_size =
do_write =
#15 0x00007f6ad96d547d in __GI__IO_fputs (str=str@entry=0x564ce194b7e0 "C_CREATEREPOLIB: ", fp=0x7f6ad984f4c0 <IO_2_1_stderr>) at libioP.h:947
_IO_acquire_lock_file = 0x7f6ad984f4c0 <IO_2_1_stderr>
len = 17
result = -1
#16 0x00007f6ada109fc2 in g_printerr (format=format@entry=0x7f6ada20e6e9 "%s: ") at ../glib/gmessages.c:3392
lstring = 0x564ce194b7e0 "C_CREATEREPOLIB: "
charset = 0x564ce19c1040 "ANSI_X3.4-1968"
args = {{gp_offset = 16, fp_offset = 48, overflow_arg_area = 0x7ffd01591e40, reg_save_area = 0x7ffd01591d70}}
string = 0x564ce195d680 "C_CREATEREPOLIB: "
local_glib_printerr_func =
func = "g_printerr"
#17 0x00007f6ada1f75a6 in cr_log_fn (log_domain=log_domain@entry=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=log_level@entry=G_LOG_LEVEL_WARNING,
message=message@entry=0x564ce19540a0 "Cannot parse repomd: tmp_77qdn6f/repodata/repomd.xml", user_data=user_data@entry=0x80) at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64/src/misc.c:1000
hidden_log_levels = 128
#18 0x00007f6ada107fde in g_logv (log_domain=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=G_LOG_LEVEL_WARNING, format=, args=) at ../glib/gmessages.c:1382
domain = 0x0
data = 0x80
depth =
log_func = 0x7f6ada1f7430 <cr_log_fn>
domain_fatal_mask =
masquerade_fatal = 0
test_level = G_LOG_LEVEL_WARNING
was_fatal =
was_recursion =
buffer =
msg = 0x564ce19540a0 "Cannot parse repomd: tmp_77qdn6f/repodata/repomd.xml"
msg_alloc = 0x564ce19540a0 "Cannot parse repomd: tmp_77qdn6f/repodata/repomd.xml"
i = 4
size =
#19 0x00007f6ada10828f in g_log (log_domain=log_domain@entry=0x7f6ada20c839 "C_CREATEREPOLIB", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7f6ada20ddad "Cannot parse repomd: %s")
at ../glib/gmessages.c:1451
args = {{gp_offset = 32, fp_offset = 48, overflow_arg_area = 0x7ffd01592070, reg_save_area = 0x7ffd01591fb0}}
#20 0x00007f6ada1f402b in cr_repodata_excludelist (err=0x7ffd015922f8, excludelist=0x7ffd01592098, retain=, repodata_path=0x564ce18f2b30 "tmp_77qdn6f/repodata/")
at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64/src/helpers.c:224
old_repomd_path = 0x564ce19c3130 "tmp_77qdn6f/repodata/repomd.xml"
repomd = 0x564ce196f9a0
tmp_err = 0x564ce1950530
old_repomd_path =
repomd =
tmp_err =
elem =
rec =
#21 cr_old_metadata_retention (old_repo=0x564ce18f2b30 "tmp_77qdn6f/repodata/", new_repo=0x564ce18f2be0 "tmp_77qdn6f/.repodata/", type=(unknown: 0x15920a8), val=, err=0x7ffd015922f8)
at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64/src/helpers.c:411
ret = 1
excludelist = 0x0
dirp = 0x0
filename =
tmp_err = 0x0
exit =
#22 0x0000564ce0e11798 in main (argc=, argv=) at /usr/src/debug/createrepo_c-0.17.6-1.h3.x86_64/src/createrepo_c.c:2013
cmd_options =
ret =
tmp_err = 0x0
exit_val = 0
in_dir =
in_repo = 0x564ce18f41d0 "tmp_77qdn6f/repodata/"
out_dir = 0x564ce18f2b00 "tmp_77qdn6f/"
out_repo = 0x564ce18f2b30 "tmp_77qdn6f/repodata/"
tmp_out_repo = 0x564ce18f2be0 "tmp_77qdn6f/.repodata/"
lock_dir = 0x564ce18f2bb0 "tmp_77qdn6f/.repodata/"
output_pkg_list =
user_data = {pri_f = 0x564ce1944040, fil_f = 0x564ce1944170, oth_f = 0x564ce19442c0, pri_db = 0x564ce1998e70, fil_db = 0x564ce19c12b0, oth_db = 0x564ce19e62a0, pri_zck = 0x0, fil_zck = 0x0, oth_zck = 0x0,
prev_srpm = 0x7f6ac8044b40 "zlib-1.2.11-19.h7.src.rpm", cur_srpm = 0x7f6ac0018b50 "zstd-1.5.0-1.src.rpm", changelog_limit = 10, location_base = 0x0, repodir_name_len = 24,
checksum_type_str = 0x7f6ada20c021 "sha256", checksum_type = CR_CHECKSUM_SHA256, checksum_cachedir = 0x0, skip_symlinks = 0, task_count = 481, package_count = 481, skip_stat = 0, old_metadata = 0x0,
mutex_old_md = {p = 0x0, i = {0, 0}}, mutex_pri = {p = 0x0, i = {0, 0}}, mutex_fil = {p = 0x0, i = {0, 0}}, mutex_oth = {p = 0x0, i = {0, 0}}, cond_pri = {p = 0x0, i = {481, 0}}, cond_fil = {p = 0x0, i = {481,
0}}, cond_oth = {p = 0x0, i = {481, 0}}, id_pri = 481, id_fil = 481, id_oth = 481, buffer = 0x564ce18f4220, mutex_buffer = {p = 0x0, i = {0, 0}}, deltas = 0, max_delta_rpm_size = 100000000,
mutex_deltatargetpackages = {p = 0x0, i = {0, 0}}, deltatargetpackages = 0x0, cut_dirs = 0, location_prefix = 0x0, had_errors = 0, output_pkg_list = 0x0, mutex_output_pkg_list = {p = 0x0, i = {0, 0}}}
pool =
task_count =
current_pkglist = 0x0
old_metadata_location = 0x0
old_metadata = 0x0
old_metadata_dir =
additional_metadata =
xml_compression_suffix =
sqlite_compression_suffix =
compression_suffix =
xml_compression =
sqlite_compression =
compression =
new_groupfile_metadatum =
pri_cr_file =
fil_cr_file =
oth_cr_file =
pri_stat = 0x564ce1943f40
fil_stat = 0x564ce1944070
oth_stat = 0x564ce19441a0
pri_xml_filename =
fil_xml_filename = 0x564ce1943ec0 "tmp_77qdn6f/.repodata//filelists.xml.gz"
oth_xml_filename = 0x564ce1943f00 "tmp_77qdn6f/.repodata//other.xml.gz"
pri_db_filename = 0x564ce19442f0 "tmp_77qdn6f/.repodata//primary.sqlite"
fil_db_filename = 0x564ce1944330 "tmp_77qdn6f/.repodata//filelists.sqlite"
oth_db_filename = 0x564ce1944370 "tmp_77qdn6f/.repodata//other.sqlite"
pri_db =
fil_db =
oth_db =
pri_zck_filename = 0x0
fil_zck_filename = 0x0
oth_zck_filename = 0x0
pri_cr_zck =
fil_cr_zck =
oth_cr_zck =
pri_zck_stat = 0x0
fil_zck_stat = 0x0
oth_zck_stat = 0x0
pri_dict = 0x0
fil_dict = 0x0
oth_dict = 0x0
pri_dict_size = 0
fil_dict_size = 0
oth_dict_size = 0
pri_dict_file =
fil_dict_file =
oth_dict_file =
repomd_obj = 0x564ce196c550
pri_xml_rec =
fil_xml_rec = 0x564ce1972d10
oth_xml_rec = 0x564ce1973110
pri_db_rec = 0x564ce19c2e30
fil_db_rec = 0x564ce1998420
oth_db_rec = 0x564ce199c510
pri_zck_rec = 0x0
fil_zck_rec = 0x0
oth_zck_rec = 0x0
prestodelta_rec = 0x0
prestodelta_zck_rec =
additional_metadata_rec = 0x564ce194fe90
fill_pool =
pri_fill_task =
fil_fill_task =
oth_fill_task =
elem =
i =
repomd_xml = 0x564ce1962900 "0j\236\341LV"
repomd_path = 0x564ce19440f0 ""
frepomd = 0x564ce1969c20
retentiontype =
retentionval =
old_repodata_renamed =
new_mask = {__val = {0, 140096891212518, 0, 140096891216489, 0, 0, 94888201732096, 140724626080256, 140096881670208, 140096903147521, 135168, 6538853397869222656, 0, 140096892627712, 656, 640}}
old_mask = {__val = {41, 18446744073709551528, 140096892627712, 140096891220646, 1, 0, 39, 0, 6322191860672, 640, 10720238373312, 10720238370857, 10720238373312, 140096891220646, 249108103209, 0}}
tmp_dirname =
old_repodata_path =
(gdb)

Repeatedly start the createrepo -g process and then kill it. Coredump occurs occasionally.Is this a problem with glib's source code or createrepo itself?

ppisar commented

It's pretty possible it's an bug or a feature in glib. Or a bug in crearerepo which has already been fixed.

Have you tried an up-to-date createrepo? You use 2 year old version 0.17.6, while the latest one is 1.0.0.
How do you kill the createrepo process? Which signal do you send it?
Why does your createrepo run take so long that you have to kill it?
Does your issue manifests without -g option?

Are you sure "createrepo -g tmp_77qdn6f/repodata/product.xml tmp_77qdn6f" invocation is correct? 1.0.0 expects a file specified with -g option to be a relative path to the repository directory:

$ createrepo -g d/repodata/comps_00.xml d
groupfile d/d/repodata/comps_00.xml doesn't exist

It accepts this invocation:

$ createrepo -g repodata/comps_00.xml d
Directory walk started
Directory walk done - 0 packages
Temporary output repo path: d/.repodata/
Pool started (with 5 workers)
Pool finished

When I place 10000 packages into a repository directory and let my command run, it takes long and when I send it SIGTERM, the program properly terminates without a crash:

$ createrepo -g repodata/comps_00.xml d
Directory walk started
Directory walk done - 10002 packages
Temporary output repo path: d/.repodata/
Pool started (with 5 workers)
^CInterrupt caught: Terminating...
C_CREATEREPOLIB: Warning: Cannot read package: d/4486.rpm: Error while checksum calculation: EVP_DigestInit_ex() failed
C_CREATEREPOLIB: Warning: Cannot read package: d/4487.rpm: Error while checksum calculation: EVP_DigestInit_ex() failed
C_CREATEREPOLIB: Warning: Cannot read package: d/4484.rpm: Error while checksum calculation: EVP_DigestInit_ex() failed

I tried it many times and never got a crash. I have glib2-2.77.2 and createrepo_c-1.0.0.

I worry that without a reproducer on my side, I cannot help you much.

ppisar commented

In the end I was able to reproduce it. There is no need for "-g" option. It manifests even with the latest createrepo_c code (commit f4854bb). My reproducer is having ten thousand RPM files, run with at least 2 workers, and sending SIGTERM:

$ ./build/src/createrepo_c --workers 2 d 
Directory walk started
Directory walk done - 10002 packages
Temporary output repo path: d/.repodata/
Pool started (with 2 workers)
^CInterrupt caught: Terminating...
malloc_consolidate(): invalid chunk size
Bus error (core dumped)

On Fedora 37 with glib2-2.74.7-2.fc37.x86_64 it happens almost always. On Fedora 40 with glib2-2.77.2-1.fc40.x86_64 it happens rarely.

A workaround is disabling a multihreading with "--workers 1".
It looks like a race between threads when destroying glib objects.

I will try to find where is the bug, but I cannot promise anything.

ppisar commented

I was able to isolate two reasons for a crash when receiving a SIGTERM:

  • The signal handler calls exit() which is not async-signal-safe. This manifests with "invalid chunk size" abort. A fix is to call _exit() and add exit_cleanup() call just before it. It's quite possible that glib's ThreadPool fuction register a callback on exit() and bypassing it with _exit() helps. This bug does not manifest with glib2-2.77.2. It manifests with glib2-2.74.7.
  • If one of threads smashes a log with plenty of warnings, e.g. duplicates_warning() ("Sourced from location..."), then glib itself aborts with a "(recursed)" logging error. This exhibits on both glib versions. This is triggered by printing debug messages in exit_cleanup(). It does not matter whether exit_cleanup() is called from a signal handler or as an atexit() callback. This can be worked around with "--quiet" option.

I will try to supply a patch which changes exit() into _exit() and which suppresses debugging of exit_cleanup() in case the program terminates abnormally.

ppisar commented

@TheStoryEnd, did an upgrade to 1.0.1 version fix this problem for you?