Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when calling RefDirectory:pack #4

Closed
barbasa opened this issue Dec 7, 2023 · 1 comment
Closed

NPE when calling RefDirectory:pack #4

barbasa opened this issue Dec 7, 2023 · 1 comment

Comments

@barbasa
Copy link
Contributor

barbasa commented Dec 7, 2023

RefDirectory:pack might raise an NPE when deleting loose refs as final part of the RefDirectory.pack():

java.lang.NullPointerException
       at org.eclipse.jgit.internal.storage.file.RefDirectory.pack(RefDirectory.java:817)
       at org.eclipse.jgit.internal.storage.file.RefDirectory.pack(RefDirectory.java:729)
       at org.eclipse.jgit.internal.storage.file.PackedBatchRefUpdate.execute(PackedBatchRefUpdate.java:153)
       at org.eclipse.jgit.lib.BatchRefUpdate.execute(BatchRefUpdate.java:589)
       at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:249)
       at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:105)
       at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1462)
       at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1390)

This is happening because the code correctly locks the packed-refs file in RefDirectory:pack.
However, it makes the wrong assumption considering the loose refs set as immutable between during the whole packing process.

The number and values of loose refs on the filesystem can mutate at any time whilst the RefDirectory.pack() is in progress.
Assuming the contrary can lead to an NPE.

@msohn
Copy link
Member

msohn commented Feb 26, 2024

@msohn msohn closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants