EXCEPTION java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again

  • I’ve been getting error

    java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again

    in notification area from time to time (about once a month). It is unresponsive to Retry button, and has so far been related to DavX5 process hanging.

    This time this happened overnight when on charger, and I only saw it when I woke up and turned on the phone, with this error being timestamped 26 June 2021 10:21 (about 1hour 48 minutes before I fetched phone and turned display on at 12:09 to be greeted with DavX5 ANR error).

    DavX5 was also unresponsive to Save/Share logs I had enabled, but this time, after starting app directly and indirectly, after once choosing force-closing Application Not Responding dialog, I’ve managed to produce this davx5-debug.zip that lists this pthread_create error.

    Searching the web, it seems the issue might be caused by too many threads being created (usually by some bug which leads to not disposing of old threads properly). I’ve started the logcat after the fact, and I find that when I turned on the phone (26 June 2021 12:09), it contains in logs this:

    [06-26 12:09:52.054 1437:1569 W/ActivityManager]
    Timeout executing service: ServiceRecord{f4eea6f u0 at.bitfire.davdroid/.syncadapter.CalendarsSyncAdapterService}
    [06-26 12:09:52.876 4659:4673 I/itfire.davdroi]
    Thread[7,tid=4673,WaitingInMainSignalCatcherLoop,Thread*=0x79a502cc00,peer=0x13180078,"Signal Catcher"]: reacting to signal 3

    Could timeouts like this or something else be responsible for pthread_create and/or DavX5 hangs I’m experiencing?

    I should note that I haven’t had hangs nor ANRs nor this pthread_create errors in any other app on this phone (even the ones which do similar periodical syncing with same servers - like ICSx5 or nextcloud client, for example). (I also didn’t ever have any of those issues for years until several months ago, but there have been OS updates as well as DavX5 updates in the meantime)

  • developer

    Thanks for the report. I have made some changes to create less worker threads and to make sure they’re terminated. This will hopefully solve the problem.

    The changes will be comprised in the next version.

  • @rfc2822 Thanks, that sounds great!
    I’ll try new version when it gets out, and report back how it fared here!

Similar topics