'loose object file':执行 git 拉取时文件描述符错误
'loose object file': bad file descriptor while doing git pull
我正在使用 BitBucket。我正在尝试拉主分支,使用 git pull origin master
但我收到错误:
我看到这是在 SO 上被问到的类似问题,所以我尝试了以下方法,但没有奏效。
git config --global pack.packSizeLimit 50m
git config --global pack.windowMemory 50m
git config --global core.compression 9
我试过的另一种方法
2. git gc
我尝试更改缓冲区限制,但没有成功。
git config --global http.postBuffer 524288000
为什么会出现这个问题?目前我在 master 分支。
根据评论,您可以 运行:
git config core.fsyncObjectFiles false
强制 Git 停止调用 fsync
此特定存储库数据库中的对象。奇怪的是,这应该有什么不同,因为 Git 的源代码默认为 false
;您的特定 Git 安装中的某些东西一定已将其更改为 true
。可能值得研究将其更改为 true
的原因以及原因。调用 fsync
的代码在 Git 1.6.0 中是新的,但自从它在提交 aafe9fbaf4f1d1f27a6f6e3eb3e246fff81240ef 中引入以来,默认值一直是 false
。在您的系统上将其设置为 true
的人一定有这样做的原因。
请注意,自 Git 2.36(2022 年第二季度)起,core.fsyncObjectFiles
已弃用,取而代之的是两个新的配置变量,core.fsync
和 core.fsyncMethod
。
参见 commit b9f5d03 (15 Mar 2022), and commit ba95e96, commit 844a8ad, commit 020406e, commit abf38ab, commit 19d3f22 (10 Mar 2022) by Neeraj Singh (neerajsi-msft
)。
(由 Junio C Hamano -- gitster
-- in commit eb804cd 合并,2022 年 3 月 25 日)
core.fsyncmethod
: add writeout-only mode
Signed-off-by: Neeraj Singh
This commit introduces the core.fsyncMethod
configuration knob, which can currently be set to fsync
or writeout-only
.
The new writeout-only
mode attempts to tell the operating system to flush its in-memory page cache to the storage hardware without issuing a CACHE_FLUSH
command to the storage controller.
Writeout-only fsync
is significantly faster than a vanilla fsync
on common hardware, since data is written to a disk-side cache rather than all the way to a durable medium.
Later changes in this patch series will take advantage of this primitive to implement batching of hardware flushes.
并且:
core.fsync
: introduce granular fsync
control infrastructure
Helped-by: Patrick Steinhardt
Signed-off-by: Neeraj Singh
This commit introduces the infrastructure for the core.fsync
configuration knob.
The repository components we want to sync are identified by flags so that we can turn on or off syncing for specific components.
If core.fsyncObjectFiles
is set and the core.fsync
configuration also includes FSYNC_COMPONENT_LOOSE_OBJECT,
we will fsync
any loose objects.
This picks the strictest data integrity behavior if core.fsync
and core.fsyncObjectFiles
are set to conflicting values.
错误信息是(参见commit f12f3b9 (30 Mar 2022), and commit e5ec440 (29 Mar 2022) by Neeraj Singh (neerajsi-msft
)。
(由 Junio C Hamano -- gitster
-- in commit 27dd460 合并,2022 年 4 月 4 日)
Reported-by:蒋欣
Signed-off-by:尼拉吉·辛格)
Warning: core.fsyncObjectFiles is deprecated; use core.fsync instead
所以:
git config
现在包含在其 man page 中:
core.fsync
A comma-separated list of components of the repository that
should be hardened via the core.fsyncMethod when created or
modified.
You can disable hardening of any component by
prefixing it with a '-'.
Items that are not hardened may be
lost in the event of an unclean system shutdown. Unless you
have special requirements, it is recommended that you leave
this option empty or pick one of committed
, added
,
or all
.
When this configuration is encountered, the set of components starts with
the platform default value, disabled components are removed, and additional
components are added. none
resets the state so that the platform default
is ignored.
The empty string resets the fsync
configuration to the platform
default. The default on most platforms is equivalent to
core.fsync=committed,-loose-object
, which has good performance,
but risks losing recent work in the event of an unclean system shutdown.
none
clears the set of fsynced components.
loose-object
hardens objects added to the repo in loose-object form.
pack
hardens objects added to the repo in packfile form.
pack-metadata
hardens packfile bitmaps and indexes.
commit-graph
hardens the commit graph file.
index
hardens the index when it is modified.
objects
is an aggregate option that is equivalent to
loose-object,pack
.
derived-metadata
is an aggregate option that is equivalent to
pack-metadata,commit-graph
.
committed
is an aggregate option that is currently equivalent to
objects
. This mode sacrifices some performance to ensure that work
that is committed to the repository with git commit
or similar commands
is hardened.
added
is an aggregate option that is currently equivalent to
committed,index
. This mode sacrifices additional performance to
ensure that the results of commands like git add
and similar operations
are hardened.
all
is an aggregate option that syncs all individual components above.
它还有一个选项:
使用 Git 2.36(2022 年第 2 季度),传统上不会对 refs 进行同步更新,但我们可以使用 core.fsync 变量进行配置。
参见 commit bc22d84 (11 Mar 2022) by Patrick Steinhardt (pks-t
)。
参见 commit 0099792 (15 Mar 2022) by Junio C Hamano (gitster
)。
(由 Junio C Hamano -- gitster
-- in commit 6e1a895 合并,2022 年 3 月 25 日)
core.fsync
: new option to harden references
Signed-off-by: Patrick Steinhardt
When writing both loose and packed references to disk we first create a lockfile, write the updated values into that lockfile, and on commit we rename the file into place.
According to filesystem developers, this behaviour is broken because applications should always sync data to disk before doing the final rename to ensure data consistency (here, there (What are the crash guarantees of overwrite-by-rename), and in this documentation (see auto_da_alloc
).
If applications fail to do this correctly, a hard crash of the machine can easily result in corrupted on-disk data.
This kind of corruption can in fact be easily observed with Git when the machine hard-resets shortly after writing references to disk.
On machines with ext4, this will likely lead to the "empty files" problem: the file has been renamed, but its data has not been synced to disk.
The result is that the reference is corrupt, and in the worst case this can lead to data loss.
Implement a new option to harden references so that users and admins can avoid this scenario by syncing locked loose and packed references to disk before we rename them into place.
git config
现在包含在其 man page 中:
reference
hardens references modified in the repo.
我正在使用 BitBucket。我正在尝试拉主分支,使用 git pull origin master
但我收到错误:
我看到这是在 SO 上被问到的类似问题,所以我尝试了以下方法,但没有奏效。
git config --global pack.packSizeLimit 50m
git config --global pack.windowMemory 50m
git config --global core.compression 9
我试过的另一种方法
2. git gc
我尝试更改缓冲区限制,但没有成功。
git config --global http.postBuffer 524288000
为什么会出现这个问题?目前我在 master 分支。
根据评论,您可以 运行:
git config core.fsyncObjectFiles false
强制 Git 停止调用 fsync
此特定存储库数据库中的对象。奇怪的是,这应该有什么不同,因为 Git 的源代码默认为 false
;您的特定 Git 安装中的某些东西一定已将其更改为 true
。可能值得研究将其更改为 true
的原因以及原因。调用 fsync
的代码在 Git 1.6.0 中是新的,但自从它在提交 aafe9fbaf4f1d1f27a6f6e3eb3e246fff81240ef 中引入以来,默认值一直是 false
。在您的系统上将其设置为 true
的人一定有这样做的原因。
请注意,自 Git 2.36(2022 年第二季度)起,core.fsyncObjectFiles
已弃用,取而代之的是两个新的配置变量,core.fsync
和 core.fsyncMethod
。
参见 commit b9f5d03 (15 Mar 2022), and commit ba95e96, commit 844a8ad, commit 020406e, commit abf38ab, commit 19d3f22 (10 Mar 2022) by Neeraj Singh (neerajsi-msft
)。
(由 Junio C Hamano -- gitster
-- in commit eb804cd 合并,2022 年 3 月 25 日)
core.fsyncmethod
: add writeout-only modeSigned-off-by: Neeraj Singh
This commit introduces the
core.fsyncMethod
configuration knob, which can currently be set tofsync
orwriteout-only
.The new
writeout-only
mode attempts to tell the operating system to flush its in-memory page cache to the storage hardware without issuing aCACHE_FLUSH
command to the storage controller.Writeout-only
fsync
is significantly faster than a vanillafsync
on common hardware, since data is written to a disk-side cache rather than all the way to a durable medium.
Later changes in this patch series will take advantage of this primitive to implement batching of hardware flushes.
并且:
core.fsync
: introduce granularfsync
control infrastructureHelped-by: Patrick Steinhardt
Signed-off-by: Neeraj Singh
This commit introduces the infrastructure for the
core.fsync
configuration knob.
The repository components we want to sync are identified by flags so that we can turn on or off syncing for specific components.If
core.fsyncObjectFiles
is set and thecore.fsync
configuration also includesFSYNC_COMPONENT_LOOSE_OBJECT,
we willfsync
any loose objects.
This picks the strictest data integrity behavior ifcore.fsync
andcore.fsyncObjectFiles
are set to conflicting values.
错误信息是(参见commit f12f3b9 (30 Mar 2022), and commit e5ec440 (29 Mar 2022) by Neeraj Singh (neerajsi-msft
)。
(由 Junio C Hamano -- gitster
-- in commit 27dd460 合并,2022 年 4 月 4 日)
Reported-by:蒋欣
Signed-off-by:尼拉吉·辛格)
Warning: core.fsyncObjectFiles is deprecated; use core.fsync instead
所以:
git config
现在包含在其 man page 中:
core.fsync
A comma-separated list of components of the repository that should be hardened via the core.fsyncMethod when created or modified.
You can disable hardening of any component by prefixing it with a '-'.
Items that are not hardened may be lost in the event of an unclean system shutdown. Unless you have special requirements, it is recommended that you leave this option empty or pick one of
committed
,added
, orall
.When this configuration is encountered, the set of components starts with the platform default value, disabled components are removed, and additional components are added.
none
resets the state so that the platform default is ignored.The empty string resets the
fsync
configuration to the platform default. The default on most platforms is equivalent tocore.fsync=committed,-loose-object
, which has good performance, but risks losing recent work in the event of an unclean system shutdown.
none
clears the set of fsynced components.loose-object
hardens objects added to the repo in loose-object form.pack
hardens objects added to the repo in packfile form.pack-metadata
hardens packfile bitmaps and indexes.commit-graph
hardens the commit graph file.index
hardens the index when it is modified.objects
is an aggregate option that is equivalent toloose-object,pack
.derived-metadata
is an aggregate option that is equivalent topack-metadata,commit-graph
.committed
is an aggregate option that is currently equivalent toobjects
. This mode sacrifices some performance to ensure that work that is committed to the repository withgit commit
or similar commands is hardened.added
is an aggregate option that is currently equivalent tocommitted,index
. This mode sacrifices additional performance to ensure that the results of commands likegit add
and similar operations are hardened.all
is an aggregate option that syncs all individual components above.
它还有一个选项:
使用 Git 2.36(2022 年第 2 季度),传统上不会对 refs 进行同步更新,但我们可以使用 core.fsync 变量进行配置。
参见 commit bc22d84 (11 Mar 2022) by Patrick Steinhardt (pks-t
)。
参见 commit 0099792 (15 Mar 2022) by Junio C Hamano (gitster
)。
(由 Junio C Hamano -- gitster
-- in commit 6e1a895 合并,2022 年 3 月 25 日)
core.fsync
: new option to harden referencesSigned-off-by: Patrick Steinhardt
When writing both loose and packed references to disk we first create a lockfile, write the updated values into that lockfile, and on commit we rename the file into place.
According to filesystem developers, this behaviour is broken because applications should always sync data to disk before doing the final rename to ensure data consistency (here, there (What are the crash guarantees of overwrite-by-rename), and in this documentation (seeauto_da_alloc
).
If applications fail to do this correctly, a hard crash of the machine can easily result in corrupted on-disk data.This kind of corruption can in fact be easily observed with Git when the machine hard-resets shortly after writing references to disk.
On machines with ext4, this will likely lead to the "empty files" problem: the file has been renamed, but its data has not been synced to disk.
The result is that the reference is corrupt, and in the worst case this can lead to data loss.Implement a new option to harden references so that users and admins can avoid this scenario by syncing locked loose and packed references to disk before we rename them into place.
git config
现在包含在其 man page 中:
reference
hardens references modified in the repo.