Our customer is using our application (using RadMap) with a custom tiled data source to a remote map data source across a very slow network. Can you tell me:
1. What timeout is used for web requests to the map data source? (I believe the default timeout for WebRequest is 100 seconds)
2. Is it possible to change the timeout on the web requests for tiles?
3. What happens if a tile request times-out? Our customer suspects that the Telerik code is caching the timed-out tile response - is that true?
We are currently using Telerik v2019.1.116.45
Thanks
Pete
3 Answers, 1 is accepted
I will try to explain how tiles downloading work in RadMap. Map uses background treads for downloading tiles. Separate thread downloads separate tile. On successfull download, byte array with the Image of the tile is saved. Also some information from WebClients's Response Headers is collected like "Content-Length", "Expires", "no-tile", "X-VE-Tile-Info". For other cases (not successful downloads) we check for cancelled status or Notfound / notauthorized statuses:
private
void
DownloadDataCompletedThread(
object
status)
{
DownloadDataCompletedEventArgs e =
this
.completedEventArgs;
if
(e !=
null
)
{
if
(e.Error !=
null
)
{
if
(
this
.CancelledOrBadResponse(e.Error))
{
this
.Dispose();
return
;
}
this
.Reload();
}
else
{
this
.tileBody = e.Result;
this
.CompleteDownload();
}
}
}
private
bool
CancelledOrBadResponse(Exception error)
{
var exception = error
as
WebException;
if
(exception !=
null
)
{
if
(exception.Status == WebExceptionStatus.RequestCanceled)
{
return
true
;
}
var response = exception.Response
as
HttpWebResponse;
if
(response !=
null
)
{
switch
(response.StatusCode)
{
case
HttpStatusCode.NotFound:
return
true
;
case
HttpStatusCode.Unauthorized:
return
this
.HttpUnauthorizedResponse(response);
}
}
}
return
false
;
}
We do not check for timeout response. This means timeout tiles go into queue of problematic tiles which is constantly iterated via background thread. So in theory, even if you set bigger timeout, the code will still queue the timeout tiles in a separate queue and will try to download it later (when threads are free and normal tiles are downloaded).
We cannot currently control the timeout property of the WebRequest as this requires inheriting the WebClient class we use internally. Its default timeout is 100s so your expectation is correct. There is no caching of timed-out tiles.
I hope this information is useful. If not, can you please elaborate more on your scenario - what is happening for a longer period of time ? Can your server providing tiles be accessed outside of your network so we can debug such scenario on our side ?
Regards,
Petar Mladenov
Progress Telerik

Interesting. Peter M, do you know when code was added to check these headers? In my ticket from a few years ago, 822001, it sounded as though there was no error checking done. We don't use MapQuest anymore and we haven't seen the issue since.
Hi Jason,
The no-tile response check is added in 2018 , this way fixing issue with showing empty images in some zoom levels in bing provider.
string notTileHeader = this.webClient.ResponseHeaders["X-VE-Tile-Info"];
if (notTileHeader == "no-tile")
{
this.contentLength = 0;
this.tileBody = new byte[0];
}
The cancelled or bad-response check code is from 2013. "Content-length" , "expires" checks are from 2012.
Regards,
Petar Mladenov
Progress Telerik