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

.raku / Typecheck errors hanging on LibXML::Node objects #95

Open
dwarring opened this issue Feb 18, 2023 · 11 comments
Open

.raku / Typecheck errors hanging on LibXML::Node objects #95

dwarring opened this issue Feb 18, 2023 · 11 comments

Comments

@dwarring
Copy link
Contributor

The following is attempting to iterate a mix of LibXML::Text and LibXML::Element nodes as LibXML::Element. It hangs rather than producing a typecheck failure.

use LibXML::Document;
use LibXML::Element;

my LibXML::Document $doc .= parse: q:to<END>;
<root>
    Some text
    <anElem/>
    More text
</root>
END

for $doc.root.childNodes -> LibXML::Element $elem { .Str }

Observed in jnthn/spreadsheet-xlsx#12.

@dwarring
Copy link
Contributor Author

The underlying problem seems to be that Raku is calling the .raku method on the object, but this is hanging. This also failed to complete:

my LibXML::Document $doc .= parse: q:to<END>;
<root>
    Some text
    <anElem/>
    More text
</root>
END

for $doc.root.childNodes { .raku }

.raku is hanging on both LibXML::Element and LibXML::Text nodes.

dwarring added a commit that referenced this issue Feb 19, 2023
@dwarring dwarring changed the title Hang on type mismatch .raku / Typecheck erros hanging Feb 19, 2023
@dwarring
Copy link
Contributor Author

It's simply because raku is hanging when executed on the text node. Other nodes (e.g. elements) seem to also have this issue.

I've alias the LibXML::Node:D raku method to .Str.raku., as a work-around Further investigation needed.

@dwarring dwarring changed the title .raku / Typecheck erros hanging .raku / Typecheck erros hanging on LibXML::Node objects Feb 19, 2023
@dwarring
Copy link
Contributor Author

workaround installed with LibXML 0.9.10. .raku() method added that returns .Str.raku for LibXML::Node:D objects.

@vrurg
Copy link
Contributor

vrurg commented Feb 25, 2023

Yes! This is bugging for more than a year now! And I never had time to report it.

On occassion, .raku may also die with SEGV. I managed to pinpoint it to nqp::getattr over a native attribute and even remember nine making a guess that it is somehow related to either incorrect size of it or something like that.

@dwarring
Copy link
Contributor Author

Thanks,. I see now this is related to other open tickets both here and Rakudo which I have updated. Now that the issue is being worked around.

@jubilatious1
Copy link

I guess this is as good a place as any to report:

https://stackoverflow.com/q/75860114/7270649
https://stackoverflow.com/a/75872515/7270649

@dwarring
Copy link
Contributor Author

dwarring commented Mar 29, 2023

The OP took that example from the LibXML::Reader doco. But that doesn't actually work when the file can't be opened.

Changed the handling so that LibXML::Reader throws an exception immediately that the file can't be opened and fails to return an error. The 'or die...' syntax is now avoided. It's not used anywhere else in the Raku LibXML bindings, anyway.

Released with LibXML v0.10.1

@jubilatious1
Copy link

Okay, I'm seeing upgrade errors. Probably because I --force-test to install previously:

