Skip to content

Instantly share code, notes, and snippets.

@smls
Last active April 30, 2018 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smls/a0995099890639493886d042bb2d2a73 to your computer and use it in GitHub Desktop.
Save smls/a0995099890639493886d042bb2d2a73 to your computer and use it in GitHub Desktop.

Stack traces for Rakudo issue 1785

Explanation of symbols seen in the stack traces

This is a personal command-line app that uses web-scraping to find out if on specific web pages, a specific file download (forum attachment or similar) has been updated, and if so, automatically re-downloads it.

Different classes represent webpages of different types:

ModSync::Remote::DownloadPage::IPS
ModSync::Remote::DownloadPage::Custom
...

Each of them implements the releases and latest-release method, which return data about the attachment of interest, with the help of shared subroutines from local package ModSync::Remote::Net:

  • curl makes a HTTP request using the LibCurl::Easy module.
  • xpath-nodes and xpath-value are used to query the DOM of the downloaded web page (after parsing it). The DOM parsing and the XPath queries are both performed by the Perl 5 module XML::LibXML.
    I didn't use Inline::Perl5 for this, because it does not support precompilation. Instead, I hacked together a custom solution that spawns a perl process on demand as a Proc. The Perl 5 program executed by the perl process knows how to parse a DOM with XML::LibXML and perform method calls on it, and communicates with the main Perl 6 program by accepting commands on STDIN and writing serialized responses to STDOUT.
    This whole process is a bit hairy, and I wouldn't be surprised if its the source of the error.

current-download is just a subroutine in the main script that kicks off the process by calling latest-release on the object representing the web page that's currently being processed.

Failure mode on current Rakudo

When given many web pages to check in sequence, it usually processes the first few just fine, but at some point (not always the same point) crashes with "equal requires a concrete string, but got null".
The stack traces seem to always point to one of the subroutines curl, xpath-nodes, or xpath-value - usually to the very top of the subroutine, even if harmless debug statements are added to the top of it.

Rarely, it just segfaults instead of throwing an exception.

Back when I wrote this code, it worked just fine on the then-current Rakudo, so either it's a regression in Rakudo or I somehow relied on something that was not in fact a feature.

Stack-traces with --ll-exception

