Turfjs / Turfjs/turf

BUG: Isolines algorithm endless loop (out of memory)

Open
#1,836 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

@turf/isolines
Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Description

Hello,

in the attached zip file there's a very simple example (including different 2 input datasets) which causes the turf.isonlines() algorithm to loop endlessly and then be stopped by Chrome before a potential out of memory occurred.
The endless loop occurs in the turf.tracePath() function which iterates always on the same points (failing to detect a closed path) filling the 'p' array ('a' array in the minified turf version) until Chrome blocks it preventing an out of memory scenario (the 'p' or 'a' array is about 23 millions elements on my machine).
You can switch the input via the variable whichInput.
Tested on Chrome version: 80.0.3987.87 (Build official) (64 bit)

Thanks

turf-out-of-mem.zip

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

Start by reproducing the endless loop with the attached turf-out-of-mem.zip example and switch between datasets using whichInput. Trace turf.isolines() into turf.tracePath(), focusing on the repeated points and the growing p array described in the report. Done means both inputs terminate without unbounded memory growth.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.