Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Plugin fails on big(?) files in diff with "Unable to get Stash differential report from Stash" #151

Open
robertklaus-bosch opened this issue Sep 25, 2017 · 5 comments

Comments

@robertklaus-bosch
Copy link

Hi,

we have encountered a problem with the plugin in version 1.3. When it tries to receive the diff from Stash, it fails with an exception:

[ERROR] 16:12:39.722 Unable to get Stash differential report from Stash
org.sonar.plugins.stash.exceptions.StashClientException: java.util.concurrent.ExecutionException: java.util.zip.DataFormatException: invalid stored block lengths
at org.sonar.plugins.stash.client.StashClient.performRequest(StashClient.java:299)
at org.sonar.plugins.stash.client.StashClient.get(StashClient.java:258)
at org.sonar.plugins.stash.client.StashClient.getPullRequestDiffs(StashClient.java:142)
at org.sonar.plugins.stash.StashRequestFacade.getPullRequestDiffReport(StashRequestFacade.java:345)

We assume this is due to a big file in the diff. The file is ~ 5000 lines and is reformatted so in sum we are talking about ~10000 lines. Also when we try to get the pull request via browser it does not work.
As such we are unsure what the problem is, so we decided to report this issue in case somebody has a clue here.

Some more details:
The failure itself comes from netty: "Unexpected I/O exception on channel" as one can see when adding -X to the command line.

It might just be a timeout happeing here. But we are not so familiar with netty:
(removed hostnames/IPs/etc ..)

[DEBUG] 16:12:39.715 Unexpected I/O exception on channel [..]
java.util.zip.DataFormatException: invalid stored block lengths
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Inflater.java:259)
at io.netty.handler.codec.compression.JdkZlibDecoder.decode(JdkZlibDecoder.java:188)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:357)
..
[DEBUG] 16:12:39.716 Closing Channel [..]
[DEBUG] 16:12:39.718 Aborting Future NettyResponseFuture{currentRetry=0,
isDone=0,
isCancelled=0,
asyncHandler=org.asynchttpclient.AsyncCompletionHandlerBase@c9069ae,
nettyRequest=org.asynchttpclient.netty.request.NettyRequest@3c1d273a,
future=java.util.concurrent.CompletableFuture@7434f9b7[Not completed, 1 dependents],
uri=https://../stash/rest/api/1.0/projects/../repos/../pull-requests/29/diff?withComments=true,
keepAlive=true,
redirectCount=0,
timeoutsHolder=org.asynchttpclient.netty.timeout.TimeoutsHolder@2aa24c9,
inAuth=0,
statusReceived=1,
touch=1506348759715}

@t-8ch
Copy link
Contributor

t-8ch commented Sep 25, 2017

@robertklaus-bosch
Can you try to hit the same endpoint with curl?
We have seen issues in the path where Bitbucket corrupted the GZIP stream when serving big files.
(Make sure to use --compressed on the curl cli).

@t-8ch
Copy link
Contributor

t-8ch commented Sep 25, 2017

I just saw your information about the broken display in the browser. I think this will be the gzip corruption.
As a workaround you can disable gzip in

.
Please also report this to Atlassian. (It may have been fixed in recent versions, I am not sure.)

@robertklaus-bosch
Copy link
Author

Curl fails as well with "curl: (23) Error while processing content unencoding: invalid stored block lengths" so BitBucket is the likely culprit ..

@tonyfalabella
Copy link

This is still an issue with Bitbucket 4.12.1 and sonar-stash 1.5.1. The suggestion from @t-8ch works.
As a workaround you can disable gzip in

sonar-stash/src/main/java/org/sonar/plugins/stash/client/StashClient.java
Line 433 in fc69d95
.setCompressionEnforced(true)

I understand sonar-stash plugin will not be supported after release 1.6.0 but perhaps it would be nice to offer a variable to override if you'd like to turn that CompressionEnforced off (for teams using a version of Bitbucket that still don't have the fix)?

@t-8ch
Copy link
Contributor

t-8ch commented Jun 9, 2019

@tonyfalabella If this fixes it for you I can create a Bugfix release after my (current) vacation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants