Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading a large log file fails in jenkins #141

Closed
diroussel opened this issue Jun 8, 2018 · 1 comment
Closed

Downloading a large log file fails in jenkins #141

diroussel opened this issue Jun 8, 2018 · 1 comment

Comments

@diroussel
Copy link

I have a jenkins job that has a very large output log: 2,782,890 KB in size.

When I try to download it I get this exception:

java.lang.ArithmeticException: The byte count 2846143684 is too large to be converted to an int
	at org.apache.commons.io.output.CountingOutputStream.getCount(CountingOutputStream.java:71)
	at org.kohsuke.stapler.framework.io.LargeText.writeLogTo(LargeText.java:237)
	at hudson.console.AnnotatedLargeText.writeLogTo(AnnotatedLargeText.java:154)
	at org.kohsuke.stapler.framework.io.LargeText.writeLogTo(LargeText.java:194)
	at hudson.console.AnnotatedLargeText.writeLogTo(AnnotatedLargeText.java:145)
	at io.jenkins.blueocean.service.embedded.rest.LogResource.writeLogs(LogResource.java:75)
	at io.jenkins.blueocean.service.embedded.rest.LogResource.writeLog(LogResource.java:51)
	at io.jenkins.blueocean.service.embedded.rest.LogResource.doIndex(LogResource.java:37)
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
	at org.kohsuke.stapler.IndexDispatcher.dispatch(IndexDispatcher.java:26)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
Caused: javax.servlet.ServletException
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:765)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
	at org.kohsuke.stapler.MetaClass$3.doDispatch(MetaClass.java:209)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
        ..

Looking at CountingOutputStream there is a getByteCount() method that returns a long. But LargeText is calling getCount() which does a length check, and throws this exception, before casting to an int.

LargeText.writeLogTo() returns a long, so it should be calling getByteCount() and dealing with longs, and thus allow large log files to be downloaded without this exception.

jglick added a commit that referenced this issue Jan 8, 2019
Enable large log files to be downloaded. Fix for #141
@jglick
Copy link
Member

jglick commented Jan 8, 2019

Fixed in #151.

@jglick jglick closed this as completed Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants