question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

POTD widget fails with huge images

See original GitHub issue

Summary:

Today’s POTD is massive, which causes max parcel memory limit to be exceeded.

https://upload.wikimedia.org/wikipedia/commons/c/cb/Attacus_taprobanis-Kadavoor-2018-07-13-001.jpg

It would be good to get a smaller version of the file to avoid this.

2019-03-30 14:10:13.462 20695-20821/fr.free.nrw.commons E/unknown:: unhandled exception
    java.lang.IllegalArgumentException: RemoteViews for widget update exceeds maximum bitmap memory usage (used: 6000000, max: 5529600)
        at android.os.Parcel.createException(Parcel.java:1946)
        at android.os.Parcel.readException(Parcel.java:1910)
        at android.os.Parcel.readException(Parcel.java:1860)
        at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.updateAppWidgetIds(IAppWidgetService.java:697)
        at android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java:515)
        at android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java:588)
        at fr.free.nrw.commons.widget.PicOfDayAppWidget$1.onNewResultImpl(PicOfDayAppWidget.java:111)
        at com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber.onNewResultImpl(BaseBitmapDataSubscriber.java:60)
        at com.facebook.datasource.BaseDataSubscriber.onNewResult(BaseDataSubscriber.java:46)
        at com.facebook.datasource.AbstractDataSource$1.run(AbstractDataSource.java:176)
        at com.facebook.common.executors.CallerThreadExecutor.execute(CallerThreadExecutor.java:47)
        at com.facebook.datasource.AbstractDataSource.notifyDataSubscriber(AbstractDataSource.java:167)
        at com.facebook.datasource.AbstractDataSource.notifyDataSubscribers(AbstractDataSource.java:158)
        at com.facebook.datasource.AbstractDataSource.setResult(AbstractDataSource.java:210)
        at com.facebook.imagepipeline.datasource.AbstractProducerToDataSourceAdapter.onNewResultImpl(AbstractProducerToDataSourceAdapter.java:93)
        at com.facebook.imagepipeline.datasource.CloseableProducerToDataSourceAdapter.onNewResultImpl(CloseableProducerToDataSourceAdapter.java:63)
        at com.facebook.imagepipeline.datasource.CloseableProducerToDataSourceAdapter.onNewResultImpl(CloseableProducerToDataSourceAdapter.java:24)
        at com.facebook.imagepipeline.datasource.AbstractProducerToDataSourceAdapter$1.onNewResultImpl(AbstractProducerToDataSourceAdapter.java:71)
        at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:97)
        at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer.onNextResult(MultiplexProducer.java:452)
        at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer$ForwardingConsumer.onNewResultImpl(MultiplexProducer.java:513)
        at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer$ForwardingConsumer.onNewResultImpl(MultiplexProducer.java:506)
        at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:97)
        at com.facebook.imagepipeline.producers.BitmapMemoryCacheProducer$1.onNewResultImpl(BitmapMemoryCacheProducer.java:167)
        at com.facebook.imagepipeline.producers.BitmapMemoryCacheProducer$1.onNewResultImpl(BitmapMemoryCacheProducer.java:118)
        at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:97)
        at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.handleResult(DecodeProducer.java:397)
        at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:319)
        at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:124)
        at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:166)
        at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:202)
        at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:22)
        at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:73)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:51)
        at java.lang.Thread.run(Thread.java:764)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
maskaravivekcommented, Apr 20, 2019

The full image should only be downloaded when the user clicks to view the image.

As per the current code base, even on clicking the image, the media detail view shows the 640 width image as MediaDetailFragment also uses MediaWikiImageView. Will be fixing this too.

Going forward,

  • list views will use the thumbnail, and fallback to the original image if thumbnail is not available
  • the media detail view will use the original URL instead of using the thumbnail.
1reaction
maskaravivekcommented, Mar 30, 2019

The API that we use lets us specify the height and width properties.

iiurlwidth, iiurlheight

API doc: https://www.mediawiki.org/wiki/API:Imageinfo

We can either choose to send these params for all our media calls, which would mean adding these params in appendMediaProperties method. Otherwise, if we want to send these params only for POTD, then getPictureOfTheDay needs to be edited.

Should we hardcode the height and width or should be it determined on the phone’s hardware capabilities? @domdomegg @misaochan

Read more comments on GitHub >

github_iconTop Results From Across the Web

Popular Posts Widget AJAX loaded, Image causing large ...
The Widget itself is AJAX loaded. The images are lazy loaded. Problem: layout shift happening at a higher rate which results into a...
Read more >
D29140 Show POTD in lock screen - KDE's Phabricator
Create an invisible lock screen widget in the desktop, so it fetches ... So this only fixes the problem when the POTD image...
Read more >
There was no NASA Astronomy Picture of the Day app with ...
There was no NASA Astronomy Picture of the Day app with iOS 14 widgets, ... I did notice the app crashes when trying...
Read more >
Topic: Widget images added too large | WordPress.com Forums
I use small images of my book covers in the sidebar on my blog page. Today I tried to update one and though...
Read more >
Bringing Wikipedia to the homescreen on iOS
Widgets can come in three sizes (small, medium and large) and two ... The first widget we designed was the Picture of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found