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

Using StreamReader with TranscodingStreams leads to random Segmentation faults #200

Open
nhz2 opened this issue Oct 10, 2024 · 0 comments
Open

Comments

@nhz2
Copy link
Member

nhz2 commented Oct 10, 2024

Discovered in felipenoris/XLSX.jl#273 (comment)

MWE:

using TranscodingStreams
using EzXML

undirected = """
<?xml version="1.0" encoding="UTF-8"?>
<graphml>
    <graph edgedefault="undirected">
        <node id="n0"/>
        <node id="n1"/>
        <edge source="n0" target="n1"/>
    </graph>
</graphml>
"""

reader = EzXML.StreamReader(NoopStream(IOBuffer(undirected)))

GC.gc()
GC.gc()
GC.gc()

while (item = iterate(reader)) != nothing
    @show reader.type, reader.name
end
Internal error: during type inference of
var"#17"(0x00007f7c7649b4f0, Ptr{UInt8}, Int32)
Encountered unexpected error in runtime:
MethodError(f=Core.Compiler.widenconst, args=(0x00007f7c7649b4f0,), world=0x0000000000001734)
jl_method_error_bare at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:2254
jl_method_error at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:2272
jl_lookup_generic_ at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:3106 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:3121
#408 at ./compiler/typeutils.jl:57
anymap at ./compiler/utilities.jl:43 [inlined]
argtypes_to_type at ./compiler/typeutils.jl:57
abstract_call_known at ./compiler/abstractinterpretation.jl:2199
abstract_call at ./compiler/abstractinterpretation.jl:2282
abstract_call at ./compiler/abstractinterpretation.jl:2275
abstract_call at ./compiler/abstractinterpretation.jl:2420
abstract_eval_call at ./compiler/abstractinterpretation.jl:2435
abstract_eval_statement_expr at ./compiler/abstractinterpretation.jl:2451
abstract_eval_statement at ./compiler/abstractinterpretation.jl:2749
abstract_eval_basic_statement at ./compiler/abstractinterpretation.jl:3065
typeinf_local at ./compiler/abstractinterpretation.jl:3319
typeinf_nocycle at ./compiler/abstractinterpretation.jl:3401
_typeinf at ./compiler/typeinfer.jl:244
typeinf at ./compiler/typeinfer.jl:215
typeinf_ext at ./compiler/typeinfer.jl:1101
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1139
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1135
jfptr_typeinf_ext_toplevel_39604.1 at /home/nathan/.julia/juliaup/julia-1.11.0+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/builder-amdci5-1/julialang/julia-master/src/julia.h:2157 [inlined]
jl_type_infer at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:390
jl_generate_fptr_impl at /cache/build/builder-amdci5-1/julialang/julia-master/src/jitlayers.cpp:511
jl_compile_method_internal at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:2536 [inlined]
jl_compile_method_internal at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:2423
_jl_invoke at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:2940 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:3125
unknown function (ip: 0x7f7c6fc95b5f)
xmlParserInputBufferGrow at /workspace/srcdir/libxml2-2.13.3/xmlIO.c:2362
xmlTextReaderPushData at /workspace/srcdir/libxml2-2.13.3/xmlreader.c:790
xmlTextReaderRead at /workspace/srcdir/libxml2-2.13.3/xmlreader.c:1219
macro expansion at /home/nathan/.julia/packages/EzXML/DL8na/src/error.jl:50 [inlined]
read_node at /home/nathan/.julia/packages/EzXML/DL8na/src/streamreader.jl:199 [inlined]
iterate at /home/nathan/.julia/packages/EzXML/DL8na/src/streamreader.jl:190 [inlined]
iterate at /home/nathan/.julia/packages/EzXML/DL8na/src/streamreader.jl:190
unknown function (ip: 0x7f7c6fca6b03)
top-level scope at /home/nathan/Documents/breakezxml/stuff.jl:21
jl_toplevel_eval_flex at /cache/build/builder-amdci5-1/julialang/julia-master/src/toplevel.c:934
jl_toplevel_eval_flex at /cache/build/builder-amdci5-1/julialang/julia-master/src/toplevel.c:886
ijl_toplevel_eval_in at /cache/build/builder-amdci5-1/julialang/julia-master/src/toplevel.c:994
eval at ./boot.jl:430 [inlined]
include_string at ./loading.jl:2628
_include at ./loading.jl:2688
include at ./Base.jl:557
jfptr_include_46600.1 at /home/nathan/.julia/juliaup/julia-1.11.0+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
exec_options at ./client.jl:323
_start at ./client.jl:531
jfptr__start_72051.1 at /home/nathan/.julia/juliaup/julia-1.11.0+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/builder-amdci5-1/julialang/julia-master/src/julia.h:2157 [inlined]
true_main at /cache/build/builder-amdci5-1/julialang/julia-master/src/jlapi.c:900
jl_repl_entrypoint at /cache/build/builder-amdci5-1/julialang/julia-master/src/jlapi.c:1059
main at /cache/build/builder-amdci5-1/julialang/julia-master/cli/loader_exe.c:58
unknown function (ip: 0x7f7c8706cd8f)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)

