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

Fix HPC-GAP crash when calling IntFFE repeatedly #5500

Merged
merged 1 commit into from
Sep 2, 2023

Conversation

fingolfin
Copy link
Member

The kernel function INT_FF had a bug under HPC-GAP that could lead to it allocating more and more memory (that it did not actually need), eventually causing GAP to come to a halt or the system running out of memory.

This kernel function is called by e.g. IntFFE and other user facing code. As a result, this code did not terminate (with the fix it runs in a few milliseconds):

for p in Primes do IntFFE(Z(p)); od;

For the experts: the code was directly calling GrowPlist, which does not perform a check to see if the list is actually already big enough. So each time INT_FF was called ended up increasing an internal list by a certain small percentage. But doing this often enough still leads to exponential growth of the size of that list...

I did not include a test case (other than the one in the commit message) because the test really only can test whether GAP hangs and/or gets slow or not, which is not terribly useful by itself. Besides, PR #5495 adds a test which also triggers this problem.

The kernel function `INT_FF` had a bug under HPC-GAP that could lead to
it allocating more and more memory (that it did not actually need),
eventually causing GAP to come to a halt or the system running out of
memory.

This kernel function is called by e.g. `IntFFE` and other user facing
code. As a result, this code did not terminate (with the fix it runs
in a few milliseconds):

    for p in Primes do IntFFE(Z(p)); od;

For the experts: the code was directly calling `GrowPlist`, which
does not perform a check to see if the list is actually already big
enough. So each time `INT_FF` was called ended up increasing an
internal list by a certain small percentage. But doing this often
enough still leads to exponential growth of the size of that list...
@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them topic: HPC-GAP Issues and PRs related to HPC-GAP kind: bug: crash Issues describing bugs that cause GAP to crash, and PRs fixing them (used for release notes) topic: kernel release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Sep 1, 2023
Copy link
Contributor

@ThomasBreuer ThomasBreuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
The problem from #5495 is gone.

@fingolfin fingolfin merged commit 597ea1a into gap-system:master Sep 2, 2023
22 checks passed
@fingolfin fingolfin deleted the mh/hpcgap-fix-ff branch September 2, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: crash Issues describing bugs that cause GAP to crash, and PRs fixing them (used for release notes) kind: bug Issues describing general bugs, and PRs fixing them release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: HPC-GAP Issues and PRs related to HPC-GAP topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants