JuliaStrings / InlineStrings.jl

Fixed-width string types for Julia
Other
45 stars 13 forks source link

StackOverflow with string promotion #65

Closed bkamins closed 1 year ago

bkamins commented 1 year ago

See https://github.com/JuliaData/DataFrames.jl/issues/1905#issuecomment-1584909232.

It seems that doing ["y", reverse(cols)...] where cols is an array of InlineString values leads to StackOverflow (the issue is tricky as it does not show up on Win11, but is present on Mac and Linux).

nickrobinson251 commented 1 year ago

Thanks for the report!

How can this be reproduced?

I tried:

(InlineStrings) pkg> st
Project InlineStrings v1.4.0
Status `~/repos/InlineStrings.jl/Project.toml`
  [69de0a69] Parsers v2.5.10

julia> VERSION
v"1.8.4"

julia> cols = [InlineString("x$i") for i in 1:10];

julia> typeof(cols)
Vector{String3} (alias for Array{String3, 1})

julia> ["y", reverse(cols)...]
11-element Vector{String}:
 "y"
 "x10"
 "x9"
 "x8"
 "x7"
 "x6"
 "x5"
 "x4"
 "x3"
 "x2"
 "x1"

 julia> String7["y", reverse(cols)...]
11-element Vector{String7}:
 "y"
 "x10"
 "x9"
 "x8"
 "x7"
 "x6"
 "x5"
 "x4"
 "x3"
 "x2"
 "x1"
bkamins commented 1 year ago

How can this be reproduced?

You have the reproduction discussion in https://github.com/JuliaData/DataFrames.jl/issues/1905#issuecomment-1584562958 that I linked.

I cannot reproduce it either as I have Win11 and it seems to break only on Linux and Mac.

bjarthur commented 1 year ago

you need to evaluate those arrays inside threaded loop. see https://github.com/JuliaData/DataFrames.jl/issues/1905#issuecomment-1586188859

quinnj commented 1 year ago

This is a Base + threads issue; not InlineStrings-specific