FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

FFImageLoading.Exceptions.DownloadAggregateException: One or more errors occurred. (Headers timeout)

Open PNDTCS opened this issue 5 years ago • 16 comments

I am working in xamarin android project and loading image using this library with authentication header. I have send headers to this library in my MainActivity and loading image in another activity.

This works fine in xamarin iOS but in Xamarin Android getting header timeout error.

FFImageLoading nuget version : Xamarin.FFImageLoading.2.4.11.982

Please provide solution to fix this issue

PNDTCS avatar Feb 13 '20 09:02 PNDTCS

I am having the same output message only on Android.

In my XAML, I have the following: <ffcache:CachedImage x:Name="HackneyLogo" HorizontalOptions="CenterAndExpand" VerticalOptions="FillAndExpand" WidthRequest="{StaticResource LogoWidthSize}" Aspect="AspectFit" RetryCount="3" RetryDelay="20" CacheType="All" CacheDuration="500" Scale="0.95" DownsampleToViewSize="True"/>

And in my code-behind I am simply declaring the Source: HackneyLogo.Source = new UriImageSource { Uri = new Uri(DataHelpers.GetLogo(1)) };

DataHelpers.GetLogo(int i) { } simply returns the string value of the URL from which the image is loaded.

As stated previously, this works just fine on iOS - I have no issue loading the image, but on Android my images do not get loaded.

TheBaileyBrew avatar Mar 04 '20 13:03 TheBaileyBrew

I am getting this issue as well. Stacktrace included below:

05-21 11:40:41.821 I/mono-stdout(11846): Image loading failed: a7215c38-4727-4e04-ad2a-940f61b49c97Image loading failed: a7215c38-4727-4e04-ad2a-940f61b49c97 FFImageLoading.Exceptions.DownloadAggregateException: One or more errors occurred. (Headers timeout) ---> FFImageLoading.Exceptions.DownloadHeadersTimeoutException: Headers timeout at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c3] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:195 at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:58 at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:19

05-21 11:40:41.826 I/mono-stdout(11846): FFImageLoading.Exceptions.DownloadAggregateException: One or more errors occurred. (Headers timeout) ---> FFImageLoading.Exceptions.DownloadHeadersTimeoutException: Headers timeout

