Httpv2 add / import hangs during Keep-Alive

An add / import operation takes 5 sec more with Httpv2, where 5 sec corresponds to the server Keep-Alive configuration.

Httpv2 makes a HEAD request during addFile(…) and expects 404 to ensure the file does not already exist.

I think this request attempts to read the response body but a HEAD request obviously does not return one. This makes SVNKit hang until the server closes the connection.

Interesting code lines:
DAVCommitEditor line 374: myConnection.doHead(target)

HTTPRequest line 209 and down.
I think it needs a condition for HEAD requests to ensure it never attempts to read the response body.

I can easily test builds in the snapshot maven repo, if it comes to that.

Hello Thomas,
thanks for the report and for your investigation. I’ll have a look at it and fix it.

Hello Thomas,
I was unable to reproduce the problem. But I’ve added a work-around anyway at r10850.

I’ve described what I experience in SVNKIT-769. In short: the XML parser immediately fails for me when parsing an empty response body after HEAD request, without waiting 5 seconds for the connection to be closed.

Could you have a try? If yes, we will include the fix into 1.10.9 which we will release very soon.

Hello Dmitry,
Thanks for the commit.

That diff looks good to me. I think r10850 implements a correct behaviour for HTTP HEAD so I don’t consider it a work-around.

Which server were you testing against? I have tested Apache/2.4.41 (Ubuntu) and Apache/2.4.52 (Ubuntu). When reading the code (prior to r10850) I am unable to see any reason to get an immediate parse other than the server closing the stream (i.e. Keep-alive disabled).

I have tested jsvn import… with r10850 and based on this testing I would say that the issue is resolved. If you can trigger a snapshot build to your maven repo I would be happy to also test in our full stack.

My Apache version is 2.4.38-3+deb10u7 (default for Debian 10.1) with default settings:

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

I’ve triggered a build on our CI, it will take about 5 hours to complete and when it’s complete, the binary artifacts will be here and you’ll also be able to get artifacts from our Maven (link) — I’m not sure how the version will be named but you’ll recognise it by today’s date.

Note that Maven artifacts will be uploaded to the releases repository, despite the fact that the artifacts names will contain “snapshot” word — in lower case.

In either case, we plan to release SVNKit within the next several days. If until then you confirm that the fix solves the problem, this would be even better. If no, we’ll release 1.10.9 anyway.

The artifact is

<dependency>
  <groupId>org.tmatesoft.svnkit</groupId>
  <artifactId>svnkit</artifactId>
  <version>1.10.8-snapshot20221031114606</version>
</dependency>

in maven.tmatesoft.com releases repository.

Thanks for the build.

I have deployed and tested in our stack. Issue solved!

Looking forward to 1.10.9 when you are ready. Thanks.

Thank you very much for your feedback! We’ll release 1.10.9 within the next couple of days.

1.10.9 is now released.

Thanks, we have now integrated 1.10.9 in our CI.