RegexIssue6SplitEmptyRegexTest
Tags:elm19-bug
Issue: elm/regex#6
`Regex.split` with a regex matching the empty string loops forever, until memory runs out. <https://github.com/elm/regex/issues/6> `_Regex_splitAtMost` sets `start = re.lastIndex`, which does not advance on an empty match. Elm 0.19.1 (elm/regex 1.0.0) runs out of memory (the test caps Node's memory so it fails fast). JavaScript's `"abc".split(/(?:)/)` gives `["a","b","c"]`; elm/regex is documented as JavaScript regular expressions.
Results
elm-0.19.1
failran in 1423 mskilled by SIGABRT --- output --- Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. <--- Last few GCs ---> [31195:0x20a51000] 1087 ms: Scavenge 188.9 (206.6) -> 173.2 (206.6) MB, pooled: 0 MB, 0.09 / 0.00 ms (average mu = 0.757, current mu = 0.753) allocation failure; [31195:0x20a51000] 1306 ms: Mark-Compact 443.9 (461.6) -> 258.2 (291.6) MB, pooled: 0 MB, 99.87 / 0.00 ms (average mu = 0.749, current mu = 0.745) allocation failure; scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace ----- 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 4: 0x1478965 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 5: 0x14921f9 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 6: 0x14668f8 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 7: 0x1467825 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 8: 0x144042e v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 9: 0x18a2d3c v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 10: 0x1e02af6 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
elm-0.19.2
failran in 1430 mskilled by SIGABRT --- output --- Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. <--- Last few GCs ---> [60498:0xdc65000] 1105 ms: Scavenge 188.9 (206.6) -> 173.2 (206.6) MB, pooled: 0 MB, 0.08 / 0.00 ms (average mu = 0.733, current mu = 0.725) allocation failure; [60498:0xdc65000] 1324 ms: Mark-Compact 443.9 (461.6) -> 258.2 (291.6) MB, pooled: 0 MB, 100.01 / 0.00 ms (average mu = 0.742, current mu = 0.746) allocation failure; scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace ----- 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 4: 0x1478965 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 5: 0x14921f9 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 6: 0x14668f8 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 7: 0x1467825 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 8: 0x144042e v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 9: 0x18a2d3c v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 10: 0x1e02af6 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
elm-0.19.3
failran in 1439 mskilled by SIGABRT --- output --- Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. <--- Last few GCs ---> [89962:0x2a152000] 1108 ms: Scavenge 188.9 (206.6) -> 173.2 (206.6) MB, pooled: 0 MB, 0.07 / 0.00 ms (average mu = 0.752, current mu = 0.750) allocation failure; [89962:0x2a152000] 1321 ms: Mark-Compact 443.9 (461.6) -> 258.2 (291.6) MB, pooled: 0 MB, 97.99 / 0.00 ms (average mu = 0.748, current mu = 0.746) allocation failure; scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace ----- 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 4: 0x1478965 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 5: 0x14921f9 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 6: 0x14668f8 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 7: 0x1467825 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 8: 0x144042e v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 9: 0x18a2d3c v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 10: 0x1e02af6 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
lamdera-1.5.0
failran in 1424 mskilled by SIGABRT --- output --- <--- Last few GCs ---> [118791:0x281a1000] 1094 ms: Scavenge 188.9 (206.6) -> 173.1 (206.6) MB, pooled: 0 MB, 0.09 / 0.00 ms (average mu = 0.740, current mu = 0.745) allocation failure; [118791:0x281a1000] 1312 ms: Mark-Compact 443.9 (461.7) -> 258.1 (291.6) MB, pooled: 0 MB, 100.29 / 0.00 ms (average mu = 0.743, current mu = 0.744) allocation failure; scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace ----- 1: 0xe48c12 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 2: 0x1249780 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 3: 0x1249a57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 4: 0x1478965 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 5: 0x14921f9 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 6: 0x14668f8 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 7: 0x1467825 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 8: 0x144042e v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 9: 0x18a2d3c v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/hostedtoolcache/node/22.23.5/x64/bin/node] 10: 0x1e02af6 [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-regex/RegexIssue6SplitEmptyRegexTest] in its title.
Source
The -- CHECK: lines give the expected output.
module RegexIssue6SplitEmptyRegexTest exposing (main)
{-| `Regex.split` with a regex matching the empty string loops forever, until memory runs out.
<https://github.com/elm/regex/issues/6>
`_Regex_splitAtMost` sets `start = re.lastIndex`, which does not advance on an empty match. Elm
0.19.1 (elm/regex 1.0.0) runs out of memory (the test caps Node's memory so it fails fast). JavaScript's
`"abc".split(/(?:)/)` gives `["a","b","c"]`; elm/regex is documented as JavaScript regular
expressions.
-}
-- TAGS: elm19-bug
-- CHECK: split: ["a","b","c"]
-- ENV: NODE_OPTIONS=--max-old-space-size=256
import Html exposing (text)
import Regex
main =
let
everyCharacter =
Maybe.withDefault Regex.never (Regex.fromString "")
_ =
Debug.log "split" (Regex.split everyCharacter "abc")
in
text "done"