sonatype / nexus-public

Sonatype Nexus Repository Open-source codebase mirror
https://www.sonatype.com/products/repository-oss-download
Eclipse Public License 1.0
1.9k stars 560 forks source link

put file with http Expect: 100-continue fails with timeout on tryCreate tempBlob #287

Open ca-stefan-cordes opened 10 months ago

ca-stefan-cordes commented 10 months ago

When putting a file to nexus3 with

curl --location --request PUT 'http://test.nexus.canda.com:8081/repository/Snapshots/com/canda/mule4/mule4-template/1.0.0-local-SNAPSHOT/mule4-template-1.0.0-local-20231027.164040-1.pom' \
--header 'Expect: 100-continue' \
--header 'Content-Length: 10999' \

the request fails after 30 seconds with a http 500 server error and the server shows

2023-11-03 10:59:27,838+0100 WARN  [qtp-1066085455-93]  org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: PUT /repository/Snapshots/com/canda/mule4/mule4-template/1.0.0-local-SNAPSHOT/mule4-template-1.0.0-local-20231027.164040-1.pom
org.sonatype.nexus.blobstore.api.BlobStoreException: BlobId: tmp$b2339fd7-1b4b-4a1f-b370-31084ba1cc74, java.io.IOException: java.util.concurrent.TimeoutException: Idle timeout expired: 30000/30000 ms, Cause: java.util.concurrent.TimeoutException: Idle timeout expired: 30000/30000 ms
    at org.sonatype.nexus.blobstore.file.FileBlobStore.tryCreate(FileBlobStore.java:438)
    at org.sonatype.nexus.blobstore.file.FileBlobStore.create(FileBlobStore.java:368)
    at org.sonatype.nexus.blobstore.file.FileBlobStore.doCreate(FileBlobStore.java:348)
    at org.sonatype.nexus.blobstore.metrics.BlobStoreAnalyticsInterceptor.invoke(BlobStoreAnalyticsInterceptor.java:60)
    at org.sonatype.nexus.blobstore.BlobStoreSupport.create(BlobStoreSupport.java:125)
    at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
    at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:272)
    at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:54)
    at org.sonatype.nexus.blobstore.BlobStoreSupport.create(BlobStoreSupport.java:109)
    at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
    at org.sonatype.nexus.common.stateguard.StateGuard$GuardImpl.run(StateGuard.java:272)
    at org.sonatype.nexus.common.stateguard.GuardedInterceptor.invoke(GuardedInterceptor.java:54)
    at org.sonatype.nexus.repository.storage.StorageFacetImpl.createTempBlob(StorageFacetImpl.java:266)

(full stacktace, see nexus-stacktrace-trycreate.txt )

when removing the --header 'Expect: 100-continue' it works as expected.

cstamas commented 10 months ago

This is clearly nexus bug, as it violates steps as described here: https://stackoverflow.com/questions/35305084/100-continue-with-jersey2-with-jetty9

As can be seen from sources:

It DOES gets the parameters, hence, triggers request consumption while the full request is "not yet here".

ca-stefan-cordes commented 10 months ago

In the meantime I found another workaround for us:

The maven 3.9 workaround is to switch back to the (outdated) wagon protocol via -Dmaven.resolver.transport=wagon

(Proposed solution is to fully support "http 100 expect continue")

nblair commented 9 months ago

Thanks for opening an issue @ca-stefan-cordes - we plan to investigate our compatibility with Maven 3.9 in the near future. In the interim, thank you for sharing the workaround you've discovered.

ca-stefan-cordes commented 2 weeks ago

Do you know when approximately is "near future" ?