bzr: ERROR: Could not acquire lock [Errno 11] Resource temporarily unavailable
Bug #122001 reported by
Vincent Ladeuil
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Won't Fix
|
Low
|
Unassigned | ||
Bazaar GTK+ Frontends |
Confirmed
|
Low
|
Unassigned | ||
Debian |
Fix Released
|
Unknown
|
Bug Description
When using bzr viz or bzr gannotate, I can't commit with bzr, it fails with:
bzr: ERROR: Could not acquire lock [Errno 11] Resource temporarily unavailable
If I quit bzr viz or bzr gannotate, all is well.
Changed in bzr: | |
status: | Invalid → New |
Changed in debian: | |
status: | Unknown → Confirmed |
Changed in debian: | |
status: | Confirmed → Fix Released |
To post a comment you must log in.
I'm not sure if this is a bug in bzr, or a bug in bzr-gtk, or if it is actually a "design feature".
Specifically, the problem is that bzr-gtk is locking the tree in read-only mode. Which sort of indicates (to me) that you shouldn't be able to write to it (since it is readonly).
In the past, our read-locks were no-ops because our data structuring generally meant that a writer could not invalidate a reader. But the way we write dirstate now means there is a potential race condition (I'm reading while you are writing), so we use a read lock.
A few possible solutions:
a) Does 'bzr gannotate' need to keep a read-lock on the WT? It could probably grab one when it starts annotating, and then release it once it has the display running.
b) Does 'bzr viz' need a WT lock at all. I could understand it having a Branch lock, but those *are* no-op read-locks.
c) Is it just that this error is not as clear as it could be? "Resource Temporarily Unavailable" versus "Could not lock tree for writing" or "Tree is locked readonly" or something else.
I'll include bzr-gtk as part of this bug, and we can sort out what we want to do about it.
Note, that this also happens for "bzr diff | less" if it is long enough to block the pipe, and then "bzr commit". Or especially "bzr commit" popping up the message editor, and running "bzr diff" in another window.
The fact that we pun read-lock with the length of time to cache information in memory might also be evaluated. But honestly, it is only *safe* to cache if you have a lock, so that you know things aren't changing.
We've also discussed changing things again so that we can avoid OS locks entirely. They seem nice in a lot of ways, (they clean up after themselves, etc), but if we avoid them we structure code closer to not having locks at all (no-op read locks) which has its own benefits.