admin@mbp zef % /Users/admin/rakudo/Rakudo-2022.07/install/share/perl6/site/bin/zef upgrade LibXML --verbose   
===> Searching for: LibXML
===> Updating fez mirror: https://360.zef.pm/
===> Updated fez mirror: https://360.zef.pm/
===> Found: LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0> [via Zef::Repository::Ecosystems<fez>]
The following distributions will be upgraded: LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0>
===> Updating: LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0>
===> Fetching [OK]: https://360.zef.pm/L/IB/LIBXML/20876a1829ff8d518481a699a4ac1f9eabee2e2d.tar.gz to /var/folders/yt/l8245119545_9b4bhx09qssc0000gn/T//.zef/1680121206.8000.355.27622864561016/20876a1829ff8d518481a699a4ac1f9eabee2e2d.tar.gz
===> Extraction [OK]: https://360.zef.pm/L/IB/LIBXML/20876a1829ff8d518481a699a4ac1f9eabee2e2d.tar.gz to /var/folders/yt/l8245119545_9b4bhx09qssc0000gn/T//.zef/20876a1829ff8d518481a699a4ac1f9eabee2e2d.tar.gz
===> Building: LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0>
[LibXML] Command: /Users/admin/rakudo/rakudo-2022.07/install/bin/rakudo -e require '/var/folders/yt/l8245119545_9b4bhx09qssc0000gn/T/.zef/20876a1829ff8d518481a699a4ac1f9eabee2e2d.tar.gz/LibXML-0.10.1/Build.pm6'; ::('Build').new.build('/var/folders/yt/l8245119545_9b4bhx09qssc0000gn/T/.zef/20876a1829ff8d518481a699a4ac1f9eabee2e2d.tar.gz/LibXML-0.10.1') ?? exit(0) !! exit(1);
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/dom.o src/dom.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/domXPath.o src/domXPath.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_parser_ctx.o src/xml6_parser_ctx.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_config.o src/xml6_config.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_doc.o src/xml6_doc.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_entity.o src/xml6_entity.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_gbl.o src/xml6_gbl.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_hash.o src/xml6_hash.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_input.o src/xml6_input.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_node.o src/xml6_node.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_notation.o src/xml6_notation.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_ns.o src/xml6_ns.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_sax.o src/xml6_sax.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_ref.o src/xml6_ref.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_reader.o src/xml6_reader.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_xpath.o src/xml6_xpath.c -I/opt/local/include/libxml2 
[LibXML] clang -I src -c  -fno-omit-frame-pointer -fno-optimize-sibling-calls -Werror=vla -O3  -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1  -DMVM_HEAPSNAPSHOT_FORMAT=2 -D_GNU_SOURCE -o src/xml6_error.o src/xml6_error.c -I/opt/local/include/libxml2 
[LibXML] clang -dynamiclib  -O3  -Wl,-rpath,"//Users/admin/rakudo/rakudo-2022.07/install/lib" -o resources/libraries/libxml6.dylib \
[LibXML]         src/dom.o  src/domXPath.o src/xml6_parser_ctx.o src/xml6_config.o src/xml6_doc.o src/xml6_entity.o src/xml6_gbl.o src/xml6_hash.o src/xml6_input.o src/xml6_node.o  src/xml6_notation.o src/xml6_ns.o src/xml6_sax.o src/xml6_ref.o  src/xml6_reader.o src/xml6_xpath.o  src/xml6_error.o \
[LibXML]         -L/opt/local/lib -lxml2 -L/opt/local/lib -lz -L/opt/local/lib -llzma -lpthread -liconv -L/opt/local/lib -licui18n -licuuc -licudata 
[LibXML] make: Nothing to be done for `all'.
===> Building [OK] for LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0>
===> Testing: LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0>
[LibXML] t/000sanity.t ................... ok
[LibXML] t/00ast.t ....................... ok
[LibXML] t/00config.t .................... ok
[LibXML] t/00dict.t ...................... ok
[LibXML] t/00dom-w3c.t ................... ok
[LibXML] t/00dom.t ....................... ok
[LibXML] t/00dtd-decls.t ................. ok
[LibXML] t/00dtd.t ....................... ok
[LibXML] t/00errors.t .................... ok
[LibXML] t/00hash-object.t ............... ok
[LibXML] t/00hash-type.t ................. ok
[LibXML] t/00input-callback.t ............ ok
[LibXML] t/00native.t .................... ok
[LibXML] t/00query-selectors.t ........... ok
[LibXML] t/00sax-coverage.t .............. ok
[LibXML] t/00sax.t ....................... ok
[LibXML] t/00subclass.t .................. ok
[LibXML] t/00threads.t ................... ok
[LibXML] t/00with-cache.t ................ ok
[LibXML] t/00xpath-object.t .............. ok
[LibXML] t/01basic.t ..................... ok
[LibXML] t/02parse.t ..................... All 20 subtests passed 
[LibXML] t/03doc.t ....................... All 9 subtests passed 
[LibXML] t/04node.t ...................... Dubious, test returned 1
[LibXML] Failed 1/11 subtests 
[LibXML] t/05text.t ...................... ok
[LibXML] t/06elements.t .................. ok
[LibXML] t/07dtd.t ....................... ok
[LibXML] t/08findnodes.t ................. Dubious, test returned 1
[LibXML] Failed 1/14 subtests 
[LibXML] t/09xpath.t ..................... All 10 subtests passed 
[LibXML] t/10ns.t ........................ ok
[LibXML] t/12html.t ...................... All 10 subtests passed 
[LibXML] t/13dtd.t ....................... ok
[LibXML] t/14sax.t ....................... All 34 subtests passed 
[LibXML] t/15nodelist.t .................. ok
[LibXML] t/16docnodes.t .................. ok
[LibXML] t/17callbacks.t ................. ok
[LibXML] t/18docfree.t ................... ok
[LibXML] t/19encoding.t .................. ok
[LibXML] t/20extras.t .................... ok
[LibXML] t/21catalog.t ................... ok
[LibXML] t/23rawfunctions.t .............. ok
[LibXML] t/24c14n.t ...................... All 12 subtests passed 
[LibXML] t/25relaxng.t ................... All 5 subtests passed 
[LibXML] t/26schema.t .................... Dubious, test returned 1
[LibXML] Failed 1/5 subtests 
[LibXML] t/27input_callbacks_simple.t .... ok
[LibXML] t/28input_callbacks_multiple.t .. ok
[LibXML] t/29id.t ........................ ok
[LibXML] t/30keep_blanks.t ............... Dubious, test returned 1
[LibXML] Failed 1/2 subtests 
[LibXML] t/30xpathcontext.t .............. Dubious, test returned 2
[LibXML] Failed 2/24 subtests 
[LibXML] t/31xpc_functions.t ............. ok
[LibXML] t/32xpc_variables.t ............. ok
[LibXML] t/35huge_mode.t ................. ok
[LibXML] t/40reader.t .................... ok
[LibXML] t/40reader_mem_error.t .......... ok
[LibXML] t/41xinclude.t .................. ok
[LibXML] t/42common.t .................... ok
[LibXML] t/43options.t ................... ok
[LibXML] t/44extent.t .................... Dubious, test returned 2
[LibXML] Failed 2/7 subtests 
[LibXML] t/45regex.t ..................... ok
[LibXML] t/46err_column.t ................ ok
[LibXML] t/47load_xml_callbacks.t ........ ok
[LibXML] t/48importing_nodes_IDs.t ....... ok
[LibXML] t/49global_extent.t ............. Dubious, test returned 1
[LibXML] Failed 1/1 subtests 
[LibXML] t/60error_prev_chain.t .......... ok
[LibXML] t/61error.t ..................... ok
[LibXML] t/90threads.t ................... All 26 subtests passed 
[LibXML] t/91unique_key.t ................ ok
[LibXML] t/99doc-examples.t .............. ok
[LibXML] t/issue#025.t ................... ok
[LibXML] t/issue#095.t ................... ok
[LibXML] 
[LibXML] Test Summary Report
[LibXML] -------------------
[LibXML] t/02parse.t  (Wstat: 10 Tests: 0 Failed: 0)
[LibXML] Non-zero wait status: 10
[LibXML]   Parse errors: Bad plan.  You planned 20 tests but ran 0.
[LibXML] t/03doc.t  (Wstat: 11 Tests: 6 Failed: 0)
[LibXML] Non-zero wait status: 11
[LibXML]   Parse errors: Bad plan.  You planned 9 tests but ran 6.
[LibXML] t/04node.t  (Wstat: 256 Tests: 11 Failed: 1)
[LibXML]   Failed tests:  11
[LibXML] Non-zero exit status: 1
[LibXML] t/08findnodes.t  (Wstat: 256 Tests: 14 Failed: 1)
[LibXML]   Failed tests:  6
[LibXML] Non-zero exit status: 1
[LibXML] t/09xpath.t  (Wstat: 11 Tests: 5 Failed: 0)
[LibXML] Non-zero wait status: 11
[LibXML]   Parse errors: Bad plan.  You planned 10 tests but ran 5.
[LibXML] t/12html.t  (Wstat: 10 Tests: 5 Failed: 0)
[LibXML] Non-zero wait status: 10
[LibXML]   Parse errors: Bad plan.  You planned 10 tests but ran 5.
[LibXML] t/14sax.t  (Wstat: 11 Tests: 0 Failed: 0)
[LibXML] Non-zero wait status: 11
[LibXML]   Parse errors: Bad plan.  You planned 34 tests but ran 0.
[LibXML] t/24c14n.t  (Wstat: 10 Tests: 7 Failed: 0)
[LibXML] Non-zero wait status: 10
[LibXML]   Parse errors: Bad plan.  You planned 12 tests but ran 7.
[LibXML] t/25relaxng.t  (Wstat: 10 Tests: 2 Failed: 0)
[LibXML] Non-zero wait status: 10
[LibXML]   Parse errors: Bad plan.  You planned 5 tests but ran 2.
[LibXML] t/26schema.t  (Wstat: 256 Tests: 5 Failed: 1)
[LibXML]   Failed tests:  5
[LibXML] Non-zero exit status: 1
[LibXML] t/30keep_blanks.t  (Wstat: 256 Tests: 2 Failed: 1)
[LibXML]   Failed tests:  2
[LibXML] Non-zero exit status: 1
[LibXML] t/30xpathcontext.t  (Wstat: 512 Tests: 24 Failed: 2)
[LibXML]   Failed tests:  6 7
[LibXML] Non-zero exit status: 2
[LibXML] t/44extent.t  (Wstat: 512 Tests: 7 Failed: 2)
[LibXML]   Failed tests:  1 2
[LibXML] Non-zero exit status: 2
[LibXML] t/49global_extent.t  (Wstat: 256 Tests: 1 Failed: 1)
[LibXML]   Failed tests:  1
[LibXML] Non-zero exit status: 1
[LibXML] t/90threads.t  (Wstat: 10 Tests: 17 Failed: 0)
[LibXML] Non-zero wait status: 10
[LibXML]   Parse errors: Bad plan.  You planned 26 tests but ran 17.
[LibXML] Files=70, Tests=661,  113 wallclock secs
[LibXML] Result: FAILED
===> Testing [FAIL]: LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0>
Aborting due to test failure: LibXML:ver<0.10.1>:auth<zef:dwarring>:api<0.10.0> (use --force-test to override)
!!!> Failed upgrading *all* modules
admin@mbp zef % 

@dwarring
Copy link
Contributor Author

@jubilatious1 is that #88 re MacOS El Capitan?

I had a look, but so far haven't found a suitable AWS instance, or anything useful from googling for Virtual Box VMs.

@jubilatious1
Copy link

Hi @dwarring different box, different (newer) MacOS.

Should I move the first comment to a new Issue?

#95 (comment)

Thx.

@dwarring
Copy link
Contributor Author

Hi @jubilatious1. Yes please, create a new issue.

@dwarring dwarring changed the title .raku / Typecheck erros hanging on LibXML::Node objects .raku / Typecheck errors hanging on LibXML::Node objects Aug 29, 2023
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

3 participants