Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] AccessDeniedException in ObjectDirectory#insertUnpackedObject

On Thu, Jun 4, 2020 at 5:46 PM Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
On Thu, Jun 4, 2020 at 10:02 AM David Pursehouse <david.pursehouse@xxxxxxxxx> wrote:
Running Gerrit stable-3.0 modified to use JGit 5.7 (at the head of stable-5.7) I'm seeing ObjectDirectory#insertUnpackedObject fail with AccessDeniedException when attempting to move the temp file to the new object file.
can you share a stack trace ?

Yes, although please note that the line numbers here might not match up because it's running a version where I added extra logging statements:
java.nio.file.AccessDeniedException: /path/to/gerrit/gitroot/All-Projects.git/objects/noz4625652470081084376.tmp -> /path/to/gerrit/gitroot/All-Projects.git/objects/aa/a6442fe902e96a5233b136b973b96a4011fc18
at java.base/sun.nio.fs.UnixException.translateToIOException(
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(
at java.base/sun.nio.fs.UnixCopyFile.move(
at java.base/sun.nio.fs.UnixFileSystemProvider.move(
at java.base/java.nio.file.Files.move(
In this case it corresponds to the second call to Files.move in the insertUnpackedObject method.

This is happening consistently while running integration tests on an internal project, but unfortunately since it's a private project it means I can't share the test that reproduces it.  Essentially what it's doing is pushing a lot of changes, and then when Gerrit's internal batch of change ids is exceeded it tries to allocate a new batch which involves writing a blob to a specific ref; it's in this operation that it fails. See [1] and [2] on gerrit where I've added some debug logging in the related classes.

One thing I have found is that adding debug logs in ObjectDirectory#insertUnpackedObject causes it to work properly, so I wonder if there's some kind of timing issue going on.

Has anyone else seen similar issues in this area?

While I have been investigating this I found that the exception handling and logging in the insertUnpackedObject method doesn't make it easy to figure out what's going wrong.  I've pushed a couple of cleanup changes [3].

jgit-dev mailing list
To unsubscribe from this list, visit

Back to the top