Elm Exactly
Results / elm-regex /

RegexIssue18SplitWordBoundaryTest

Tags:elm19-bug

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail

Issue: elm/regex#18

`Regex.split` on a zero-width match such as `\b` never terminates.

<https://github.com/elm/regex/issues/18>

Elm 0.19.1 (elm/regex 1.0.0) keeps pushing empty pieces without advancing, until "RangeError:
Invalid array length" or out of memory (the test caps Node's memory so it fails fast). JavaScript's
`"foo bar".split(/\b/)` gives `["foo"," ","bar"]`.

Results

elm-0.19.1

failran in 1461 ms
killed 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 --->

[31169:0x172c8000]     1125 ms: Scavenge 188.9 (206.4) -> 173.2 (206.4) MB, pooled: 0 MB, 0.06 / 0.00 ms  (average mu = 0.743, current mu = 0.732) allocation failure; 
[31169:0x172c8000]     1341 ms: Mark-Compact 443.9 (461.4) -> 258.2 (291.4) MB, pooled: 0 MB, 97.62 / 0.00 ms  (average mu = 0.747, current mu = 0.750) 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 1464 ms
killed 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 --->

[60473:0x42d91000]     1132 ms: Scavenge 188.9 (206.6) -> 173.2 (206.6) MB, pooled: 0 MB, 0.06 / 0.00 ms  (average mu = 0.741, current mu = 0.732) allocation failure; 
[60473:0x42d91000]     1348 ms: Mark-Compact 443.9 (461.6) -> 258.2 (291.6) MB, pooled: 0 MB, 97.34 / 0.00 ms  (average mu = 0.748, current mu = 0.752) 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 1463 ms
killed 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 --->

[89929:0x7fb3000]     1139 ms: Scavenge 188.9 (206.6) -> 173.2 (206.6) MB, pooled: 0 MB, 0.06 / 0.00 ms  (average mu = 0.750, current mu = 0.743) allocation failure; 
[89929:0x7fb3000]     1353 ms: Mark-Compact 443.9 (461.6) -> 258.2 (291.6) MB, pooled: 0 MB, 99.35 / 0.00 ms  (average mu = 0.747, 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 1463 ms
killed by SIGABRT
--- output ---

<--- Last few GCs --->

[118765:0x44fd2000]     1129 ms: Scavenge 188.9 (206.6) -> 173.1 (206.6) MB, pooled: 0 MB, 0.07 / 0.00 ms  (average mu = 0.741, current mu = 0.750) allocation failure; 
[118765:0x44fd2000]     1344 ms: Mark-Compact 443.9 (461.7) -> 258.1 (291.6) MB, pooled: 0 MB, 97.67 / 0.00 ms  (average mu = 0.747, current mu = 0.750) 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/RegexIssue18SplitWordBoundaryTest] in its title.

Source

The -- CHECK: lines give the expected output.

module RegexIssue18SplitWordBoundaryTest exposing (main)
{-| `Regex.split` on a zero-width match such as `\b` never terminates.
<https://github.com/elm/regex/issues/18>
Elm 0.19.1 (elm/regex 1.0.0) keeps pushing empty pieces without advancing, until "RangeError:
Invalid array length" or out of memory (the test caps Node's memory so it fails fast). JavaScript's
`"foo bar".split(/\b/)` gives `["foo"," ","bar"]`.
-}
-- TAGS: elm19-bug
-- CHECK: split: ["foo"," ","bar"]
-- ENV: NODE_OPTIONS=--max-old-space-size=256
import Html exposing (text)
import Regex
main =
let
wordBoundary =
Maybe.withDefault Regex.never (Regex.fromString "\\b")
_ =
Debug.log "split" (Regex.split wordBoundary "foo bar")
in
text "done"