Repository navigation
Conversation
The packer (PackService, ":pack") runs one job, and a start that comes while it runs another is dropped. A build whose Prepare started then waited for a job that never ran. Prepare now waits after its bind while the packer's first message names another job that runs (the build before it, which stops within seconds of its Stop, or upstream's own Prepare), and the card says what it waits for. The packer tells every bound client of whatever job it runs. Prepare took any of those messages as its own job's state, so another game's progress, or its "done", could end this build. Only messages of this run's job.json count now. A Resume of a paused job read the pause of the run before (job.json says "paused" until the packer takes the job). A pause written before this start is passed over for 30 s; after that it counts, as before. jobStarted() says whether this run started the packer on its job, for a Stop that pauses it (issue igawa6#348).
) A second build was refused ("... is being built now"). It now goes into a build queue, kept in the app's own storage (files/build-queue.tsv, dev.peanuts.build.BuildQueue, plain Java), and BuildService builds one game after the other. The service is sticky: when Android ends the app's process it starts it again and the queue goes on (else at the next start of the app); the game that was building runs again and every step resumes. A game whose build ended the app three times is stopped, so one game cannot loop through the night. - A game whose build fails or is stopped is marked (its card says why, with Dismiss) and the next one starts. - Before each game the queue waits while upstream's PackPolicy says so (heat, battery; with the remembered Go on anyway), while a game of the app runs (memory on 8 GB phones, igawa6#124), while a build with mods runs and while a pack of the next game is being imported (Import pack, igawa6#44). A .nup that does not fit the free space, or less than 0.5 GB where the pack is made, stops the game before anything is written. - Stop and Cancel stop the game that builds; Cancel all and Stop all stop everything. A Stop in Prepare also pauses the packer's job, which went on in the background before. The packer's own Pause pauses the whole queue; Resume (the Up next card, or the job's own Resume on Home's Prepare card) goes on with that game. - The notification says the game's place ("2 of 5") and has Cancel all; between two games it says what the queue waits for. Only the end of the queue alerts, once, with what is ready and what stopped. - Library: a waiting game's cover says "Queued, 3 of 5"; the Building filter has Up next (each waiting game with Remove, Stop all, Resume when paused); the sheet says Add to queue and has Remove from queue; the bottom screen's card has the place, A for the build card, Y to remove. Build all... queues every game that needs a build (Build needed, stopped, or built by an earlier version of the app), after one question that names them. - Import again, Prepare again (upstream's Prepare, one marked line in Ondevice.prepare: UPSTREAM-EDITS Round 58) and the control interface's build, reimport and prepare queue too; status.json has "queue", a library row can be "queued", job stop stops this game, job pause pauses the queue, and screens_off works while the queue waits. - Each build card listener follows one build id, so the end of one game cannot land on the next game's card. Tests: peanuts/tests/test_build_queue.py (BuildQueueJvmTest: order, the file, a cut-off run, a failure that does not stop the queue, removing, Cancel all, the same game twice, the batch's places, a pause, a damaged file; and the wiring).
FAQ: "Can I build several games one after the other?" (Add to queue, Build all..., Queued and Up next, the waits, the storage check, Stop, Cancel all and Pause, what happens when Android ends the app), and the queue in the notifications. CONTROL: build, reimport and prepare go into the queue, job stop and pause, the library row state "queued", and status.json's "queue".
…lds the next one (igawa6#348) A build that failed already stopped its game, and the queue went on with the next. These ends could still hold the queue, or end it until the app was opened: - A packer job that hangs (its tool prints nothing more while the packer's worker lives) was never stalled: the stall rule waited only for a packer that was not bound. Now a running job with no change for 30 minutes is kept as paused and the packer's process is ended (the tool does not answer the packer's own stop; a sticky restart runs only a job that is still running). The same for another game's job a build waits for, and for an import whose progress stands still. Every tool says how far it got at least every few seconds, and a heat or battery pause is a state of its own. - When the packer's process ended (a native crash, Android ending it for memory), Android started it again, but not after a second crash within a minute: the build waited 10 minutes and said only that it stopped making progress. Now it stops 5 minutes after the packer went, with Android's record of why (ApplicationExitInfo) on the card. - A run the app's process did not live through runs again, as before, now with what ended it in the build log. A native crash while importing stops that game at once: run again it crashed the same way, and a second crash within a minute ended Android's restarts of the service until the app was opened. - An Error in a build (OutOfMemoryError, a missing native method) ended the app's process; now it is that game's end. - A full disk while importing or in the packer is OUT_OF_SPACE, so the card offers Free up space. - The wait before a game looks the next game up again each round: one removed meanwhile is not waited for. dev.peanuts.build.BuildWatch holds the rules (plain Java). With the fake engine, files/test-hang-seconds shortens the hang time for a test on a phone; other builds never read it. Tests: peanuts/tests/test_build_queue.py (BuildWatchJvmTest: a hang, a packer that ended, a full disk, a process's end and when it stops a game at once; BuildQueueJvmTest: a cut-off run is marked; and the wiring).
|
Thanks, this closes real gaps in the queue. We reviewed the dev-0.1.8 version ( Please fix before we land it:
Smaller:
The PR says a Thor run follows in a comment; that would help too. Once it's updated we'll run it on an AYN Thor:
|
…and a stopped job stays stopped (igawa6#348) The review of igawa6#555: - A build with mods has the same watchdog as a build (one helper, Prepare.watch). Before, one that hung held the queue for good, since the queue waits while a build with mods runs. A full disk there is OUT_OF_SPACE too. - Every watchdog stop keeps the job as paused, also for a packer that ended or stalled. A packer Android brought back later ran the job with no Prepare behind it: the next game waited, and the pack never reached the library. - A hang ends the packer's processes first and saves "paused" again once they are gone, since the packer could save "running" in between. The job's reason is "hung" or "ended" (upstream's Job.reasonText has words for them), not "user", so the panel no longer says "You paused the build". - A hang is no change and no CPU time used by the :pack processes (read from /proc, the forked ones too) for 30 minutes, or no change at all for 3 hours. A step that prints nothing for a while but works is no hang. The clock is uptime, so a phone that slept after the wake locks ended is no hang when it wakes. - A packer that Android binds again no longer resets the time it went: a new service runs no job. Its last message and save, read in the poll after it went, still count as the old process's, and a packer that runs the job is never gone (a run on a Thor found two crashes within a minute stopped by the 10-minute stall rule, not the 5-minute one). - An import that hangs gets Retry, not Resume, since what it wrote is deleted. Its watchdog covers the keys and the size probe too. A finished import is kept even when the watchdog asked it to stop. One that does not return 2 minutes after the stop is given up: the game is marked, its .part deleted, and the app's process ends, so the queue goes on when Android starts it again. - A native crash during the import stops the game at once only when the tombstone says it was in the import's thread (or says nothing), and what the import wrote is deleted. A crash in another thread runs the game again. - An OutOfMemoryError is logged by its name only, so the log cannot throw again. - The card no longer says "Free some space, then tap Retry" twice. Tests: BuildWatchJvmTest drives the watch over time, CPU time, a packer bound again, the order of a stop, /proc from a copy, the import's watch and a tombstone's crashed thread; test_build_queue.py checks the wiring.
…and a stopped job stays stopped (igawa6#348) The review of igawa6#555: - A build with mods has the same watchdog as a build (one helper, Prepare.watch). Before, one that hung held the queue for good, since the queue waits while a build with mods runs. A full disk there is OUT_OF_SPACE too. - Every watchdog stop keeps the job as paused, also for a packer that ended or stalled. A packer Android brought back later ran the job with no Prepare behind it: the next game waited, and the pack never reached the library. - A hang ends the packer's processes first and saves "paused" again once they are gone, since the packer could save "running" in between. The job's reason is "hung" or "ended" (upstream's Job.reasonText has words for them), not "user", so the panel no longer says "You paused the build". - A hang is no change and no CPU time used by the :pack processes (read from /proc, the forked ones too) for 30 minutes, or no change at all for 3 hours. A step that prints nothing for a while but works is no hang. The clock is uptime, so a phone that slept after the wake locks ended is no hang when it wakes. - A packer that Android binds again no longer resets the time it went: a new service runs no job. Its last message and save, read in the poll after it went, still count as the old process's, and a packer that runs the job is never gone (a run on a Thor found two crashes within a minute stopped by the 10-minute stall rule, not the 5-minute one). - An import that hangs gets Retry, not Resume, since what it wrote is deleted. Its watchdog covers the keys and the size probe too. A finished import is kept even when the watchdog asked it to stop. One that does not return 2 minutes after the stop is given up: the game is marked, its .part deleted, and the app's process ends, so the queue goes on when Android starts it again. - A native crash during the import stops the game at once only when the tombstone says it was in the import's thread (or says nothing), and what the import wrote is deleted. A crash in another thread runs the game again. - An OutOfMemoryError is logged by its name only, so the log cannot throw again. - The card no longer says "Free some space, then tap Retry" twice. Tests: BuildWatchJvmTest drives the watch over time, CPU time, a packer bound again, the order of a stop, /proc from a copy, the import's watch and a tombstone's crashed thread; test_build_queue.py checks the wiring.
|
@igawa6 Thanks for the review. The fixes are one more commit on each branch: e4fe072 on The three to fix first
The smaller ones
Checked: On an AYN Thor (fake engine, the hang time at 60 s by the fake engine's test file, real imports), a queue of four:
Not run on the Thor: a full storage, an import that hangs (the importer has no test switch for it), and a long Tears of the Kingdom or Xenoblade X build. Thanks for the run you planned. |
|
Thanks for the quick and thorough follow-up. e4fe072 covers the three things we asked for before landing:
It covers the smaller points too: How it lands. #448 is in 0.1.8, so this branch now conflicts with dev-0.1.9 in 11 files. The two commits on Before it lands, we will run it on an AYN Thor:
We will post the results here. |
The build queue's three commits of igawa6#448 are in main already; this keeps the two failure commits on top of 0.1.8's texts, the same as on build-queue-0.1.8.
What and why
A follow-up to #448 for #348. It sits on top of #448: its three commits show here until #448 is in, and the new one is the last commit, "a game that crashes, hangs or fills the storage never holds the next one".
It came from the question whether game 2 in the queue still builds when game 1 fails. For an error, such as a damaged file or a tool that exits with an error, it already did: the game is marked Build stopped with the reason and Retry or Resume, and the next game starts by itself. These cases could still hold the queue or end it.
1. A build that hangs
:packprocess is ended, since its tool does not answer the packer's own stop. The game is marked Build stopped, and Resume goes on from what it made so far.2. A packer that crashed and is not started again
ApplicationExitInfo) in the build log, instead of waiting 10 minutes for "no progress".3. A native crash while importing
4. An Error in a build
OutOfMemoryErroror a missing native method in a build ended the app's process. It is now that game's end only.5. A full storage
OUT_OF_SPACE, so the card says to free up some space before Retry.OUT_OF_SPACEafter the text rework, because its message no longer carries the error. The 0.1.8 branch below maps it again.6. Smaller ones
For dev-0.1.8
The same commit with dev-0.1.8's texts, since Prepare and BuildService were reworded there:
davdxpx:build-queue-0.1.8, one commit (1c1412a) on today's dev-0.1.8 (e13e4d8), without conflicts.Code
dev.peanuts.build.BuildWatch: the hang, packer-gone and full-storage rules and the words for Android's exit reasons. It is plain Java, so the JVM test covers it.Prepare: the 30-minute watchdog (endPackerkeeps the job paused and ends:pack), the packer-gone rule (Link.gone,packerEnd), the same watchdog for another game's job inwaitForPacker, andOUT_OF_SPACEfrom the packer's error.BuildService: the import watchdog (Importer.cancel),OUT_OF_SPACEfor the import,catch (RuntimeException | Error), the log line for a run the app's end cut off, the stop at once after a native crash in the import, andwaitTurnreads the next game each round.BuildQueue:Item.cutmarks a run the app's end cut off (not saved).peanuts/docs/FAQ.md: what the queue does with a game that fails, crashes or hangs.Tested
peanuts/tests/test_build_queue.py: the newBuildWatchJvmTest, andBuildQueueJvmTestchecks the cut mark.check-min-api.pyon the APK: nothing newer than API 33.check-publish.shandupstream-update.sh --check.kill -9of the packer and of the app.