Elm Exactly
Results / elm-core /

CoreIssue1060StringToListLoneSurrogateTest

Tags:elm19-bug

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

Issue: elm/core#1060

`String.toList` of a string holding a lone low surrogate returns one `Char`.

<https://github.com/elm/core/issues/1060>

Elm 0.19.1 loops forever on `String.toList "\u{dd56}"` until it runs out of memory; the test caps
the JavaScript heap so that this fails quickly.

This test is probably wrong under A Standard Definition of Elm? It writes the lone surrogate as
the escape `"\u{dd56}"`, which ruling A8 makes invalid: an escape must denote a Unicode scalar
value. <https://elm-test-suite.netlify.app/standard/restrictions/core-escape-unicode> Under A8 the program does not compile, so a
compiler that follows the book fails this test without reaching the bug. `elm-core`'s
`StringToListLoneSurrogateTest` tests the same bug with the lone surrogate computed by
`Char.fromCode`. The test is kept as it is because it is the issue's program.

Results

elm-0.19.1

failran in 5896 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 --->

[26572:0x3f961000]     5581 ms: Mark-Compact (reduce) 254.6 (262.6) -> 254.1 (260.6) MB, pooled: 0 MB, 230.57 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 235 ms) (average mu = 0.182, current[26572:0x3f961000]     5735 ms: Mark-Compact (reduce) 254.5 (260.9) -> 254.1 (260.9) MB, pooled: 0 MB, 130.94 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 134 ms) (average mu = 0.172, current

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near 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: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]

elm-0.19.2

failran in 5640 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 --->

[55884:0x3679a000]     5505 ms: Mark-Compact (reduce) 255.0 (263.1) -> 254.6 (261.1) MB, pooled: 0 MB, 127.80 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 132 ms) (average mu = 0.171, current

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near 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: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]

elm-0.19.3

failran in 5488 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 --->

[85307:0x17641000]     5373 ms: Mark-Compact (reduce) 253.5 (261.9) -> 253.1 (259.6) MB, pooled: 0 MB, 126.62 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 129 ms) (average mu = 0.190, current

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near 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: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]

lamdera-1.5.0

failran in 5529 ms
killed by SIGABRT
--- output ---

<--- Last few GCs --->

[114184:0x44215000]     5403 ms: Mark-Compact (reduce) 254.7 (262.9) -> 254.3 (260.9) MB, pooled: 0 MB, 139.28 / 0.00 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 143 ms) (average mu = 0.164, curren

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near 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: 0x1478993  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 6: 0x1491a6a  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 7: 0x1494c38  [/opt/hostedtoolcache/node/22.23.5/x64/bin/node]
 8: 0x1cfd6e1  [/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-core/CoreIssue1060StringToListLoneSurrogateTest] in its title.

Source

The -- CHECK: lines give the expected output.

module CoreIssue1060StringToListLoneSurrogateTest exposing (main)
{-| `String.toList` of a string holding a lone low surrogate returns one `Char`.
<https://github.com/elm/core/issues/1060>
Elm 0.19.1 loops forever on `String.toList "\u{dd56}"` until it runs out of memory; the test caps
the JavaScript heap so that this fails quickly.
This test is probably wrong under A Standard Definition of Elm? It writes the lone surrogate as
the escape `"\u{dd56}"`, which ruling A8 makes invalid: an escape must denote a Unicode scalar
value. <https://elm-test-suite.netlify.app/standard/restrictions/core-escape-unicode> Under A8 the program does not compile, so a
compiler that follows the book fails this test without reaching the bug. `elm-core`'s
`StringToListLoneSurrogateTest` tests the same bug with the lone surrogate computed by
`Char.fromCode`. The test is kept as it is because it is the issue's program.
-}
-- TAGS: elm19-bug
-- CHECK: length: 1
-- ENV: NODE_OPTIONS=--max-old-space-size=256
import Html exposing (text)
main =
let
_ =
Debug.log "length" (List.length (String.toList "\u{dd56}"))
in
text "done"