--- End of inner exception stack trace --- at FFImageLoading.Retry.DoAsync[T] (System.Func1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x0023b] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:65 at FFImageLoading.Cache.DownloadCache.DownloadAndCacheIfNeededAsync (System.String url, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.Config.Configuration configuration, System.Threading.CancellationToken token) [0x00401] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:57 at FFImageLoading.DataResolvers.UrlDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00045] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\UrlDataResolver.cs:22 at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, 05-21 11:40:41.826 I/mono-stdout(11846): at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c3] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:195 System.Threading.CancellationToken token) [0x0004e] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:21 at FFImageLoading.Work.ImageLoaderTask3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:618 ---> (Inner Exception #0) FFImageLoading.Exceptions.DownloadHeadersTimeoutException: Headers timeout at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c3] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:195 at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:58 at FFImageLoading.Retry05-21 11:40:41.826 I/mono-stdout(11846): at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:58

.DoAsync[T] (System.Func1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:19 <--- 05-21 11:40:41.826 I/mono-stdout(11846): at FFImageLoading.Retry.DoAsync[T] (System.Func1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:19 05-21 11:40:41.827 I/mono-stdout(11846): --- End of inner exception stack trace --- 05-21 11:40:41.827 I/mono-stdout(11846): at FFImageLoading.Retry.DoAsync[T] (System.Func1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x0023b] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:65 05-21 11:40:41.827 I/mono-stdout(11846): at FFImageLoading.Cache.DownloadCache.DownloadAndCacheIfNeededAsync (System.String url, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.Config.Configuration configuration, System.Threading.CancellationToken token) [0x00401] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:57 05-21 11:40:41.827 I/mono-stdout(11846): at FFImageLoading.DataResolvers.UrlDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00045] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\UrlDataResolver.cs:22 05-21 11:40:41.828 I/mono-stdout(11846): at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x0004e] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:21 05-21 11:40:41.828 I/mono-stdout(11846): at FFImageLoading.Work.ImageLoaderTask3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:618 05-21 11:40:41.829 I/mono-stdout(11846): ---> (Inner Exception #0) FFImageLoading.Exceptions.DownloadHeadersTimeoutException: Headers timeout 05-21 11:40:41.829 I/mono-stdout(11846): at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c3] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:195 05-21 11:40:41.829 I/mono-stdout(11846): at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:58 05-21 11:40:41.829 I/mono-stdout(11846): at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:19 <--- 05-21 11:40:41.830 I/mono-stdout(11846): 05-21 11:40:42.664 W/monodroid-assembly(11846): typemap: unable to find mapping to a Java type from managed type 'System.Byte, mscorlib'

GZidar avatar May 21 '20 01:05 GZidar

I'm having the same issue only on android. This is my stack trace: Image loading failed: https://media.joomeo.com/private/ZmU1MXM2ZjMQThCSd7PAzcDH5yzu8iW_rxgw0kfnow5sc3nbB2qJaA/medium/MVpKWEMwNEpaV2qvLidZaw/cover.jpg FFImageLoading.Exceptions.DownloadAggregateException: One or more errors occurred. (Headers timeout) (Headers timeout) (Headers timeout) (Headers timeout) ---> FFImageLoading.Exceptions.DownloadHeadersTimeoutException: Headers timeout at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c3] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:195 at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:58 at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:19 --- End of inner exception stack trace ---

nunosantosgithub avatar May 21 '20 20:05 nunosantosgithub

Same here...

@ at FFImageLoading.Retry.DoAsync[T] (System.Func1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) <0x8a886c60 + 0x00a00> in <a159011f32534c8eb0455a9cf0bad5a7>:0 at FFImageLoading.Cache.DownloadCache.DownloadAndCacheIfNeededAsync (System.String url, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.Config.Configuration configuration, System.Threading.CancellationToken token) [0x0044b] in <a159011f32534c8eb0455a9cf0bad5a7>:0 at FFImageLoading.DataResolvers.UrlDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x0008f] in <a159011f32534c8eb0455a9cf0bad5a7>:0 at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00098] in <a159011f32534c8eb0455a9cf0bad5a7>:0 at FFImageLoading.Work.ImageLoaderTask3[TDecoderContainer,TImageContainer,TImageView].RunAsync () <0x8a88da84 + 0x01003> in :0 at Forms.Droid.PexGcmListenerService.CreateNotification (System.String title, System.String message, System.Int32 notifyId, System.String tag, System.Int32 screen, System.Int32 screen2, System.Int32 pexid, System.String navparam, System.String lgicurl) [0x001b3] in :0

InnerException: mscorlib - Headers timeout @ at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c8] in :0 at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00097] in :0 at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) <0x8a886c60 + 0x00393> in :0

pboisso avatar Jul 22 '20 17:07 pboisso

Same here...

