[
https://issues.apache.org/jira/browse/MRESOLVER-134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17186781#comment-17186781
]
Michael Osipov edited comment on MRESOLVER-134 at 8/28/20, 8:01 PM:
--------------------------------------------------------------------
Here is the code:
{code:java}
/**
* Gets the byte offset within the resource from which the download should
resume if supported.
*
* @return The zero-based index of the first byte to download or {@code 0}
for a full download from the start of the
* resource, never negative.
*/
public long getResumeOffset()
{
if ( resume )
{
if ( dataFile != null )
{
return dataFile.length();
}
if ( dataBytes != null )
{
return dataBytes.size();
}
}
return 0;
}
{code}
So if the file is partial 0 to size-1 has been downloaded already. It will
start with size. The behavior you see is not a problem with resume, but with
the lacking synchronization (race condition). Maven Resolver 1.6.0 wil provide
two synchronization contexts which solve this issue.
was (Author: michael-o):
Here is the code:
{code:java}
/**
* Gets the byte offset within the resource from which the download should
resume if supported.
*
* @return The zero-based index of the first byte to download or {@code 0}
for a full download from the start of the
* resource, never negative.
*/
public long getResumeOffset()
{
if ( resume )
{
if ( dataFile != null )
{
return dataFile.length();
}
if ( dataBytes != null )
{
return dataBytes.size();
}
}
return 0;
}
{code}
So if the file is partial 0 to size-1 has been downloaded already. It will
start with size. The behavior you see is not a problem with resume, but with
the lacking synchronization. Maven Resolver 1.6.0 wil provide two
synchronization contexts which solve this issue.
> Unsatisfiable Range header causing 416 HTTP error
> -------------------------------------------------
>
> Key: MRESOLVER-134
> URL: https://issues.apache.org/jira/browse/MRESOLVER-134
> Project: Maven Resolver
> Issue Type: Bug
> Components: resolver
> Affects Versions: 1.3.3
> Reporter: Dmitriy Panov
> Priority: Major
> Attachments: broken_m2.zip
>
>
> h3. How to reproduce
> Put partially downloaded artifacts from attachment (corrupted probably due to
> MNG-4706 and MRESOLVER-25) into ~/.m2/repository and try to resolve
> org.junit.jupiter:junit-jupiter-api:5.0.0
> h3. Expected outcome
> Artifacts are resolved
> h3. Actual outcome
> Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not
> transfer artifact org.junit.jupiter:junit-jupiter-api:jar:5.0.0 from/to
> central (https://repo1.maven.org/maven2/): status code: 416, reason phrase:
> Range Not Satisfiable (416)Caused by:
> org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer
> artifact org.junit.jupiter:junit-jupiter-api:jar:5.0.0 from/to central
> (https://repo1.maven.org/maven2/): status code: 416, reason phrase: Range Not
> Satisfiable (416) at
> org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:52)
> at
> org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:369)
> at
> org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:75)
> at
> org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:628)
> at
> org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:262)
> at
> org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:499)
> at
> org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:400)
> ... 31 more
> h3. Workaround
> Pass -Daether.connector.resumeDownloads=false
>
> Issue is still present in 1.5.0
--
This message was sent by Atlassian Jira
(v8.3.4#803005)