CatchTheTornado / CatchTheTornado/askql

while fails when iterating many times

Open
#243 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

AskVM bug type:performance
Dominant language
TypeScript
Stars
387
Forks
30
PR merge metrics
No merged PRs in 30d

Description

while works fine when it iterates a couple of times but at some number of iterations it fails. In the example below the number of iterations were between 64 and 65 000 times:

🦄 .editor 
// Entering editor mode (^D to finish, ^C to cancel)
let a = 1
while(a>0) {
  if ((a/1000):equals(floor(a/1000))) {
    log(a)
  }
  a=a+1
}


1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
11000
...
62000
63000
64000
RangeError: Value undefined out of range for undefined options property undefined
    at Map.set (<anonymous>)
    at AsyncHook.init (domain.js:68:15)
    at PromiseWrap.emitInitNative (internal/async_hooks.js:127:43)
    at Promise.then (<anonymous>)
    at step (/Users/milimetr/Desktop/x/askql/dist/utils/index.js:7:91)
    at /Users/milimetr/Desktop/x/askql/dist/utils/index.js:8:9
    at new Promise (<anonymous>)
    at __awaiter (/Users/milimetr/Desktop/x/askql/dist/utils/index.js:4:12)
    at Object.asyncMap (/Users/milimetr/Desktop/x/askql/dist/utils/index.js:76:12)
    at Resource.<anonymous> (/Users/milimetr/Desktop/x/askql/dist/askvm/resources/core/call.js:29:45)

Run using commit f527c5c (master, the latest commit)

Contributor guide

Open the contributing guide

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 loop from the issue at commit f527c5c, then inspect dist/utils/index.js and askvm/resources/core/call.js alongside the reported Node async_hooks stack. Trace what changes after many iterations and verify that the while loop can continue past the failure range without the reported RangeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.