FFImageLoading.Exceptions.DownloadAggregateException: One or more errors occurred. (Headers timeout) ---> FFImageLoading.Exceptions.DownloadHeadersTimeoutException: Headers timeout
  at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c3] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:195 
  at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:58 
  at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:19 
   --- End of inner exception stack trace ---
  at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x0023b] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:65 
  at FFImageLoading.Cache.DownloadCache.DownloadAndCacheIfNeededAsync (System.String url, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.Config.Configuration configuration, System.Threading.CancellationToken token) [0x00401] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:57 
  at FFImageLoading.DataResolvers.UrlDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00045] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\UrlDataResolver.cs:22 
  at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x0004e] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:21 
  at FFImageLoading.Work.ImageLoaderTask`3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:618 
  at FFImageLoading.TaskParameterPlatformExtensions.AsJPGStreamAsync (FFImageLoading.Work.TaskParameter parameters, System.Int32 quality) [0x00029] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Extensions\TaskParameterPlatformExtensions.cs:39 
  at XXXXXXX () [0x001d8] in C:\Users\XXX
---> (Inner Exception #0) FFImageLoading.Exceptions.DownloadHeadersTimeoutException: Headers timeout
  at FFImageLoading.Cache.DownloadCache.DownloadAsync (System.String url, System.Threading.CancellationToken token, System.Net.Http.HttpClient client, FFImageLoading.Work.TaskParameter parameters, FFImageLoading.DownloadInformation downloadInformation) [0x007c3] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:195 
  at FFImageLoading.Cache.DownloadCache+<>c__DisplayClass15_0.<DownloadAndCacheIfNeededAsync>b__0 () [0x00050] in C:\projects\ffimageloading\source\FFImageLoading.Common\Cache\DownloadCache.cs:58 
  at FFImageLoading.Retry.DoAsync[T] (System.Func`1[TResult] action, System.TimeSpan retryInterval, System.Int32 retryCount, System.Action onRetry) [0x00047] in C:\projects\ffimageloading\source\FFImageLoading.Common\Helpers\Retry.cs:19 <---

Soundman32 avatar Jul 28 '20 07:07 Soundman32

any update on this? receiving this now too, but the images sometimes load. Not sure how to pinpoint, as I'm using this on a listview with quite a few items...

mos379 avatar Oct 14 '20 13:10 mos379

Same error

max-kuzmin avatar Oct 21 '20 20:10 max-kuzmin

the same upd: Fixed via removing "UseLegacyRenderer" flag from Forms.SetFlags()

jocontacter avatar Feb 27 '21 19:02 jocontacter

the same upd: Fixed via removing "UseLegacyRenderer" flag from Forms.SetFlags()

@jocontacter, I'm curious, the "UseLegacyRenderer" flag does not seem to be documented, how did you use it exactely? Any other side effects on other components?

Thanks for sharing a solution.

pboisso avatar Apr 26 '21 23:04 pboisso

Same here. Are there any news regarding this issue?

I checked and I havent set "UseLegacyRenderer", so I dont think it is a viable solution

Thanks in advance

Jose-Develaw avatar Jul 12 '21 15:07 Jose-Develaw

Are there any news on this issue?

MarioSegallaMoreira avatar Jul 16 '21 19:07 MarioSegallaMoreira

Having same issue, anyone?

nabilakhlaque avatar Oct 10 '21 19:10 nabilakhlaque

Here is a "solution" that works fine.

var handler = new HttpClientHandler();
            handler.ClientCertificateOptions = ClientCertificateOption.Manual;
            handler.ServerCertificateCustomValidationCallback =
                (httpRequestMessage, cert, cetChain, policyErrors) => true;

            var client = new HttpClient(handler);
            ImageService.Instance.Initialize(new Configuration
            {
                HttpClient = client
            });

nabilakhlaque avatar Oct 17 '21 12:10 nabilakhlaque

Here is a "solution" that works fine.

Ignoring certificate validation errors is a workaround, but it's not really solving the problem, it's just bypassing security.

Soundman32 avatar Oct 18 '21 10:10 Soundman32

Here is a "solution" that works fine.

Ignoring certificate validation errors is a workaround, but it's not really solving the problem, it's just bypassing security.

Yes that's why I wrote it in quotes... ;)

nabilakhlaque avatar Oct 18 '21 10:10 nabilakhlaque

For me this was caused by a timeout while getting http headers, so I just increased the timeout:

ImageService.Instance.Initialize(new FFImageLoading.Config.Configuration
{
    HttpHeadersTimeout = 60
});

rus-vladimir avatar Aug 19 '22 11:08 rus-vladimir