Skip to content

setindex!: MethodError: Cannot convert an object of type Symbol to an object of type String #32157

Closed
@iryabink

Description

@iryabink

I am using pmap to compute in parallel the result of application of the function ppoly(), which takes an array of strings and numbers of the same length. I manually chop these arrays into arrays of arrays, so that the call looks like

ps = pmap(ppoly, words_all_chunks, coeffs_all_chunks)

I do it multiple times with arguments of different lengths, but eventually, when chunks got big enough, Julia triggers a mysterious error:

ERROR: LoadError: On worker 4:
MethodError: Cannot `convert` an object of type Symbol to an object of type String
Closest candidates are:
  convert(::Type{String}, ::FortranFiles.FString{L}) where L at /home/ilya/.julia/packages/FortranFiles/BjZQn/src/string.jl:43 (method too new to be called from this world context.)
  convert(::Type{T<:AbstractString}, ::T<:AbstractString) where T<:AbstractString at strings/basic.jl:207
  convert(::Type{T<:AbstractString}, ::AbstractString) where T<:AbstractString at strings/basic.jl:208
  ...
setindex! at ./array.jl:769
deserialize_fillarray! at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:999
deserialize_array at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:991
handle_deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:749
deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:711
#1 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:849
ntuple at ./tuple.jl:133
deserialize_tuple at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:849
handle_deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:741
deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:711
#1 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:849
ntuple at ./tuple.jl:133
deserialize_tuple at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:849
handle_deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:741
deserialize_msg at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Serialization/src/Serialization.jl:711
#invokelatest#1 at ./essentials.jl:697 [inlined]
invokelatest at ./essentials.jl:696 [inlined]
message_handler_loop at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:160
process_tcp_streams at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:117
#105 at ./task.jl:259
Stacktrace:
 [1] (::getfield(Base, Symbol("##684#686")))(::Task) at ./asyncmap.jl:178
 [2] foreach(::getfield(Base, Symbol("##684#686")), ::Array{Any,1}) at ./abstractarray.jl:1835
 [3] maptwice(::Function, ::Channel{Any}, ::Array{Any,1}, ::Base.Iterators.Zip2{Array{Array{String,1},1},Array{Array{Float64,1},1}}) at ./asyncmap.jl:178
 [4] #async_usemap#669 at ./asyncmap.jl:154 [inlined]
 [5] #async_usemap at ./none:0 [inlined]
 [6] #asyncmap#668 at ./asyncmap.jl:81 [inlined]
 [7] #asyncmap at ./none:0 [inlined]
 [8] #pmap#213(::Bool, ::Int64, ::Nothing, ::Array{Any,1}, ::Nothing, ::Function, ::Function, ::WorkerPool, ::Base.Iterators.Zip2{Array{Array{String,1},1},Array{Array{Float64,1},1}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/pmap.jl:126
 [9] pmap(::Function, ::WorkerPool, ::Base.Iterators.Zip2{Array{Array{String,1},1},Array{Array{Float64,1},1}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/pmap.jl:101
 [10] #pmap#223(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Base.Iterators.Zip2{Array{Array{String,1},1},Array{Array{Float64,1},1}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/pmap.jl:156
 [11] pmap(::Function, ::Base.Iterators.Zip2{Array{Array{String,1},1},Array{Array{Float64,1},1}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/pmap.jl:156
 [12] #pmap#224(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Array{Array{String,1},1}, ::Array{Array{Float64,1},1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/pmap.jl:157
 [13] pmap(::Function, ::Array{Array{String,1},1}, ::Array{Array{Float64,1},1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/pmap.jl:157
 [14] #direct_interaction_space#31(::Float64, ::Bool, ::Function, ::PauliPolynomial, ::Array{Float64,1}, ::Array{Float64,1}) at ./util.jl:156
[15] (::getfield(Main, Symbol("#kw##direct_interaction_space")))(::NamedTuple{(:threshold, :verbose),Tuple{Float64,Bool}}, ::typeof(direct_interaction_space), ::PauliPolynomial, ::Array{Float64,1}, ::Array{Float64,1}) at ./none:0
 [16] #generate_entanglers#63(::String, ::UnitRange{Int64}, ::Array{Any,1}, ::Array{Any,1}, ::Function, ::PauliPolynomial, ::Array{Float64,1}, ::Array{Float64,1}) at aaa.jl:37
 [17] (::getfield(Main, Symbol("#kw##generate_entanglers")))(::NamedTuple{(:space, :rank),Tuple{String,UnitRange{Int64}}}, ::typeof(generate_entanglers), ::PauliPolynomial, ::Array{Float64,1}, ::Array{Float64,1}) at ./none:0
 [18] top-level scope at util.jl:156
 [19] top-level scope at bbb.jl:418
 [20] include at ./boot.jl:317 [inlined]
 [21] include_relative(::Module, ::String) at ./loading.jl:1044
 [22] include(::Module, ::String) at ./sysimg.jl:29
 [23] include(::String) at ./client.jl:392
 [24] top-level scope at none:0

Unfortunately, I cannot make a minimal reproducible example for that, but I suspect it might be related to a similar issue #30405 for getindex! --- some indexing variables are going out of range. Just for an idea how big chunks are:

length.(words_all_chunks) = [2560204, 2560204, 2560204, 2560204]
length.(coeffs_all_chunks) = [2560204, 2560204, 2560204, 2560204]

julia> versioninfo()
Julia Version 1.0.4
Commit 38e9fb7f80 (2019-05-16 03:38 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU           X5675  @ 3.07GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, westmere)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions