Git: «пакет имеет плохой объект» при отправке на удаленный

3401
UTF-8

У меня есть пустой git-репозиторий на Raspberry Pi, которым я пользуюсь. Нажимая на это сегодня, я получил это сообщение об ошибке:

Counting objects: 460, done. Delta compression using up to 8 threads. Compressing objects: 100% (367/367), done. remote: fatal: pack has bad object at offset 1641: inflate returned -5 error: pack-objects died of signal 13 error: failed to push some refs to 'ssh://christoph@111.111.111.111/media/christoph/afacc396-ec79-4920-9105-513ca4616c06/git/Documents' 

Как видите, доступ к хранилищу осуществляется через ssh. (Я изменил IP-адрес.)

Я пробовал несколько раз, но получил ту же ошибку (даже с теми же номерами). Затем я решил создать новый репозиторий, удалив папку старого, создав папку с тем же именем и выполнив git init --bareвнутри нее.

Теперь я получаю эту ошибку при нажатии на нее:

Counting objects: 3129, done. Delta compression using up to 8 threads. Compressing objects: 100% (2265/2265), done. remote: fatal: pack has bad object at offset 426983445: inflate returned -5 error: pack-objects died of signal 13 error: failed to push some refs to 'ssh://christoph@111.111.111.111/media/christoph/afacc396-ec79-4920-9105-513ca4616c06/git/Documents' 

В чем проблема и как мне заставить его работать снова?

Я запускаю git версии 1.9.1 на 64-битной машине Linux с ядром 3.19.


Обновление с дополнительным выводом:

laptop-14-04:~/Documents Container$ GIT_TRACE=1 git push --porcelain --progress --recurse-submodules=check origin refs/heads/master:refs/heads/master trace: built-in: git 'push' '--porcelain' '--progress' '--recurse-submodules=check' 'origin' 'refs/heads/master:refs/heads/master' trace: run_command: 'ssh' 'christoph@111.111.111.111' 'git-receive-pack '\''/media/christoph/afacc396-ec79-4920-9105-513ca4616c06/git/Documents'\''' christoph@111.111.111.111's password:  trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress' trace: exec: 'git' 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress' trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress' Counting objects: 3383, done. Delta compression using up to 8 threads. Compressing objects: 100% (2257/2257), done. remote: fatal: pack has bad object at offset 426983770: inflate returned -5 error: pack-objects died of signal 13 error: failed to push some refs to 'ssh://christoph@111.111.111.111/media/christoph/afacc396-ec79-4920-9105-513ca4616c06/git/Documents'  laptop-14-04:~/Documents Container$ git count-objects -Hv count: 0 size: 0 bytes in-pack: 3452 packs: 1 size-pack: 13.03 GiB prune-packable: 0 garbage: 0 size-garbage: 0 bytes  laptop-14-04:~/Documents Container$ git fsck --full Checking object directories: 100% (256/256), done. Checking objects: 100% (3452/3452), done. laptop-14-04:~/Documents Container$ git gc Counting objects: 3452, done. Delta compression using up to 8 threads. Compressing objects: 100% (2254/2254), done. Writing objects: 100% (3452/3452), done. Total 3452 (delta 915), reused 3452 (delta 915)  laptop-14-04:~/Documents Container$ git push --porcelain --progress --recurse-submodules=check origin refs/heads/master:refs/heads/master christoph@111.111.111.111's password:  Counting objects: 3383, done. Delta compression using up to 8 threads. Compressing objects: 100% (2257/2257), done. remote: fatal: pack has bad object at offset 426983770: inflate returned -5 error: pack-objects died of signal 13 error: failed to push some refs to 'ssh://christoph@111.111.111.111/media/christoph/afacc396-ec79-4920-9105-513ca4616c06/git/Documents' 

Теперь я установил новую ОС (Ubuntu 16.04 64 bit, работающая под ядром 4.4.0-21), и теперь git версии 2.7.4. Я не копировал старый репо в новую систему, а только скопировал его содержимое и создал новый репо. Кроме того, я удалил репо на своем Raspberry Pi и создал новое голое репо на нем. Теперь я использовал SmartGit для добавления файлов в репозиторий и для попытки его подтолкнуть. Тем не менее, проблема все еще существует:

Screenshot of SmartGit error dialog.


Это работает, если я создаю пустой репозиторий локально, добавляю его как удаленный, а затем нажимаю на него. Затем я могу перенести каталог репозитория в Raspberry Pi и использовать его как удаленный через ssh. Таким образом, похоже, что проблема возникает только при передаче большого количества данных (или, возможно, больших коммитов) по сети.

3
похоже, ваш локальный репозиторий сломан ... Jakuje 8 лет назад 0
Можете ли вы запустить `git fsck --full` и` git gc`? Это помогает? Также выполните `fsck` на вашем устройстве хранения Raspberry и выполните тестирование памяти. Попробуйте запустить следующую команду с `GIT_TRACE = 1`. kenorb 8 лет назад 0
Какая у тебя версия git? Насколько велики ваши файлы пакета (`du -hs .git / objects / pack`)? Вы используете какой-то VPN или прокси? kenorb 8 лет назад 1
[Я запускал команды] (http://pastebin.com/U1fbCDJK), но не выяснил, где разместить `GIT_TRACE = 1`. UTF-8 8 лет назад 0

1 ответ на вопрос

2
kenorb

The pack-objects (man git-pack-objects) died of signal 13 (broken pipe), because git was unable to inflate (uncompress) the object and it failed with error (error code -5 could mean out-of-mem or overwrite/overlap error).

Explanation

According to zlib manual, the errors are defined as follow:

#define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) 

where -5 means no progress is possible or if there was not enough room in the output buffer.

Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing.

Here is what we can read in zlib FAQ:

Before making the call, make sure that avail_in and avail_out are not zero. When setting the parameter flush equal to Z_FINISH, also make sure that avail_out is big enough to allow processing all pending input. Note that a Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be made with more input or output space. A Z_BUF_ERROR may in fact be unavoidable depending on how the functions are used, since it is not possible to tell whether or not there is more output pending when strm.avail_out returns with zero. See zlib Usage Example for a heavily annotated example.


Solution

This may be related to few things:

  • the object being pushed is too big so zlib is of memory, so you need more space in the output zlib buffer,

    In this case, try increasing http.postBuffer, e.g.

    git config http.postBuffer 134217728 # =~ 128MB 

    Alternatively use bfg to strip larger blobs, e.g.

    java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git 
  • your object is corrupted, so run git fsck --full and git gc

    Potential reason could be corrupted memory or storage device, so retry on clean repository or different computer.

  • could be a git bug, since it shouldn't abort on Z_BUF_ERROR, but to provide more output space or more input, see: zLib inflate() hangs while uncompressing buffer

    You may report a git bug report to the mailing list.

  • could be a gzip inflate issue it-self (e.g. Is this a bug in this gzip inflate method?)

  • could be an old kernel bug (<= 2.6.32-rc4), so upgrade your kernel

    See: Bug#547503: git-core: "git clone" fails on armel

    The only possibly relevant kernel change I could find was commit 5a3a29f (ARM: 5691/1: fix cache aliasing issues between kmap() and kmap_atomic() with highmem, commit 7929eb9 upstream) from 2.6.31.1. So though I also have my doubts, we could be lucky.msg00049


Other useful commands to consider:


See also:


Here is failing relevant Git code (builtin/index-pack.c):

git_inflate_init(&stream); stream.next_out = buf; stream.avail_out = buf == fixed_buf ? sizeof(fixed_buf) : size; do { unsigned char *last_out = stream.next_out; stream.next_in = fill(1); stream.avail_in = input_len; status = git_inflate(&stream, 0); use(input_len - stream.avail_in); if (sha1) git_SHA1_Update(&c, last_out, stream.next_out - last_out); if (buf == fixed_buf) { stream.next_out = buf; stream.avail_out = sizeof(fixed_buf); } } while (status == Z_OK); if (stream.total_out != size || status != Z_STREAM_END) bad_object(offset, _("inflate returned %d"), status); git_inflate_end(&stream); 

and git_inflate() from zlib.c

status = inflate(&strm->z, (strm->z.avail_in != strm->avail_in) ? 0 : flush); 
Мое ядро ​​не такое старое. У меня 16 ГБ оперативной памяти, и, согласно gnome-system-monitor, я не превышаю 1,8 ГиБ при попытке протолкнуть. Пересчет слишком большого объекта: я взял команду из вопроса, который вы связали, который установил ее на 50 МБ, но добавил 2 нуля. [Я выполнил упомянутые команды.] (Http://pastebin.com/U1fbCDJK) UTF-8 8 лет назад 0
Вывод добавленных вами команд: http://pastebin.com/pr3ppsWF UTF-8 8 лет назад 0
Я сейчас попробовал `git config http.postBuffer 13421772800` (добавил к этому 2 нуля) в системе now. Не сработало (Та же ошибка.) Программа, задействованная в альтернативной команде, сама по себе, похоже, имеет большие проблемы, так как выдает исключения. [Это вывод.] (Http://pastebin.com/3LkE4Q16) Это также говорит о грязном файле. Что это значит? UTF-8 8 лет назад 0
Я не знаком с `bfg`, но исключение говорит:` Нет такого файла или каталога`. Если файл существует, возможно, это ошибка, неправильно разбирающая пробелы. Или этот [баг] (https://github.com/rtyley/bfg-repo-cleaner/issues/39) звучит похоже (возможно, родительская папка не имеет прав на запись?). kenorb 8 лет назад 0
Ошибка разбора пробела будет плохой, потому что в этом хранилище хранятся тысячи файлов, большинство из которых имеют пробелы в своих именах. Папка и все подпапки определенно имеют разрешение на запись (я использую его каждый день; у них есть `drwxr-xr-x`). UTF-8 8 лет назад 0
Я не уверен, попробуйте задать отдельный вопрос относительно проблемы `bfg`, может быть, кто-то может помочь. kenorb 8 лет назад 0
Я забыл принять этот ответ, который я догнал, сейчас. Это была ошибка, я сообщил об этом в список рассылки git, они быстро ее исправили, исправление было объединено с апстримом, и эта ошибка была исправлена ​​в выпусках git уже несколько месяцев. UTF-8 7 лет назад 2

Похожие вопросы