Failed to commit reflog entry - unable to create new object.

306 views
Skip to first unread message

Florian Zschocke

unread,
Nov 19, 2014, 4:32:00 PM11/19/14
to git...@googlegroups.com
I need to ask as I am stuck. When pushing to a repository I get these entries in the log. The following are from pushing to a ticket:

2014-11-19 21:00:19 [INFO ]  Verifying Project/server/user.git push ref "refs/heads/ticket/18" received from fzs
2014-11-19 21:00:19 [ERROR] Failed to create orphan branch refs/meta/gitblit/reflog in repository /data/git/Project/server/user.git
org.eclipse.jgit.errors.ObjectWritingException: Unable to create new object: /data/git/Project/server/user.git/objects/7d/a4455981ac2ea0de924f0fc5945de023f3cfdd
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.insertOneObject(ObjectDirectoryInserter.java:126)
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:92)
        at org.eclipse.jgit.lib.ObjectInserter.insert(ObjectInserter.java:338)
        at com.gitblit.utils.JGitUtils.createOrphanBranch(JGitUtils.java:2084)
        at com.gitblit.utils.RefLogUtils.updateRefLog(RefLogUtils.java:236)
        .....

2014-11-19 21:00:19 [ERROR] Failed to commit reflog entry to /data/git/Project/server/user.git
org.eclipse.jgit.errors.ObjectWritingException: Unable to create new object: /data/git/Project/server/user.git/objects/25/4f1e069cf5111a99815a9beb20100ef3855b79
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.insertOneObject(ObjectDirectoryInserter.java:126)
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:92)
        at org.eclipse.jgit.lib.ObjectInserter.insert(ObjectInserter.java:338)
        at com.gitblit.utils.RefLogUtils.createIndex(RefLogUtils.java:364)
        at com.gitblit.utils.RefLogUtils.updateRefLog(RefLogUtils.java:247)
        .....

The commits show up in the ticket, the tickets work, everything seems to work. There is no refs/meta directory in the repository. I checked file system permissions and I can't find any fault with them. There are other objects in /objects/7d. The weird thing is, that for a different push to a branch a similar thing happens, trying to create the same first object:

2014-11-19 20:35:59 [INFO ] fzs UPDATED refs/heads/develop in Project/server/user.git (from 8844d072afaa51984db4181868b23c546831effc to fbd4df92b61c716d343cd181ad73506ebd6210f5)
2014-11-19 20:35:59 [ERROR] Failed to create orphan branch refs/meta/gitblit/reflog in repository /data/git/Project/server/user.git
org.eclipse.jgit.errors.ObjectWritingException: Unable to create new object: /data/git/Project/server/user.git/objects/7d/a4455981ac2ea0de924f0fc5945de023f3cfdd

2014-11-19 20:35:59 [ERROR] Failed to commit reflog entry to /data/git/Project/server/user.git
org.eclipse.jgit.errors.ObjectWritingException: Unable to create new object: /data/git/Project/server/user.git/objects/96/facd0fca16aa937471f4ae2a55d1eb956430d1

Again, the push itself works, the commit is there in a pack file.

I don't know what is going on here. Any ideas?

Stumped,
Florian

James Moger

unread,
Nov 20, 2014, 8:51:15 AM11/20/14
to git...@googlegroups.com
That's a tricky one.  I don't have the answer.  Digging into the JGit sources I come across the result code that triggers the thrown exception.  Unfortunately it is not very helpful.  My first guess was file system permissions, but you have checked that.  Are you symlinking the directories in your ${repositoriesFolder} or storing them on a network share?

ObjectId insertUnpackedObject(tmp, id, false) {
...
// The object failed to be renamed into its proper
// location and it doesn't exist in the repository
// either. We really don't know what went wrong, so
// fail.
//
FileUtils.delete(tmp, FileUtils.RETRY);
return InsertLooseObjectResult.FAILURE;
}


--
You received this message because you are subscribed to the Google Groups "gitblit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitblit+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthias Sohn

unread,
Nov 20, 2014, 10:27:18 AM11/20/14
to git...@googlegroups.com
we don't see the reason why renaming fails due to the shortcomings of
boolean java.io.File.renameTo(File dest)
which is just returning false if renaming failed.

You could try a custom build on Java 7 tweaking line 600 of ObjectDirectory
http://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java#n600
to use java.nio.file.Files.move() which throws an IOException when renaming fails
which should reveal the root cause of this problem.

Apply the attached patch to the root of the sources of the jgit version you use, 
build that using "mvn clean install"  and replace the jgit library used by your gitblit
server and retry your scenario. The patch should printout the stacktrace of the
failing rename.

--
Matthias
ObjectDirectory.patch

Florian Zschocke

unread,
Nov 21, 2014, 9:55:39 AM11/21/14
to git...@googlegroups.com
No symlinking anywhere in the repositories.
I'll set up a second server and see if it behaves the same. Then test your patch on it, hoping I don't have to use the productive server for it.

Thank you,
Florian
Reply all
Reply to author
Forward
0 new messages