[1905095] signal 11 (1): Segmentation fault
in expression starting at /home/nathan/Documents/breakezxml/stuff.jl:21
jl_is_layout_opaque at /cache/build/builder-amdci5-1/julialang/julia-master/src/julia.h:1330 [inlined]
jl_datatype_layout at /cache/build/builder-amdci5-1/julialang/julia-master/src/julia.h:1338 [inlined]
jl_f_tuple at /cache/build/builder-amdci5-1/julialang/julia-master/src/builtins.c:936 [inlined]
jl_f_tuple at /cache/build/builder-amdci5-1/julialang/julia-master/src/builtins.c:926
jl_method_error at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:2270
jl_lookup_generic_ at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:3106 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-1/julialang/julia-master/src/gf.c:3121
#17 at /home/nathan/.julia/packages/EzXML/DL8na/src/document.jl:262
unknown function (ip: 0x7f7c6fc95b5f)
xmlParserInputBufferGrow at /workspace/srcdir/libxml2-2.13.3/xmlIO.c:2362
xmlTextReaderPushData at /workspace/srcdir/libxml2-2.13.3/xmlreader.c:790
xmlTextReaderRead at /workspace/srcdir/libxml2-2.13.3/xmlreader.c:1219
macro expansion at /home/nathan/.julia/packages/EzXML/DL8na/src/error.jl:50 [inlined]
read_node at /home/nathan/.julia/packages/EzXML/DL8na/src/streamreader.jl:199 [inlined]
iterate at /home/nathan/.julia/packages/EzXML/DL8na/src/streamreader.jl:190 [inlined]
iterate at /home/nathan/.julia/packages/EzXML/DL8na/src/streamreader.jl:190
unknown function (ip: 0x7f7c6fca6b03)
top-level scope at /home/nathan/Documents/breakezxml/stuff.jl:21
jl_toplevel_eval_flex at /cache/build/builder-amdci5-1/julialang/julia-master/src/toplevel.c:934
jl_toplevel_eval_flex at /cache/build/builder-amdci5-1/julialang/julia-master/src/toplevel.c:886
ijl_toplevel_eval_in at /cache/build/builder-amdci5-1/julialang/julia-master/src/toplevel.c:994
eval at ./boot.jl:430 [inlined]
include_string at ./loading.jl:2628
_include at ./loading.jl:2688
include at ./Base.jl:557
jfptr_include_46600.1 at /home/nathan/.julia/juliaup/julia-1.11.0+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
exec_options at ./client.jl:323
_start at ./client.jl:531
jfptr__start_72051.1 at /home/nathan/.julia/juliaup/julia-1.11.0+0.x64.linux.gnu/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/builder-amdci5-1/julialang/julia-master/src/julia.h:2157 [inlined]
true_main at /cache/build/builder-amdci5-1/julialang/julia-master/src/jlapi.c:900
jl_repl_entrypoint at /cache/build/builder-amdci5-1/julialang/julia-master/src/jlapi.c:1059
main at /cache/build/builder-amdci5-1/julialang/julia-master/cli/loader_exe.c:58
unknown function (ip: 0x7f7c8706cd8f)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)
Allocations: 1384212 (Pool: 1384164; Big: 48); GC: 5
Segmentation fault (core dumped)
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

1 participant