Macaulay2 / Macaulay2/M2

ThreadedGB goes into infinite loop

Open
#1,463 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package issue threads
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

The session below illustrates the problem I've encountered, which is probably the same one that causes the github actions to fail occasionally. I enter code that tries to run tgb repeatedly, but eventually, some of the threads go into an infinite loop. It doesn't respond to cancelTask, and the process monitor shows that it is consuming cpu time. This is under Mac OS X or Linux (Fedora).

I don't know how to debug it. Inserting print statements to find out how far each thread doesn't work, because
voluminous printing in threads causes everything to crash.
```m2
+ M2 --no-readline -q --print-width 92
Macaulay2, version 1.16
with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems, LLLBases,
MinimalPrimes, PrimaryDecomposition, ReesAlgebra, TangentCone, Truncations

i1 : loadPackage "ThreadedGB"

o1 = ThreadedGB

o1 : Package

i2 : needsPackage "ThreadedGB"

o2 = ThreadedGB

o2 : Package

i3 : errorDepth = 0

o3 = 0

i4 : QQ[x_1,x_0,x_3,x_5,x_4,x_2,MonomialOrder=>Lex]

o4 = QQ[x , x , x , x , x , x ]
1 0 3 5 4 2

o4 : PolynomialRing

i5 : rnc = minors(2, matrix{{x_0..x_4},{x_1..x_5}})

2 2 2
o5 = ideal (- x + x x , - x x + x x , x x - x , - x x + x x , x x - x x , - x + x x ,
1 0 2 1 2 0 3 1 3 2 1 3 0 4 1 4 3 2 3 4 2
---------------------------------------------------------------------------------------
2
- x x + x x , x x - x x , - x x + x x , x x - x )
1 4 0 5 1 5 4 2 3 4 5 2 3 5 4

o5 : Ideal of QQ[x , x , x , x , x , x ]
1 0 3 5 4 2

i6 : while true do time g = tgb(rnc,4)
-- used 0.00101654 seconds
C-c C-cThreadedGB.m2:81:22:(2):[6]: error: interrupted
ThreadedGB.m2:81:22:(2):[6]: --entering debugger (type help to see debugger commands)
ThreadedGB.m2:81:16-88:13: --source code:
allReady = true;
tasksValues := values(tasks);
for i to #tasksValues-1 do(
if not isReady(tasksValues_i) then allReady = false;
);
if allReady then allowableThreads=1;
sleep 1;
);

ii9 : select(pairs tasks,(k,v)->not isReady v)

oo9 = {((2-7), <>), ((6-7), <>)}

oo9 : List

ii10 : select(pairs tasks,(k,v)->not isReady v)

oo10 = {((2-7), <>), ((6-7), <>)}

oo10 : List
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the repeated `tgb(rnc,4)` session and inspect the task state at the loop in ThreadedGB.m2:81, especially the running tasks shown by `select(pairs tasks,...)`. Compare behavior when interrupting with `cancelTask` and when the GitHub Actions failure occurs. Done means repeated ThreadedGB runs no longer leave tasks consuming CPU indefinitely and cancellation completes reliably.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.