Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
iryabink opened this issue May 27, 2019 · 8 comments

Comments

@iryabink
Copy link

iryabink commented May 27, 2019

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)
@hotarolag
Copy link

I'm facing same problem. Have you already fixed this?

@bblankrot
Copy link

I too am encountering this. Have either of you solved this cryptic error? To be clear, everything works when using a single process.

@iryabink
Copy link
Author

iryabink commented Nov 7, 2019 via email

@bblankrot
Copy link

I've had this happen in both Julia 1.1.1 and 1.2.0. No luck reducing the example so far (simple functions all work), but I will continue trying.

@fargolo
Copy link

fargolo commented Mar 3, 2020

Same problem for me. Parallel computation breaking it.

@Prashantmdgl9
Copy link

I was trying to run the Flux tutorial and I get something similar
using CSV, DataFrames

apples = CSV.File(datapath("data/apples.dat"))
apples = DataFrame(CSV.File(datapath("data/apples.dat")))

Both of them yield the same error:

MethodError: Cannot convert an object of type Bool to an object of type String
Closest candidates are:
convert(::Type{String}, !Matched::LLVM.MetadataAsValue) at /Users/prashantmudgal/.julia/packages/LLVM/5PewI/src/core/metadata.jl:19
convert(::Type{String}, !Matched::LLVM.DataLayout) at /Users/prashantmudgal/.julia/packages/LLVM/5PewI/src/datalayout.jl:27
convert(::Type{String}, !Matched::LLVM.Module) at /Users/prashantmudgal/.julia/packages/LLVM/5PewI/src/ir.jl:23
...
push!(::Array{String,1}, ::Bool) at array.jl:913
Parsers.Options(::Missing, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::Nothing, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at Parsers.jl:99
Parsers.Options(::Missing, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::UInt8, ::Nothing, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at Parsers.jl:62
file(::String, ::Int64, ::Bool, ::Int64, ::Nothing, ::Int64, ::Int64, ::Bool, ::Nothing, ::Bool, ::Bool, ::Array{String,1}, ::String, ::Nothing, ::Bool, ::Char, ::Nothing, ::Nothing, ::Char, ::Nothing, ::UInt8, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Dict{Int8,Int8}, ::Bool, ::Float64, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing) at CSV.jl:381
CSV.File(::String; header::Int64, normalizenames::Bool, datarow::Int64, skipto::Nothing, footerskip::Int64, limit::Int64, transpose::Bool, comment::Nothing, use_mmap::Bool, ignoreemptylines::Bool, missingstrings::Array{String,1}, missingstring::String, delim::Nothing, ignorerepeated::Bool, quotechar::Char, openquotechar::Nothing, closequotechar::Nothing, escapechar::Char, dateformat::Nothing, decimal::UInt8, truestrings::Nothing, falsestrings::Nothing, type::Nothing, types::Nothing, typemap::Dict{Int8,Int8}, categorical::Bool, pool::Float64, strict::Bool, silencewarnings::Bool, threaded::Nothing, debug::Bool, parsingdebug::Bool, allowmissing::Nothing) at CSV.jl:260
CSV.File(::String) at CSV.jl:260
top-level scope at julia.jl:30

@mb4941
Copy link

mb4941 commented Sep 26, 2022

Same problem. No one seems to know the solution.

@StefanKarpinski
Copy link
Member

No one has provided a reproducible example here, which makes this issue non-actionable. It's highly unlikely that all of these convert problems are the same issue, and these are much more likely to be library issues than language issues. Accordingly, I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants