{"thread":{"id":"62465","subject":"Crash report: git maintenance start/stop","startedAt":"2024-11-07T22:24:45Z","lastAt":"2024-11-08T12:11:08Z","messageCount":3,"participants":["Evangeline Rome","Patrick Steinhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"506814","messageId":"CAFBPeVD7pSOZkaCs_sWfhz6A7EWrV1SmLcCxVErK6GEs7KeYbQ@mail.gmail.com","threadId":"62465","inReplyTo":null,"subject":"Crash report: git maintenance start/stop","fromName":"Evangeline Rome","fromEmail":"kolya007.klass@gmail.com","sentAt":"2024-11-07T22:24:29Z","receivedAt":"2024-11-07T22:24:45Z","isPatch":false,"sender":{"key":"kolya007.klass@gmail.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\nI'm sorry but i can't remember exactly. I learned about cool new feature called\nmaintenance and tried to apply it for every cloned local repo I have\nusing shell scripts. something went wrong. I'm not sure if its my fault\nor not. I tried to reproduce it:\n\n```bash\ncd $(mktemp -d);\ngit init;\necho '# header' >> ./readme;\ngit add .;\ngit commit -m 'initial commit';\necho 'line 2' >> ./readme;\ngit add .;\ngit commit -m 'second commit';\n# All commands above prepare basic repo successfully\n\n# I initially have no timers\n/sbin/systemctl --user list-timers --all;\n# output:\n# NEXT LEFT LAST PASSED UNIT ACTIVATES\n# 0 timers listed.\n\n# And also I initially have no cron jobs\ncrontab -l\n# output:\n# no crontab for nikel\n\n\n# git maintenance start crashes first time:\nGIT_TRACE=1 git maintenance start;\n# output:\n# 00:11:17.328757 git.c:479 trace: built-in: git maintenance start\n# 00:11:17.328808 run-command.c:666 trace: run_command: systemctl\n--user list-timers\n# 00:11:17.328835 run-command.c:758 trace: start_command:\n/sbin/systemctl --user list-timers\n# 00:11:17.336026 run-command.c:666 trace: run_command: systemctl\n--user list-timers\n# 00:11:17.336066 run-command.c:758 trace: start_command:\n/sbin/systemctl --user list-timers\n# 00:11:17.342491 run-command.c:666 trace: run_command:\n'H�LH��H���L9�r0H�CH�˷' -l\n# free(): invalid pointer\n# Aborted (core dumped)\n\n# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n# !!!!!! Notice those strange symbols: 'H�LH��H���L9�r0H�CH�˷'!!!!!!\n# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n# After the crash, git maintenance with {start,stop} fails with\n# different error\n\n# No new timers were created\n/sbin/systemctl --user list-timers --all;\n# output:\n# NEXT LEFT LAST PASSED UNIT ACTIVATES\n# 0 timers listed.\n\n# No new cron jobs were created\ncrontab -l\n# output:\n# no crontab for nikel\n\n# can't stop because it didn't start (?). Here you can see new error\nGIT_TRACE=1 git maintenance stop;\n# output:\n# After that running git maintenance start fails with different error:\n# 00:13:48.005648 git.c:479 trace: built-in: git maintenance stop\n# error: another process is scheduling background maintenance\n\n# restarting also doesn't work because previous start created lock file\n# `error: another process is scheduling background maintenance` is forever\nGIT_TRACE=1 git maintenance start;\n# output:\n# 00:14:31.483902 git.c:479 trace: built-in: git maintenance start\n# 00:14:31.483951 run-command.c:666 trace: run_command: systemctl\n--user list-timers\n# 00:14:31.483990 run-command.c:758 trace: start_command:\n/sbin/systemctl --user list-timers\n# 00:14:31.491288 run-command.c:666 trace: run_command: systemctl\n--user list-timers\n# 00:14:31.491320 run-command.c:758 trace: start_command:\n/sbin/systemctl --user list-timers\n# error: another process is scheduling background maintenance\n# fatal: failed to set up maintenance schedule\n\n# No new timers were created\n/sbin/systemctl --user list-timers --all;\n# output:\n# NEXT LEFT LAST PASSED UNIT ACTIVATES\n# 0 timers listed.\n\n# No new cron jobs were created\ncrontab -l\n# output:\n# no crontab for nikel\n\n# After first crash it forever fails with \"another process is schedul...\"\n# until I delete lock file\nrm ./.git/objects/schedule.lock;\n\n# then `GIT_TRACE=1 git maintenance start` is able to crash with the same\n# useless error again\n# Here are the most detailed logs I know how to create:\nGIT_TRACE=1 gdb --args git maintenance start --scheduler=systemd-timer;\n# output:\n# GNU gdb (GDB) 15.2\n# Reading symbols from git...\n#\n# (gdb) run\n#\n# Starting program: /usr/bin/git maintenance start --scheduler=systemd-timer\n# [Thread debugging using libthread_db enabled]\n# Using host libthread_db library \"/usr/lib/libthread_db.so.1\".\n# 00:32:49.043634 git.c:479 trace: built-in: git maintenance start\n--scheduler=systemd-timer\n# 00:32:49.043720 run-command.c:666 trace: run_command: systemctl\n--user list-timers\n# 00:32:49.043760 run-command.c:758 trace: start_command:\n/sbin/systemctl --user list-timers\n# [Detaching after fork from child process 30180]\n# 00:32:49.053174 run-command.c:666 trace: run_command:\n'H�LH��H���L9�r0H�CH�˷' -l\n# free(): invalid pointer\n#\n# Program received signal SIGABRT, Aborted.\n# __pthread_kill_implementation (threadid=<optimized out>,\nsigno=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44\n# 44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;\n#\n# (gdb) where\n#\n# #0 __pthread_kill_implementation (threadid=<optimized out>,\nsigno=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44\n# #1 0x00007ffff7d7c463 in __pthread_kill_internal\n(threadid=<optimized out>, signo=6) at pthread_kill.c:78\n# #2 0x00007ffff7d23120 in __GI_raise (sig=sig@entry=6) at\n../sysdeps/posix/raise.c:26\n# #3 0x00007ffff7d0a4c3 in __GI_abort () at abort.c:79\n# #4 0x00007ffff7d0b354 in __libc_message_impl\n(fmt=fmt@entry=0x7ffff7e992f5 \"%s\\n\") at\n../sysdeps/posix/libc_fatal.c:132\n# #5 0x00007ffff7d86765 in malloc_printerr\n(str=str@entry=0x7ffff7e97082 \"free(): invalid pointer\") at\nmalloc.c:5772\n# #6 0x00007ffff7d88c4c in _int_free (av=<optimized out>,\np=p@entry=0x555555822b16 <strbuf_add+38>, have_lock=have_lock@entry=0)\nat malloc.c:4507\n# #7 0x00007ffff7d8b5ce in __GI___libc_free\n(mem=mem@entry=0x555555822b26 <strbuf_add+54>) at malloc.c:3398\n# #8 0x00005555555d3ec8 in is_crontab_available () at builtin/gc.c:2349\n# #9 0x00005555555dc248 in update_background_schedule\n(opts=opts@entry=0x7fffffffd0cc, enable=enable@entry=1) at\nbuiltin/gc.c:2897\n# #10 0x00005555555dc46d in maintenance_start (argc=<optimized out>,\nargv=<optimized out>, prefix=<optimized out>) at builtin/gc.c:2937\n# #11 0x00005555555cf61f in cmd_maintenance (argc=<optimized out>,\nargv=0x7fffffffda20, prefix=0x0, repo=<optimized out>) at\nbuiltin/gc.c:2984\n# #12 0x000055555555e454 in run_builtin (p=0x55555596efd0\n<commands.lto_priv+1584>, argc=3, argv=0x7fffffffda20,\nrepo=0x55555597de40 <the_repo.lto_priv>) at\n/usr/src/debug/git/git-2.47.0/git.c:483\n# #13 handle_builtin (argc=3, argv=0x7fffffffda20) at\n/usr/src/debug/git/git-2.47.0/git.c:749\n# #14 0x000055555555ead9 in run_argv (argcp=0x7fffffffd7cc,\nargv=0x7fffffffd7f0) at /usr/src/debug/git/git-2.47.0/git.c:819\n# #15 0x00005555555597eb in cmd_main (argc=<optimized out>,\nargv=<optimized out>) at /usr/src/debug/git/git-2.47.0/git.c:954\n# #16 main (argc=<optimized out>, argv=<optimized out>) at\n/usr/src/debug/git/git-2.47.0/common-main.c:64\n#\n# (gdb) quit\n```\n\nI hope it would be helpful. Let me know if you need anything else\n\nWhat did you expect to happen? (Expected behavior)\n\n`git maintenance start` doesn't crash.\n\nWhat happened instead? (Actual behavior)\n\n`git maintenance start` crashes.\n\nWhat's different between what you expected and what actually happened?\n\nCrashing vs not crashing.\n\n[System Info]\ngit version:\ngit version 2.47.0\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nlibcurl: 8.10.1\nOpenSSL: OpenSSL 3.3.2 3 Sep 2024\nzlib: 1.3.1\nuname: Linux 6.11.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 01 Nov 2024\n03:30:41 +0000 x86_64\ncompiler info: gnuc: 14.2\nlibc info: glibc: 2.40\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\n"},{"id":"506838","messageId":"Zy3MdudlGBoFxDan@pks.im","threadId":"62465","inReplyTo":"CAFBPeVD7pSOZkaCs_sWfhz6A7EWrV1SmLcCxVErK6GEs7KeYbQ@mail.gmail.com","subject":"Re: Crash report: git maintenance start/stop","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-11-08T08:31:50Z","receivedAt":"2024-11-08T08:32:01Z","isPatch":false,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Nov 08, 2024 at 01:24:29AM +0300, Evangeline Rome wrote:\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> I'm sorry but i can't remember exactly. I learned about cool new feature called\n> maintenance and tried to apply it for every cloned local repo I have\n> using shell scripts. something went wrong. I'm not sure if its my fault\n> or not. I tried to reproduce it:\n\nThis very much reads like the report at [1]. If so, the bug has been\nfixed via c1662a00b6 (Merge branch 'ps/maintenance-start-crash-fix',\n2024-10-18).\n\nPatrick\n\n[1]: https://lore.kernel.org/git/CAG=Um+0mJW-oAH+YLC3dWEU64JwS-zMkkTiFWYBe4g6HMbe-iA@mail.gmail.com/\n"},{"id":"506854","messageId":"CAFBPeVB_TgNrThv3-GKZiqM3oWvswXjPcePaG1tyzgTCPio08Q@mail.gmail.com","threadId":"62465","inReplyTo":"Zy3MdudlGBoFxDan@pks.im","subject":"Re: Crash report: git maintenance start/stop","fromName":"Evangeline Rome","fromEmail":"kolya007.klass@gmail.com","sentAt":"2024-11-08T12:10:51Z","receivedAt":"2024-11-08T12:11:08Z","isPatch":false,"sender":{"key":"kolya007.klass@gmail.com","avatar":null},"body":"On Fri, Nov 8, 2024 at 11:32 AM Patrick Steinhardt <ps@pks.im> wrote:\n>\n> On Fri, Nov 08, 2024 at 01:24:29AM +0300, Evangeline Rome wrote:\n> > What did you do before the bug happened? (Steps to reproduce your issue)\n> >\n> > I'm sorry but i can't remember exactly. I learned about cool new feature called\n> > maintenance and tried to apply it for every cloned local repo I have\n> > using shell scripts. something went wrong. I'm not sure if its my fault\n> > or not. I tried to reproduce it:\n>\n> This very much reads like the report at [1]. If so, the bug has been\n> fixed via c1662a00b6 (Merge branch 'ps/maintenance-start-crash-fix',\n> 2024-10-18).\n>\n> Patrick\n>\n> [1]: https://lore.kernel.org/git/CAG=Um+0mJW-oAH+YLC3dWEU64JwS-zMkkTiFWYBe4g6HMbe-iA@mail.gmail.com/\n\nOh, yeah, I tried compiling `next` branch and it works fine there. I\nguess I'll have to wait until new git release will be distributed\nthrough Arch Linux repos. Thank you, for pointing me out, and thanks\nto the people involved in fixing it! :)\n\n(Patrick, sorry if you get duplicate email, I'm new to mailing lists)\n"}]}