Repeat background does not work

Open
#348 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
android, kotlin

Research direction

The repro steps are in the issue, but the attached log is an OutOfMemoryError while decoding stroke points, not a background-rendering trace. Start with the decode path in EncodePolyline.kt (decode), StrokePointConverter.kt (decodeStrokePoints) and Db.kt (Converters.toStrokePoints), reached through PageDao_Impl.getPageWithDataById. Reproduce on a notebook with the repeat-background image, then check whether the missing background on subpage 2 and the OOM share a cause. Done means the background repeats on subpage 2 without the crash.

Written by the indexing model from the issue text.

Description

bug

Describe the bug
When using an image as background there is an option "Repeat background". In v0.2.6 this does not work.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new notebook and open it
  2. Open "Change Background", go to Image
  3. Select an image and activate "Repeat background"
  4. Close modal and scroll down to subpage 2
  5. No background on subpage 2 🤷

Logs from the app

──── crash_1791642201663_1.txt ────
thread=DefaultDispatcher-worker-12
java.lang.OutOfMemoryError: Failed to allocate a 32 byte allocation with 508400 free bytes and 496KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
	at java.util.ArrayList.iterator(ArrayList.java:834)
	at com.ethran.notable.data.db.EncodePolylineKt.decode(EncodePolyline.kt:117)
	at com.ethran.notable.data.db.StrokePointConverterKt.getDecodedListFloat(StrokePointConverter.kt:418)
	at com.ethran.notable.data.db.StrokePointConverterKt.decodeStrokePoints(StrokePointConverter.kt:360)
	at com.ethran.notable.data.db.Converters.toStrokePoints(Db.kt:51)
	at com.ethran.notable.data.db.PageDao_Impl.__fetchRelationshipStrokeAscomEthranNotableDataDbStroke(PageDao_Impl.kt:615)
	at com.ethran.notable.data.db.PageDao_Impl.getPageWithDataById$lambda$0(PageDao_Impl.kt:313)
	at com.ethran.notable.data.db.PageDao_Impl$$ExternalSyntheticLambda6.invoke(D8$$SyntheticClass:0)
	at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1$1.invokeSuspend(DBUtil.kt:61)
	at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1$1.invoke(Unknown Source:8)
	at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1$1.invoke(Unknown Source:4)
	at androidx.room.coroutines.PassthroughConnection.transaction(PassthroughConnectionPool.kt:127)
	at androidx.room.coroutines.PassthroughConnection.access$transaction(PassthroughConnectionPool.kt:77)
	at androidx.room.coroutines.PassthroughConnection$withTransaction$2.invokeSuspend(PassthroughConnectionPool.kt:103)
	at androidx.room.coroutines.PassthroughConnection$withTransaction$2.invoke(Unknown Source:8)
	at androidx.room.coroutines.PassthroughConnection$withTransaction$2.invoke(Unknown Source:2)
	at androidx.room.RoomDatabaseKt__RoomDatabase_androidKt.compatTransactionCoroutineExecute(RoomDatabase.android.kt:2187)
	at androidx.room.RoomDatabaseKt.compatTransactionCoroutineExecute(Unknown Source:1)
	at androidx.room.RoomDatabase$createConnectionManager$3.invoke(RoomDatabase.android.kt:338)
	at androidx.room.RoomDatabase$createConnectionManager$3.invoke(RoomDatabase.android.kt:338)
	at androidx.room.coroutines.PassthroughConnection.withTransaction(PassthroughConnectionPool.kt:103)
	at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invokeSuspend(DBUtil.kt:59)
	at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invoke(Unknown Source:8)
	at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invoke(Unknown Source:4)
	at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invokeSuspend(PassthroughConnectionPool.kt:59)
	at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invoke(Unknown Source:8)
	at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invoke(Unknown Source:4)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:42)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:164)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
	at androidx.room.coroutines.PassthroughConnectionPool.useConnection(PassthroughConnectionPool.kt:59)
	at androidx.room.RoomConnectionManager.useConnection(RoomConnectionManager.android.kt:138)
	at androidx.room.RoomDatabase.useConnection(RoomDatabase.android.kt:619)
	at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$$inlined$compatCoroutineExecute$DBUtil__DBUtil_androidKt$1.invokeSuspend(DBUtil.android.kt:261)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
	at androidx.room.TransactionExecutor.execute$lambda$1$lambda$0(TransactionExecutor.android.kt:38)
	at androidx.room.TransactionExecutor$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:920)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@364ad9e, Dispatchers.Default]
Dominant language
Kotlin
Stars
269
Forks
44
Avg merge
1d 17h
Merged PRs (30d)
22

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Ethran/notable

All issues in Ethran/notable

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.