git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* spurious git stash create failures
@ 2022-01-27 15:09 clime
  2022-01-28  9:19 ` clime
  0 siblings, 1 reply; 2+ messages in thread
From: clime @ 2022-01-27 15:09 UTC (permalink / raw)
  To: Git List

Hello,

I am using `git stash create` from a python script and occasionally it
fails with return code 1 without seemingly any reason (i.e. without
printing anything to stderr).

After discussing this in the git irc channel, I have added strace to
the call (GIT_TRACE=2 env var didn't provide any info except: "trace:
built-in: git stash create" and then fail).

I also wrapped the call in for loop to retry if it fails ;( and today,
on a clean work-tree, it failed once and then immediately succeeded on
next loop iteration a few tens of ms later. Here are strace parts that
went differently in each try:

(I reproduced this on git 2.30 and 2.31 on two different systems, i
don't use any GUI or IDE, just the script that calls git stash
create).

...
newfstatat(AT_FDCWD, "merge_runs.py", {st_mode=S_IFREG|0775,
st_size=1164, ...}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(AT_FDCWD, "paper_reproducer", {st_mode=S_IFREG|0775,
st_size=81651, ...}, AT_SYMLINK_NOFOLLOW) = 0   ### till now the same
in successful run
readlink(".git/index", 0x55c61b001a30, 32) = -1 EINVAL (Invalid
argument)   ### this block until ENDBLOCK is only present in the
failed run
getcwd("/home/clime/vizorbot", 129) = 21
openat(AT_FDCWD, "/home/clime/vizorbot/.git/index.lock",
O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 3
rt_sigaction(SIGINT, {sa_handler=0x55c6198df5a0, sa_mask=[INT],
sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f9d3d534320},
{sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x55c6198df5a0, sa_mask=[HUP],
sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f9d3d534320},
{sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x55c6198df5a0, sa_mask=[TERM],
sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f9d3d534320},
{sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=0x55c6198df5a0, sa_mask=[QUIT],
sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f9d3d534320},
{sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=0x55c6198df5a0, sa_mask=[PIPE],
sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f9d3d534320},
{sa_handler=SIG_DFL, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART,
sa_restorer=0x7f9d3d534320}, 8) = 0
getpid() = 7126
newfstatat(AT_FDCWD, "paper_reproducer", {st_mode=S_IFREG|0775,
st_size=81651, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "paper_reproducer", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/etc/gitattributes", O_RDONLY) = -1 ENOENT (No such
file or directory)
openat(AT_FDCWD, "/home/clime/.config/git/attributes", O_RDONLY) = -1
ENOENT (No such file or directory)
openat(AT_FDCWD, ".gitattributes", O_RDONLY) = -1 ENOENT (No such file
or directory)
openat(AT_FDCWD, ".git/info/attributes", O_RDONLY) = -1 ENOENT (No
such file or directory)
mmap(NULL, 81651, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f9d2fe30000
munmap(0x7f9d2fe30000, 81651) = 0
close(4) = 0
newfstatat(AT_FDCWD, "param_sets", {st_mode=S_IFDIR|0775,
st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0   ### ENDBLOCK
newfstatat(AT_FDCWD, "param_sets/params0", {st_mode=S_IFDIR|0775,
st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0

... now this part in the end is also only in failed run:

lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_CUR) = 0
write(3, "DIRC\0\0\0\2\0\0\0016a\354'@%\253\301\36a\354'@%\253\301\36\0\0\375\0"...,
48938) = 48938
close(3) = 0
newfstatat(AT_FDCWD, "/home/clime/vizorbot/.git/index.lock",
{st_mode=S_IFREG|0664, st_size=48938, ...}, 0) = 0
rename("/home/clime/vizorbot/.git/index.lock",
"/home/clime/vizorbot/.git/index") = 0
access(".git/hooks/post-index-change", X_OK) = -1 ENOENT (No such file
or directory)
newfstatat(AT_FDCWD, ".git/HEAD", {st_mode=S_IFREG|0664, st_size=23,
...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, ".git/HEAD", O_RDONLY) = 3
read(3, "ref: refs/heads/master\n", 256) = 23
read(3, "", 233) = 0
close(3) = 0
newfstatat(AT_FDCWD, ".git/refs/heads/master", {st_mode=S_IFREG|0664,
st_size=41, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, ".git/refs/heads/master", O_RDONLY) = 3
read(3, "71bbd69706edf1746ce971e495f841a5"..., 256) = 41
read(3, "", 215) = 0
close(3) = 0
newfstatat(AT_FDCWD, ".git/refs/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/tags/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/heads/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/remotes/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/remotes/HEAD/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/HEAD", {st_mode=S_IFREG|0664, st_size=23,
...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, ".git/HEAD", O_RDONLY) = 3
read(3, "ref: refs/heads/master\n", 256) = 23
read(3, "", 233) = 0
close(3) = 0
newfstatat(AT_FDCWD, ".git/refs/heads/master", {st_mode=S_IFREG|0664,
st_size=41, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, ".git/refs/heads/master", O_RDONLY) = 3
read(3, "71bbd69706edf1746ce971e495f841a5"..., 256) = 41
read(3, "", 215) = 0
close(3) = 0
newfstatat(AT_FDCWD, ".git/refs/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/tags/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/heads/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/remotes/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/remotes/HEAD/HEAD", 0x7ffc90cf1990,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/HEAD", {st_mode=S_IFREG|0664, st_size=23,
...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, ".git/HEAD", O_RDONLY) = 3
read(3, "ref: refs/heads/master\n", 256) = 23
read(3, "", 233) = 0
close(3) = 0
newfstatat(AT_FDCWD, ".git/refs/heads/master", {st_mode=S_IFREG|0664,
st_size=41, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, ".git/refs/heads/master", O_RDONLY) = 3
read(3, "71bbd69706edf1746ce971e495f841a5"..., 256) = 41
read(3, "", 215) = 0
close(3) = 0
newfstatat(AT_FDCWD, ".git/refs/HEAD", 0x7ffc90cf0db0,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/tags/HEAD", 0x7ffc90cf0db0,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/heads/HEAD", 0x7ffc90cf0db0,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/remotes/HEAD", 0x7ffc90cf0db0,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
newfstatat(AT_FDCWD, ".git/refs/remotes/HEAD/HEAD", 0x7ffc90cf0db0,
AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, ".git/packed-refs", {st_mode=S_IFREG|0664,
st_size=373, ...}, 0) = 0
getpid() = 7126
exit_group(1) = ?
+++ exited with 1 +++

Best regards
clime

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: spurious git stash create failures
  2022-01-27 15:09 spurious git stash create failures clime
@ 2022-01-28  9:19 ` clime
  0 siblings, 0 replies; 2+ messages in thread
From: clime @ 2022-01-28  9:19 UTC (permalink / raw)
  To: Git List

Can it be that `git stash create` operation uses threads in some
fashion and there is a race condition?

Thank you
clime

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-28  9:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 15:09 spurious git stash create failures clime
2022-01-28  9:19 ` clime

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).