Crash report: git maintenance start/stop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What did you do before the bug happened? (Steps to reproduce your issue)

I'm sorry but i can't remember exactly. I learned about cool new feature called
maintenance and tried to apply it for every cloned local repo I have
using shell scripts. something went wrong. I'm not sure if its my fault
or not. I tried to reproduce it:

```bash
cd $(mktemp -d);
git init;
echo '# header' >> ./readme;
git add .;
git commit -m 'initial commit';
echo 'line 2' >> ./readme;
git add .;
git commit -m 'second commit';
# All commands above prepare basic repo successfully

# I initially have no timers
/sbin/systemctl --user list-timers --all;
# output:
# NEXT LEFT LAST PASSED UNIT ACTIVATES
# 0 timers listed.

# And also I initially have no cron jobs
crontab -l
# output:
# no crontab for nikel


# git maintenance start crashes first time:
GIT_TRACE=1 git maintenance start;
# output:
# 00:11:17.328757 git.c:479 trace: built-in: git maintenance start
# 00:11:17.328808 run-command.c:666 trace: run_command: systemctl
--user list-timers
# 00:11:17.328835 run-command.c:758 trace: start_command:
/sbin/systemctl --user list-timers
# 00:11:17.336026 run-command.c:666 trace: run_command: systemctl
--user list-timers
# 00:11:17.336066 run-command.c:758 trace: start_command:
/sbin/systemctl --user list-timers
# 00:11:17.342491 run-command.c:666 trace: run_command:
'H�LH��H���L9�r0H�CH�˷' -l
# free(): invalid pointer
# Aborted (core dumped)

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!! Notice those strange symbols: 'H�LH��H���L9�r0H�CH�˷'!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

# After the crash, git maintenance with {start,stop} fails with
# different error

# No new timers were created
/sbin/systemctl --user list-timers --all;
# output:
# NEXT LEFT LAST PASSED UNIT ACTIVATES
# 0 timers listed.

# No new cron jobs were created
crontab -l
# output:
# no crontab for nikel

# can't stop because it didn't start (?). Here you can see new error
GIT_TRACE=1 git maintenance stop;
# output:
# After that running git maintenance start fails with different error:
# 00:13:48.005648 git.c:479 trace: built-in: git maintenance stop
# error: another process is scheduling background maintenance

# restarting also doesn't work because previous start created lock file
# `error: another process is scheduling background maintenance` is forever
GIT_TRACE=1 git maintenance start;
# output:
# 00:14:31.483902 git.c:479 trace: built-in: git maintenance start
# 00:14:31.483951 run-command.c:666 trace: run_command: systemctl
--user list-timers
# 00:14:31.483990 run-command.c:758 trace: start_command:
/sbin/systemctl --user list-timers
# 00:14:31.491288 run-command.c:666 trace: run_command: systemctl
--user list-timers
# 00:14:31.491320 run-command.c:758 trace: start_command:
/sbin/systemctl --user list-timers
# error: another process is scheduling background maintenance
# fatal: failed to set up maintenance schedule

# No new timers were created
/sbin/systemctl --user list-timers --all;
# output:
# NEXT LEFT LAST PASSED UNIT ACTIVATES
# 0 timers listed.

# No new cron jobs were created
crontab -l
# output:
# no crontab for nikel

# After first crash it forever fails with "another process is schedul..."
# until I delete lock file
rm ./.git/objects/schedule.lock;

# then `GIT_TRACE=1 git maintenance start` is able to crash with the same
# useless error again
# Here are the most detailed logs I know how to create:
GIT_TRACE=1 gdb --args git maintenance start --scheduler=systemd-timer;
# output:
# GNU gdb (GDB) 15.2
# Reading symbols from git...
#
# (gdb) run
#
# Starting program: /usr/bin/git maintenance start --scheduler=systemd-timer
# [Thread debugging using libthread_db enabled]
# Using host libthread_db library "/usr/lib/libthread_db.so.1".
# 00:32:49.043634 git.c:479 trace: built-in: git maintenance start
--scheduler=systemd-timer
# 00:32:49.043720 run-command.c:666 trace: run_command: systemctl
--user list-timers
# 00:32:49.043760 run-command.c:758 trace: start_command:
/sbin/systemctl --user list-timers
# [Detaching after fork from child process 30180]
# 00:32:49.053174 run-command.c:666 trace: run_command:
'H�LH��H���L9�r0H�CH�˷' -l
# free(): invalid pointer
#
# Program received signal SIGABRT, Aborted.
# __pthread_kill_implementation (threadid=<optimized out>,
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;
#
# (gdb) where
#
# #0 __pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
# #1 0x00007ffff7d7c463 in __pthread_kill_internal
(threadid=<optimized out>, signo=6) at pthread_kill.c:78
# #2 0x00007ffff7d23120 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
# #3 0x00007ffff7d0a4c3 in __GI_abort () at abort.c:79
# #4 0x00007ffff7d0b354 in __libc_message_impl
(fmt=fmt@entry=0x7ffff7e992f5 "%s\n") at
../sysdeps/posix/libc_fatal.c:132
# #5 0x00007ffff7d86765 in malloc_printerr
(str=str@entry=0x7ffff7e97082 "free(): invalid pointer") at
malloc.c:5772
# #6 0x00007ffff7d88c4c in _int_free (av=<optimized out>,
p=p@entry=0x555555822b16 <strbuf_add+38>, have_lock=have_lock@entry=0)
at malloc.c:4507
# #7 0x00007ffff7d8b5ce in __GI___libc_free
(mem=mem@entry=0x555555822b26 <strbuf_add+54>) at malloc.c:3398
# #8 0x00005555555d3ec8 in is_crontab_available () at builtin/gc.c:2349
# #9 0x00005555555dc248 in update_background_schedule
(opts=opts@entry=0x7fffffffd0cc, enable=enable@entry=1) at
builtin/gc.c:2897
# #10 0x00005555555dc46d in maintenance_start (argc=<optimized out>,
argv=<optimized out>, prefix=<optimized out>) at builtin/gc.c:2937
# #11 0x00005555555cf61f in cmd_maintenance (argc=<optimized out>,
argv=0x7fffffffda20, prefix=0x0, repo=<optimized out>) at
builtin/gc.c:2984
# #12 0x000055555555e454 in run_builtin (p=0x55555596efd0
<commands.lto_priv+1584>, argc=3, argv=0x7fffffffda20,
repo=0x55555597de40 <the_repo.lto_priv>) at
/usr/src/debug/git/git-2.47.0/git.c:483
# #13 handle_builtin (argc=3, argv=0x7fffffffda20) at
/usr/src/debug/git/git-2.47.0/git.c:749
# #14 0x000055555555ead9 in run_argv (argcp=0x7fffffffd7cc,
argv=0x7fffffffd7f0) at /usr/src/debug/git/git-2.47.0/git.c:819
# #15 0x00005555555597eb in cmd_main (argc=<optimized out>,
argv=<optimized out>) at /usr/src/debug/git/git-2.47.0/git.c:954
# #16 main (argc=<optimized out>, argv=<optimized out>) at
/usr/src/debug/git/git-2.47.0/common-main.c:64
#
# (gdb) quit
```

I hope it would be helpful. Let me know if you need anything else

What did you expect to happen? (Expected behavior)

`git maintenance start` doesn't crash.

What happened instead? (Actual behavior)

`git maintenance start` crashes.

What's different between what you expected and what actually happened?

Crashing vs not crashing.

[System Info]
git version:
git version 2.47.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
libcurl: 8.10.1
OpenSSL: OpenSSL 3.3.2 3 Sep 2024
zlib: 1.3.1
uname: Linux 6.11.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 01 Nov 2024
03:30:41 +0000 x86_64
compiler info: gnuc: 14.2
libc info: glibc: 2.40
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux