Skip to content

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

Closed
justb4 opened this Issue Apr 12, 2011 · 1 comment

2 participants

@justb4
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(Thread.java:1205)
at org.apache.commons.httpclient.util.TimeoutController.execute(TimeoutController.java:63)
at org.apache.commons.httpclient.util.TimeoutController.execute(TimeoutController.java:82)
at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory.createSocket(ControllerThreadSocketFactory.java:95)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:128)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at org.geowebcache.georss.GeoRSSReaderFactory.createReader(GeoRSSReaderFactory.java:50)
at org.geowebcache.georss.GeoRSSPollTask.runPollAndLaunchSeed(GeoRSSPollTask.java:134)
at org.geowebcache.georss.GeoRSSPollTask.run(GeoRSSPollTask.java:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

IMO this is because the timeout value is set in
https://github.com/GeoWebCache/geowebcache/blob/master/geowebcache/georss/src/main/java/org/geowebcache/georss/GeoRSSReaderFactory.java
line 41: builder.setBackendTimeout(120 * 1000);

and then in
https://github.com/GeoWebCache/geowebcache/blob/master/geowebcache/core/src/main/java/org/geowebcache/util/HttpClientBuilder.java
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
54f6a29
@groldan groldan closed this in 54f6a29 Jun 30, 2011
@justb4
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
998abf8
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.