Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2011-03-29 19:59:42 -0400
committerIan Bull2011-03-29 19:59:42 -0400
commit00d3904edd9a582302e257d728b70ca76e9fab09 (patch)
treec204162cb9528abba7acc4db09e6f107b61d2add /bundles/org.eclipse.equinox.p2.artifact.repository
parenta35e029bf0486801fc6a7c802a27aa4c1604e30f (diff)
downloadrt.equinox.p2-00d3904edd9a582302e257d728b70ca76e9fab09.tar.gz
rt.equinox.p2-00d3904edd9a582302e257d728b70ca76e9fab09.tar.xz
rt.equinox.p2-00d3904edd9a582302e257d728b70ca76e9fab09.zip
ASSIGNED - bug 327256: Infinite loop in p2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327256
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
index 50cd3ef85..ef76dacdc 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
@@ -35,6 +35,12 @@ import org.eclipse.osgi.util.NLS;
* A request to mirror (copy) an artifact into a given destination artifact repository.
*/
public class MirrorRequest extends ArtifactRequest {
+
+ /**
+ * Maximum number of times a request for a single artifact should be tried
+ */
+ private static final int MAX_RETRY_REQUEST = 10;
+
/**
* The name of a repository property on an artifact repository, indicating the base URI
* to be used for reporting download statistics.
@@ -175,10 +181,15 @@ public class MirrorRequest extends ArtifactRequest {
protected IStatus transfer(IArtifactDescriptor destinationDescriptor, IArtifactDescriptor sourceDescriptor, IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
// go until we get one (OK), there are no more mirrors to consider or the operation is cancelled.
+ // Put a hard limit of MAX_RETRY_REQUEST so we don't end up in an infinite loop.
+ // Really, if you've tried MAX_RETRY_REQUEST times without success, it's time to give up
+ // TODO Should we log that we gave up because of the retry count?
// TODO this needs to be redone with a much better mirror management scheme.
+
+ int counter = 0;
do {
status = transferSingle(destinationDescriptor, sourceDescriptor, monitor);
- } while (status.getSeverity() == IStatus.ERROR && status.getCode() == IArtifactRepository.CODE_RETRY);
+ } while (status.getSeverity() == IStatus.ERROR && status.getCode() == IArtifactRepository.CODE_RETRY && counter++ < MAX_RETRY_REQUEST);
if (status.isOK())
collectStats(sourceDescriptor, monitor);
return status;

Back to the top