Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341266 - [repository] Lock files created on when no write operation is expected
Summary: [repository] Lock files created on when no write operation is expected
Status: CLOSED WONTFIX
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ian Bull CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-29 14:08 EDT by Ian Bull CLA
Modified: 2019-09-23 09:44 EDT (History)
5 users (show)

See Also:


Attachments
Patch v1 (12.14 KB, patch)
2011-04-04 19:57 EDT, Ian Bull CLA
no flags Details | Diff
mylyn/context/zip (11.51 KB, application/octet-stream)
2011-04-04 19:57 EDT, Ian Bull CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Bull CLA 2011-03-29 14:08:17 EDT
If you use the director application and point to a file URI  (-r file:///...), we will lock the location when the repository is first read. This is to ensure that nobody starts writing there at the same time.  However, this means that a simple operation (like read a repository) has the side effect of creating a new file on disk.  

I'm opening this bug to discuss alternatives.
Comment 1 Ian Bull CLA 2011-03-29 14:13:38 EDT
I see two options here:
1. Only lock when we actually perform a 'write' operation (add new artifact, change something, etc...). 
2. Allow the director to create the repository as 'read-only', and don't use locks for 'read-only' repositories.

Re #1.  If you have multiple processes on the same machine accessing (reading and writing) a repository, you may read a corrupted repo.  Of course, if you use http or some other protocol to read that repository, you may read a corrupted repo too.

Re #2.  This would have the same effect as #1 (you could read a corrupted repository), but this is little trickier to implement.  We may need some new API (to load a repo as read only), and there is the question of side effects (what happens if I try to modify a read-only repo, should that be allowed)?
Comment 2 Thomas Hallgren CLA 2011-03-30 07:04:02 EDT
The permissions used when creating bot the lock file and the directories are also of great importance. I got an unpleasant surprise when I first used the director to install the repository and then started a hudson build that made an attempt to update it. The latter failed with a permission denied because the lock that was set by me during the director call wasn't removable by hudsonbuild.
Comment 3 Ian Bull CLA 2011-04-04 19:57:08 EDT
Created attachment 192511 [details]
Patch v1

This uses the actual artifact repository file (artifacs.jar/xml) as a read lock.  The .lock file is still used when writing / modifying the repository.  This is just the start of a solution, and I don't know if we will got this route, but I don't want to loose this work.
Comment 4 Ian Bull CLA 2011-04-04 19:57:10 EDT
Created attachment 192512 [details]
mylyn/context/zip
Comment 5 Ian Bull CLA 2011-04-12 10:35:12 EDT
I've set the locking behaviour to 'off' by default (See bug#341826) with an option to enable it.  The suitably ugly vm arg to enable it is:
-Declipse.p2.internal.simple.artifact.repository.locking=true
Comment 6 Ian Bull CLA 2011-04-21 13:30:19 EDT
I'm moving this out as locking is turned off by default, so this won't affect normal operation.
Comment 7 Thomas Watson CLA 2011-06-08 11:31:05 EDT
Move all 3.8 bugs to Juno.
Comment 8 Eclipse Genie CLA 2019-09-23 09:44:12 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.