Dear list,<br><br>this is second time I make this post: for some reason the first post was lost... and it&#39;s good because it was buggy!<br><br>On to the problem:  pink tiles showing up in FireFox.<br><br>The pink tiles are generated because of too many connections, so my problem it&#39;s not that there are pink tiles, the problem it&#39;s that when the server is reachable again, if I for ex. zoom in and out, they don&#39;t desappear as they should.<br>

This is because of aggressive caching on tile to be displayed. If I 
disable caching on server side for tiles, they behave ok... bu I want 
tiles to be able to cache them on clients!<br><br>After some days fighting against this problem, enabling caching, disabling caching.......... I decided to inspect Openlayers code. It&#39; not all really clear, but I realized that the problem <i>can be</i> related to &quot;<b>OpenLayers.Util.onImageLoadError</b>&quot;.<br>

Finally I realized that changing it as reported will fix my problem:<br><br><span style="font-family: courier new,monospace;">OpenLayers.Util.onImageLoadError
 = function() {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    this._attempts = 
(this._attempts) ? (this._attempts + 1) : 1;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if (this._attempts
 &lt;= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        var urls = this.urls;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">        if (urls 
&amp;&amp; urls instanceof Array &amp;&amp; urls.length &gt; 1) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            var src = this.src.toString();</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">            var 
current_url, k;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            for (k = 0; 
current_url = urls[k]; k++) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                if 
(src.indexOf(current_url) != -1) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                   
 break;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            }</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">            var guess =
 Math.floor(urls.length * Math.random());</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            var new_url = urls[guess];</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">            k = 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            while (new_url == current_url 
&amp;&amp; k++ &lt; 4) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                guess =
 Math.floor(urls.length * Math.random());</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                new_url = urls[guess];</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">            }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            this.src = src.replace(current_url, 
new_url);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        } else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            this.src = this.src;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">        }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        <i><b>OpenLayers.Console.log(&quot;attemp 
n.:&quot;,this._attempts);</b></i></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    } else {</span><br style="font-family: courier new,monospace;"><font size="4"><span style="font-family: courier new,monospace;">        <i><b>OpenLayers.Console.log(&quot;error
 loading&quot;, &quot;appending uuu!&quot;);</b></i></span><i><b><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        var dummy = &quot;&amp;uuu&quot;;<br>        if (this.src.match(dummy + &quot;$&quot;) != dummy) {<font size="2"> //only add if it was not added before</font><br>

            this.src = this.src + &quot;&amp;uuu&quot;;<br>        }</span></b></i><br style="font-family: courier new,monospace;"></font><span style="font-family: courier new,monospace;">       
 this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    this.style.display = &quot;&quot;;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">};</span><br><br clear="all">That is: I change the the url of the tile appending some dummy character
 [in this case &quot;uuu&quot;, but it can be anything].<br>This can be done only if the dummy string was not added before [first post bug: I didn&#39;t check it]. If you don&#39;t check It and the address <i>this.src</i> is wrong, you will get OL to continue adding the dummy string going in loop and bombardig the server with requests.<br>

I don&#39;t know enough OL to understand why, but that&#39;s it.<br><br>I would like to have comments from people who knows OL better than me about this &quot;solution&quot;.<br><br>NOTE: it&#39;s possible to use the same technique without modifying OL, doing something <b><i>like</i></b> [untested - must be sure about what is &#39;<b>this</b>&#39; in the context]:<br>

<br><span style="font-family: courier new,monospace;">OpenLayers.Util.oldOnImageLoadError</span> = <span style="font-family: courier new,monospace;">OpenLayers.Util.onImageLoadError;</span><br><span style="font-family: courier new,monospace;">OpenLayers.Util.onImageLoadError = function() {<br>

   this.</span><span style="font-family: courier new,monospace;">oldOnImageLoadError</span><span style="font-family: courier new,monospace;">();</span><br><span style="font-family: courier new,monospace;">   if (this._attempts &gt;= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {</span><br>

<span style="font-family: courier new,monospace;">      //TODO: add dummy</span><br><span style="font-family: courier new,monospace;">   }</span><br><span style="font-family: courier new,monospace;">}<br></span><br>Pietro Ianniello<br>

<br>
<br><br>