equal requires a concrete string, but got null
at /home/sam/dev/projects/modsync/lib/ModSync/Remote/Net.pm (ModSync::Remote::Net):107 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/EF/EF02C9CE390A668D3FF450E9B7569F73D386A236:xpath-nodes)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/IPS.pm (ModSync::Remote::DownloadPage::IPS):38 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/03/0347A5A4C65B19371D6AE14FB738CD39E1E77F05:releases)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/IPS.pm (ModSync::Remote::DownloadPage::IPS):87 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/03/0347A5A4C65B19371D6AE14FB738CD39E1E77F05:latest-release)
from modsync:116 (<ephemeral file>:current-download)
from modsync:105 (<ephemeral file>:)
from SETTING::src/core/Any-iterable-methods.pm6:405 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-all)
from SETTING::src/core/Iterator.pm6:69 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-until-lazy)
from SETTING::src/core/Array.pm6:284 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:STORE)
from modsync:69 (<ephemeral file>:)
from modsync:55 (<ephemeral file>:MAIN)
from modsync:21 (<ephemeral file>:MAIN)
from SETTING::src/core/Main.pm6:228 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:MAIN_HELPER)
from modsync:323 (<ephemeral file>:<unit>)
from modsync:1 (<ephemeral file>:<unit-outer>)
from gen/moar/stage2/NQPHLL.nqp:1585 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1822 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:1747 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:42 (/home/sam/dev/src/rakudo/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1673 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:47 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:MAIN)
from gen/moar/main.nqp:38 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<mainline>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<main>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<entry>)
equal requires a concrete string, but got null
at /home/sam/dev/projects/modsync/lib/ModSync/Remote/Net.pm (ModSync::Remote::Net):90 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/EF/EF02C9CE390A668D3FF450E9B7569F73D386A236:xpath-nodes)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/IPS.pm (ModSync::Remote::DownloadPage::IPS):38 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/03/0347A5A4C65B19371D6AE14FB738CD39E1E77F05:releases)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/IPS.pm (ModSync::Remote::DownloadPage::IPS):87 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/03/0347A5A4C65B19371D6AE14FB738CD39E1E77F05:latest-release)
from modsync:116 (<ephemeral file>:current-download)
from modsync:105 (<ephemeral file>:)
from SETTING::src/core/Any-iterable-methods.pm6:405 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-all)
from SETTING::src/core/Iterator.pm6:69 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-until-lazy)
from SETTING::src/core/Array.pm6:284 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:STORE)
from modsync:69 (<ephemeral file>:)
from modsync:55 (<ephemeral file>:MAIN)
from modsync:21 (<ephemeral file>:MAIN)
from SETTING::src/core/Main.pm6:228 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:MAIN_HELPER)
from modsync:323 (<ephemeral file>:<unit>)
from modsync:1 (<ephemeral file>:<unit-outer>)
from gen/moar/stage2/NQPHLL.nqp:1585 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1822 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:1747 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:42 (/home/sam/dev/src/rakudo/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1673 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:47 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:MAIN)
from gen/moar/main.nqp:38 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<mainline>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<main>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<entry>)
equal requires a concrete string, but got null
at /home/sam/dev/projects/modsync/lib/ModSync/Remote/Net.pm (ModSync::Remote::Net):32 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/EF/EF02C9CE390A668D3FF450E9B7569F73D386A236:curl)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/Forum.pm (ModSync::Remote::DownloadPage::Forum):31 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/95/957F5CF4CDCF59F02FCDF5A28A1D015B8D8BFD3D:releases)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/Forum.pm (ModSync::Remote::DownloadPage::Forum):59 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/95/957F5CF4CDCF59F02FCDF5A28A1D015B8D8BFD3D:latest-release)
from modsync:119 (<ephemeral file>:current-download)
from modsync:108 (<ephemeral file>:)
from SETTING::src/core/Any-iterable-methods.pm6:405 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-all)
from SETTING::src/core/Iterator.pm6:69 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-until-lazy)
from SETTING::src/core/Array.pm6:284 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:STORE)
from modsync:72 (<ephemeral file>:)
from modsync:55 (<ephemeral file>:MAIN)
from modsync:21 (<ephemeral file>:MAIN)
from SETTING::src/core/Main.pm6:228 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:MAIN_HELPER)
from modsync:326 (<ephemeral file>:<unit>)
from modsync:1 (<ephemeral file>:<unit-outer>)
from gen/moar/stage2/NQPHLL.nqp:1585 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1822 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:1747 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:42 (/home/sam/dev/src/rakudo/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1673 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:47 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:MAIN)
from gen/moar/main.nqp:38 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<mainline>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<main>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<entry>)
equal requires a concrete string, but got null
at /home/sam/dev/projects/modsync/lib/ModSync/Remote/Net.pm (ModSync::Remote::Net):116 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/EF/EF02C9CE390A668D3FF450E9B7569F73D386A236:xpath-value)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/Custom.pm (ModSync::Remote::DownloadPage::Custom):41 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/19/1935F8C47826CF3C1B213FF3452ACC456CF275BA:)
from /home/sam/dev/projects/modsync/lib/ModSync/Remote/DownloadPage/Custom.pm (ModSync::Remote::DownloadPage::Custom):37 (/home/sam/dev/projects/modsync/lib/.precomp/6F99429A297DC1D8C511E3EAE52DA70DC1697480/19/1935F8C47826CF3C1B213FF3452ACC456CF275BA:latest-release)
from modsync:119 (<ephemeral file>:current-download)
from modsync:108 (<ephemeral file>:)
from SETTING::src/core/Any-iterable-methods.pm6:405 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-all)
from SETTING::src/core/Iterator.pm6:69 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:push-until-lazy)
from SETTING::src/core/Array.pm6:284 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:STORE)
from modsync:72 (<ephemeral file>:)
from modsync:55 (<ephemeral file>:MAIN)
from modsync:21 (<ephemeral file>:MAIN)
from SETTING::src/core/Main.pm6:228 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/CORE.setting.moarvm:MAIN_HELPER)
from modsync:326 (<ephemeral file>:<unit>)
from modsync:1 (<ephemeral file>:<unit-outer>)
from gen/moar/stage2/NQPHLL.nqp:1585 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1822 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:1747 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:42 (/home/sam/dev/src/rakudo/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1673 (/home/sam/dev/src/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:47 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:MAIN)
from gen/moar/main.nqp:38 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<mainline>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<main>)
from <unknown>:1 (/home/sam/dev/src/rakudo/install/share/perl6/runtime/perl6.moarvm:<entry>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment