browserup / browserup-proxy

BrowserUp Proxy is a free utility to watch, test, and manipulate web application network traffic and performance.
https://browserup.com
Apache License 2.0
164 stars 41 forks source link

integer overflow on HarTiming.getWait() #200

Open deavn opened 4 years ago

deavn commented 4 years ago

I noticed below overflow occurs while running browserup after 12 hours. As per below exception, the time spent waiting for a response from the server (in milliseconds) may be larger than max integer on extreme network conditions.

java.lang.ArithmeticException: integer overflow at java.lang.Math.toIntExact(Math.java:1011) at com.browserup.harreader.model.HarTiming.getWait(HarTiming.java:233) at com.browserup.bup.util.BrowserUpProxyUtil.getTotalElapsedTime(BrowserUpProxyUtil.java:152) at com.browserup.bup.filters.HttpConnectHarCaptureFilter.proxyToServerConnectionFailed(HttpConnectHarCaptureFilter.java:185) at com.browserup.bup.filters.BrowserUpHttpFilterChain.lambda$proxyToServerConnectionFailed$8(BrowserUpHttpFilterChain.java:229) at java.util.ArrayList.forEach(ArrayList.java:1257) at com.browserup.bup.filters.BrowserUpHttpFilterChain.proxyToServerConnectionFailed(BrowserUpHttpFilterChain.java:227) at org.littleshoot.proxy.impl.ProxyToServerConnection.become(ProxyToServerConnection.java:401) at org.littleshoot.proxy.impl.ConnectionFlow.lambda$fail$2(ConnectionFlow.java:216) at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514) at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:488) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:427) at io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:170) at io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:93) at io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:28) at org.littleshoot.proxy.impl.ConnectionFlow.fail(ConnectionFlow.java:207) at org.littleshoot.proxy.impl.ConnectionFlow.lambda$doProcessCurrentStep$1(ConnectionFlow.java:161) at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514) at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:507) at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:486) at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:427) at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:129) at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:269) at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:120) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873) at java.lang.Thread.run(Thread.java:748)