Skip to content

java.lang.OutOfMemoryError due to attempting to preload all thumbnails #16698

@Xaymar

Description

@Xaymar

⚠️ Before posting ⚠️

  • This is a bug, not a question or an enhancement.
  • I've searched for similar issues and didn't find a duplicate.
  • I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
  • I agree to follow Nextcloud's Code of Conduct.

Steps to reproduce

  1. Create a directory with quite a lot of images and videos.
  2. Open the directory on mobile.
  3. Crash (sometimes).

Expected behaviour

Only thumbnails for what is currently visible should be loaded.

Actual behaviour

Thumbnails for all items are loaded resulting in an out of memory error.

Android version

16

Device brand and model

Samsung S26 Ultra 512GB/12GB

Stock or custom OS?

Stock

Nextcloud android app version

330000090

Nextcloud server version

33.0.0

Using a reverse proxy?

Yes

Android logs

Cause of error

Exception in thread "Thread-29" java.lang.OutOfMemoryError: Failed to allocate a 16 byte allocation with 25680 free bytes and 25KB until OOM, target footprint 536870912, growth limit 536870912; giving up on allocation because <1% of heap free after GC.
    at java.util.Arrays.copyOf(Arrays.java:3785)
    at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:211)
    at org.apache.commons.httpclient.ChunkedInputStream.getChunkSizeFromInputStream(ChunkedInputStream.java:296)
    at org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStream.java:221)
    at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:176)
    at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:196)
    at org.apache.commons.httpclient.ChunkedInputStream.exhaustInputStream(ChunkedInputStream.java:369)
    at org.apache.commons.httpclient.ChunkedInputStream.close(ChunkedInputStream.java:346)
    at java.io.FilterInputStream.close(FilterInputStream.java:180)
    at org.apache.commons.httpclient.AutoCloseInputStream.notifyWatcher(AutoCloseInputStream.java:194)
    at org.apache.commons.httpclient.AutoCloseInputStream.close(AutoCloseInputStream.java:158)
    at sun.nio.cs.StreamDecoder.implClose(StreamDecoder.java:441)
    at sun.nio.cs.StreamDecoder.close(StreamDecoder.java:203)
    at java.io.InputStreamReader.close(InputStreamReader.java:192)
    at com.android.org.kxml2.io.KXmlParser.close(KXmlParser.java:1757)
    at libcore.io.IoUtils$$ExternalSyntheticAutoCloseableDispatcher0.m(D8$$SyntheticClass:0)
    at libcore.io.IoUtils.closeQuietly(IoUtils.java:195)
    at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:155)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
    at org.apache.jackrabbit.webdav.xml.DomUtil.parseDocument(DomUtil.java:104)
    at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseBodyAsDocument(DavMethodBase.java:113)
    at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getRootElement(DavMethodBase.java:137)
    at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.processResponseBody(DavMethodBase.java:282)
    at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1749)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    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 com.owncloud.android.lib.common.OwnCloudClient.executeMethod(OwnCloudClient.java:192)
    at com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation.run(ReadFolderRemoteOperation.java:62)
    at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:193)
    at com.owncloud.android.operations.RefreshFolderOperation.fetchAndSyncRemoteFolder(RefreshFolderOperation.java:460)
    at com.owncloud.android.operations.RefreshFolderOperation.run(RefreshFolderOperation.java:275)
    at com.owncloud.android.lib.common.operations.RemoteOperation.run(RemoteOperation.java:387)
    at java.lang.Thread.run(Thread.java:1563)

App information

  • ID: com.nextcloud.client
  • Version: 330000090
  • Build flavor: gplay

Device information

  • Brand: samsung
  • Device: m3q
  • Model: SM-S948B
  • Id: BP4A.251205.006
  • Product: m3qxeea

Firmware

  • SDK: 36
  • Release: 16
  • Incremental: S948BXXS1AZC7

Server error logs

Additional information

  1. Maybe a duplicate of OutOfMemoryError - Nextcloud crashes every time "Media" tab is opened #14932. Trace is identical to the one shown there, but this one occurs on the files tab.
  2. Reverse Proxy is only in use for external access as I only have one IPv4 address.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions