Skip to content

GeoRSSPollTask: negative HTTP backend timeout due to int overflow #41

justb4 opened this Issue Apr 12, 2011 · 1 comment

2 participants

justb4 commented Apr 12, 2011

Getting this error from GeoRSSPollTask (GWC 1.2.5):

12 Apr 21:37:32 ERROR [georss.GeoRSSPollTask] - Error encountered trying to poll the GeoRSS feed http://localhost/gr?cmd=feed-get-req&feed=bla. Another attempt will be made after the poll interval of 2 Minutes, 30 Seconds

java.lang.IllegalArgumentException: timeout value is negative
at java.lang.Thread.join(
at org.apache.commons.httpclient.util.TimeoutController.execute(
at org.apache.commons.httpclient.util.TimeoutController.execute(
at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory.createSocket(
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(
at org.apache.commons.httpclient.HttpClient.executeMethod(
at org.apache.commons.httpclient.HttpClient.executeMethod(
at org.geowebcache.georss.GeoRSSReaderFactory.createReader(
at org.geowebcache.georss.GeoRSSPollTask.runPollAndLaunchSeed(
at java.util.concurrent.Executors$
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(
at java.util.concurrent.FutureTask.runAndReset(
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(
at java.util.concurrent.ScheduledThreadPoolExecutor$
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
at java.util.concurrent.ThreadPoolExecutor$

IMO this is because the timeout value is set in
line 41: builder.setBackendTimeout(120 * 1000);

and then in
line 120: this.backendTimeout = backendTimeout * 1000;
and then again on
line 131: params.setConnectionTimeout(backendTimeout * 1000);

All in all this multiplies to:
120 * 1000 * 1000 * 1000 which overflows the int, rendering backendTimeout negative.

@groldan groldan was assigned Jun 30, 2011
@groldan groldan added a commit that closed this issue Jun 30, 2011
@groldan groldan fixes #41, timeout in seconds was being converted to milliseconds twi…
…ce, leading to int overflow and producing a negative value
@groldan groldan closed this in 54f6a29 Jun 30, 2011
justb4 commented Jul 5, 2011

Thanks for fixing this, Gabriel !

@jgroffen jgroffen pushed a commit to lisasoft/geowebcache that referenced this issue Dec 7, 2011
@groldan groldan fixes #41, timeout in seconds was being converted to milliseconds twi…
…ce, leading to int overflow and producing a negative value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.