Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1796 fix infinite enqueue #197

Merged
merged 4 commits into from
May 31, 2024
Merged

1796 fix infinite enqueue #197

merged 4 commits into from
May 31, 2024

Conversation

TylerZeroMaster
Copy link
Contributor

@TylerZeroMaster TylerZeroMaster commented May 15, 2024

part of openstax/ce#1796

Background:

When parse error occurred, the node was not set to loaded (node.isLoaded and node.exists continued to return false)

Since these nodes were never considered loaded, they were re-enqueued for loading forever.

The immediate trigger for the problem was the BookValidationKind.MISSING_PAGE validation in book.ts requiring pages to be loaded to check if they exist.

The underlying issue is a much deeper problem related to the job queue. If too many jobs are enqueued in a short time, poet halts without error. When this occurs, poet must be reloaded.

Limiting re-enqueued nodesToLoad to those that do not have a parse error fixes the immediate issue.

I thought about isLoaded returning this._isLoaded.get() && this._parseError.get() === undefined potentially being a better long-term; however, because of the nature of the bug, I feared that isLoaded may have unintentionally become synonymous with isValid.

@TylerZeroMaster TylerZeroMaster added the bug Something isn't working label May 15, 2024
@TylerZeroMaster TylerZeroMaster requested a review from a team May 15, 2024 22:05
@TylerZeroMaster TylerZeroMaster self-assigned this May 15, 2024
It was only used in tests and was the initial suspect for this bug
Only throw the error if we are not in production

This will become important in the next step
Background:

When parse error occurred, the node was not set to loaded (`node.isLoaded`
and `node.exists` continued to return `false`)

Since these nodes were never considered loaded, they were re-enqueued for
loading forever.

The immediate trigger for the problem was the BookValidationKind.MISSING_PAGE
validation in book.ts requiring pages to be loaded to check if they exist.

The underlying issue is a much deeper problem related to the job queue. If too
many jobs are enqueued in a short time, poet halts without error. When this
occurs, poet must be reloaded.

Limiting re-enqueued `nodesToLoad` to those that do not have a parse error
fixes the immediate issue.

I thought about `isLoaded` returning `this._isLoaded.get() &&
this._parseError.get() === undefined` potentially being a better long-term
solution; however, because of the nature of the bug, I feared that
`isLoaded` may have unintentionally become synonymous with `isValid`.
This title element is required by the schema.
@TylerZeroMaster TylerZeroMaster force-pushed the 1796-fix-infinite-enqueue branch from 32a65f0 to d1ba328 Compare May 31, 2024 14:56
@TylerZeroMaster TylerZeroMaster merged commit 5167038 into main May 31, 2024
1 check passed
@TylerZeroMaster TylerZeroMaster deleted the 1796-fix-infinite-enqueue branch May 31, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants