Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

RemoveReference doesn't always work #648

Closed
jfontan opened this issue Nov 20, 2017 · 2 comments
Closed

RemoveReference doesn't always work #648

jfontan opened this issue Nov 20, 2017 · 2 comments

Comments

@jfontan
Copy link
Contributor

jfontan commented Nov 20, 2017

Sometimes deleting several references in a row do not work. In the test file provided several references are deleted a row. When the test finishes the repository sometimes still have references. Adding a sleep between RemoveReference calls fixes the problem so it may be caused by a race condition.

https://gist.github.com/jfontan/79187ee5e278f3a769a6a69bfc60a837

@mcuadros mcuadros added the bug label Nov 21, 2017
@mcuadros
Copy link
Contributor

The error was intruduced by @erizocosmico at PR #563 (5a7b7af#diff-c206d8d5faa79122f47e8d63a810f54aR304)

Since the modifications are done at exactly the same second, even maybe the same nanosecond the modTime remains the same and cache is not refreshed. Even if we modify the code to invalidate the cache this doesn't means that an external program can reproduce a similar behavior.

@erizocosmico the read of references are a bottleneck? How much was improvement of this PR?

//cc @orirawlings

@erizocosmico
Copy link
Contributor

The main bottleneck was traversing all directories under refs/ (because Refs was being called inside Ref) as far as I remember, so I think we should be good reverting that. We could maybe just read until the reference is found, not making it necessary to read the whole file, for example.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants