ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
7.93k stars 2.16k forks source link

build(ci): upload logs on timeout #16255

Closed david-allison closed 2 weeks ago

david-allison commented 2 weeks ago

A timeout can cancel tests, which blocks log uploads

⚠️ Untested

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif

https://docs.github.com/en/actions/learn-github-actions/expressions#cancelled

david-allison commented 2 weeks ago

This PR should not be merged yet, we should rerun it until the failure is replicated

This both moves the linked issue along, and acts as a confirmation of PR functionality

mikehardy commented 2 weeks ago

I'll attempt to keep re-running the windows test any time I see it's green, until it goes red.

Please anyone else that sees this with windows unit test run as green re-run it as well, the goal is to have it hang + cancel + upload the logs so until it has a red status here we want to re-run it

mikehardy commented 2 weeks ago

This might go faster if the matrix was temporarily tweaked to be windows only for unit tests, and a separate just-for-matrix-expansion-only parameter was added to create like 20 windows runs at once

Here is an example that creates the expansion (we would put 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 etc in there):

https://github.com/ankidroid/Anki-Android/blob/a06ab46ea75b96124cd8a85a13893a46a9ef89b6/.github/workflows/tests_emulator.yml#L37

And note later in the file the logs need that in their name or they clobber each other:

https://github.com/ankidroid/Anki-Android/blob/a06ab46ea75b96124cd8a85a13893a46a9ef89b6/.github/workflows/tests_emulator.yml#L173

david-allison commented 2 weeks ago

I'm frazzled mentally, I can apply a patch at max, or I'll get the change done tomorrow

mikehardy commented 2 weeks ago

Got logs! It worked

https://github.com/ankidroid/Anki-Android/actions/runs/8800864025/artifacts/1441219985

mikehardy commented 2 weeks ago

output is a .bin file 😅 - not sure how to interpret, going to table for the moment it's end of day here too

david-allison commented 2 weeks ago

testDefaultForegroundColor times out - that is NOT what I would have expected

with some strings magic + manual editing

====

I added lines starting with -- for the start and end of tests

david-allison commented 2 weeks ago
net.ankiweb.rsdroid.exceptions.BackendInvalidInputException$BackendCollectionAlreadyOpenException: CollectionAlreadyOpen
at net.ankiweb.rsdroid.exceptions.BackendInvalidInputException$Companion.fromInvalidInputError(BackendInvalidInputException.kt:34)
at net.ankiweb.rsdroid.BackendException$Companion.fromError(BackendException.kt:114)
at net.ankiweb.rsdroid.BackendKt.unpackResult(Backend.kt:271)
at net.ankiweb.rsdroid.BackendKt.access$unpackResult(Backend.kt:1)
at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(Backend.kt:118)
at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(Backend.kt:117)
at net.ankiweb.rsdroid.Backend.withBackend(Backend.kt:131)
at net.ankiweb.rsdroid.Backend.runMethodRaw(Backend.kt:117)
at anki.backend.GeneratedBackend.openCollectionRaw(GeneratedBackend.kt:102)
at anki.backend.GeneratedBackend.openCollection(GeneratedBackend.kt:109)
at net.ankiweb.rsdroid.Backend.openCollection(Backend.kt:98)
at net.ankiweb.rsdroid.Backend.openCollection(Backend.kt:57)
at com.ichi2.libanki.Storage.openDB$AnkiDroid_playDebug(Storage.kt:52)
at com.ichi2.libanki.Collection.reopen(Collection.kt:206)
at com.ichi2.libanki.Collection.reopen$default(Collection.kt:203)
at com.ichi2.libanki.Collection.<init>(Collection.kt:138)
at com.ichi2.libanki.Storage.collection(Storage.kt:40)
at com.ichi2.anki.CollectionManager.ensureOpenInner(CollectionManager.kt:230)
at com.ichi2.anki.CollectionManager.access$ensureOpenInner(CollectionManager.kt:39)
at com.ichi2.anki.CollectionManager$withCol$2.invoke(CollectionManager.kt:101)
at com.ichi2.anki.CollectionManager$withCol$2.invoke(CollectionManager.kt:100)
at com.ichi2.anki.CollectionManager$withQueue$2.invokeSuspend(CollectionManager.kt:86)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:65)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:371)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:21)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:88)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:52)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:43)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
at com.ichi2.anki.Reviewer.addFlags(Reviewer.kt:660)
at com.ichi2.anki.Reviewer.onCreateOptionsMenu(Reviewer.kt:677)
at android.app.Activity.$$robo$$android_app_Activity$onCreatePanelMenu(Activity.java:4343)
at android.app.Activity.onCreatePanelMenu(Activity.java)
at androidx.activity.ComponentActivity.onCreatePanelMenu(ComponentActivity.java:520)
at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:94)
at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:3442)
at androidx.appcompat.app.ToolbarActionBar.populateOptionsMenu(ToolbarActionBar.java:458)
at androidx.appcompat.app.ToolbarActionBar$1.run(ToolbarActionBar.java:58)
at android.os.Handler.$$robo$$android_os_Handler$handleCallback(Handler.java:942)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.$$robo$$android_os_Handler$dispatchMessage(Handler.java:99)
at android.os.Handler.dispatchMessage(Handler.java)
at org.robolectric.shadows.ShadowPausedLooper$IdlingRunnable.doRun(ShadowPausedLooper.java:573)
at org.robolectric.shadows.ShadowPausedLooper$ControlRunnable.run(ShadowPausedLooper.java:536)
at org.robolectric.shadows.ShadowPausedLooper.executeOnLooper(ShadowPausedLooper.java:629)
at org.robolectric.shadows.ShadowPausedLooper.idle(ShadowPausedLooper.java:104)
at org.robolectric.shadows.ShadowPausedLooper.idleIfPaused(ShadowPausedLooper.java:177)
at org.robolectric.android.controller.ActivityController.visible(ActivityController.java:232)
at com.ichi2.anki.RobolectricTest$Companion.startActivityNormallyOpenCollectionWithIntent(RobolectricTest.kt:281)
at com.ichi2.anki.RobolectricTest.startActivityNormallyOpenCollectionWithIntent(RobolectricTest.kt)
at com.ichi2.anki.RobolectricTest.startActivityNormallyOpenCollectionWithIntent$AnkiDroid_playDebugUnitTest(RobolectricTest.kt:339)
at com.ichi2.anki.WhiteboardDefaultForegroundColorTest.getForegroundColor(WhiteboardDefaultForegroundColorTest.kt:43)
at com.ichi2.anki.WhiteboardDefaultForegroundColorTest.testDefaultForegroundColor(WhiteboardDefaultForegroundColorTest.kt:38)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:588)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:290)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:101)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)

--> Reviewer.addFlags --> a281a9a14f884e2bb8742def705873791fea95e0

@criticalAY FYI

... I remember the day when long stacktraces used to faze me... those were the days 😅

criticalAY commented 2 weeks ago

But the col was open for other activities too,

suspend fun getName(resources: Resources): String {
        val overrides = withCol { config.getObject("flagLabels", JSONObject()) }
        return overrides.getStringOrNull(code.toString()) ?: resources.getString(defaultNameRes)
    }
criticalAY commented 2 weeks ago
mikehardy commented 2 weeks ago

slamming this one in outside of queue, queue is rejecting too frequently because of flakes and this is part of fixing the flakes

mikehardy commented 2 weeks ago

This was a huge help! Really happy this is in