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

Potential infinite loop when inserting setting up missing rings. #14

Open
mmunro-ltrr opened this issue Oct 9, 2017 · 0 comments
Open

Comments

@mmunro-ltrr
Copy link
Member

mmunro-ltrr commented Oct 9, 2017

When someone enables the option to insert missing rings in the simulated core, this happens where the master chronology has small indices (below a hard-coded threshold of 0.6). Consecutive missing rings are possible if there are consecutive small indices, and there's a loop to handle this, which increments an independent index recording how many rings should be skipped over when making up the core, and advances to the next year in the master by adding this count to the index into the array of master indices. There's an additional constraint that the missing ring should not fall on the start or the end of the simulated core, expressed by the condition at

else if (year > Math.floor(coreStart*index.length) && year < Math.floor(coreStart*index.length) + appSettings.rings - 1 ){

Unfortunately if this condition does exclude a missing ring, it also prevents the advance to the next ring, so the loop never terminates. This happens relatively frequently (a few percent of new simulated cores when absent rings are allowed) and is fairly drastic (it depends on the particular Javascript environment, but can cause the user's browser to freeze up).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant