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

Some issue exposed by JSON::RPC #2684

Open
AlexDaniel opened this issue Feb 8, 2019 · 5 comments
Open

Some issue exposed by JSON::RPC #2684

AlexDaniel opened this issue Feb 8, 2019 · 5 comments
Labels
ecosystem modules regression Issue did not exist previously tests needed Issue is generally resolved but tests were not written yet

Comments

@AlexDaniel
Copy link
Contributor

See Raku/ecosystem-unbitrot#440.

JSON::RPC – Fail, Bisected: 8ef7c15

It is interesting:

getlex: outer index out of range
@AlexDaniel AlexDaniel added regression Issue did not exist previously BLOCKER Preventing the next release of rakudo, or just needing attention before the release labels Feb 8, 2019
@AlexDaniel
Copy link
Contributor Author

Ah, obligatory ping, of course. @jnthn

@MasterDuke17
Copy link
Contributor

dan@hermes:~/p6/modules/perl6-all-modules/github/bbkr/jsonrpc$ pg6 -I ../../.././github/labster/p6-file-directory-tree/lib -I ../../../github/perlpilot/p6-File-Temp/lib -I ../../.././github/sergot/datetime-parse/lib -I ../../.././github/perl6/Perl6-MIME-Base64/lib -I ../../.././github/supernovus/perl6-http-status/lib -I ../../.././github/sergot/perl6-encode/lib -I ../../.././github/sergot/http-useragent/lib -I ../../.././github/perl6-community-modules/uri/lib -I lib/ -I ../../.././cpan/MORITZ/JSON-Tiny/lib t/00-client.t 
================================================================================================
This is Rakudo Perl 6 running in the GNU debugger, which often allows the user to generate useful back-
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code.

This Rakudo version is 2018.12.293.gd.904.b.7048 built on MoarVM version 2018.12.100.gf.818.bd.6.d.5,
running on ubuntu (18.10.Cosmic.Cuttlefish) / linux (4.18.0.13.generic)

Type `bt full` to generate a backtrace if applicable, type `q` to quit or `help` for help.
------------------------------------------------------------------------------------------------
Reading symbols from /home/dan/Source/perl6/install/bin/moar...done.
Starting program: /home/dan/Source/perl6/install/bin/moar --execname=/home/dan/Source/perl6/install/bin/perl6-gdb-m --libpath=/home/dan/Source/perl6/install/share/nqp/lib --libpath=/home/dan/Source/perl6/install/share/perl6/lib --libpath=/home/dan/Source/perl6/install/share/perl6/runtime /home/dan/Source/perl6/install/share/perl6/runtime/perl6.moarvm -I ../../.././github/labster/p6-file-directory-tree/lib -I ../../../github/perlpilot/p6-File-Temp/lib -I ../../.././github/sergot/datetime-parse/lib -I ../../.././github/perl6/Perl6-MIME-Base64/lib -I ../../.././github/supernovus/perl6-http-status/lib -I ../../.././github/sergot/perl6-encode/lib -I ../../.././github/sergot/http-useragent/lib -I ../../.././github/perl6-community-modules/uri/lib -I lib/ -I ../../.././cpan/MORITZ/JSON-Tiny/lib t/00-client.t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff6f8e700 (LWP 11829)]
1..39
getlex: outer index out of range
  in block  at /home/dan/Source/perl6/modules/perl6-all-modules/github/bbkr/jsonrpc/lib/JSON/RPC/Client.pm6 (JSON::RPC::Client) line 27
  in block <unit> at t/00-client.t line 19

# Looks like you planned 39 tests, but ran 0
[Thread 0x7ffff6f8e700 (LWP 11829) exited]
[Inferior 1 (process 11803) exited with code 0377]
(gdb) b MVM_exception_throw_adhoc
Breakpoint 1 at 0x7ffff7980050: file src/core/exceptions.c, line 853.
(gdb) r
Starting program: /home/dan/Source/perl6/install/bin/moar --execname=/home/dan/Source/perl6/install/bin/perl6-gdb-m --libpath=/home/dan/Source/perl6/install/share/nqp/lib --libpath=/home/dan/Source/perl6/install/share/perl6/lib --libpath=/home/dan/Source/perl6/install/share/perl6/runtime /home/dan/Source/perl6/install/share/perl6/runtime/perl6.moarvm -I ../../.././github/labster/p6-file-directory-tree/lib -I ../../../github/perlpilot/p6-File-Temp/lib -I ../../.././github/sergot/datetime-parse/lib -I ../../.././github/perl6/Perl6-MIME-Base64/lib -I ../../.././github/supernovus/perl6-http-status/lib -I ../../.././github/sergot/perl6-encode/lib -I ../../.././github/sergot/http-useragent/lib -I ../../.././github/perl6-community-modules/uri/lib -I lib/ -I ../../.././cpan/MORITZ/JSON-Tiny/lib t/00-client.t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff6f8e700 (LWP 11831)]
1..39

Thread 1 "moar" hit Breakpoint 1, MVM_exception_throw_adhoc (tc=0x55555555aca0, messageFormat=0x7ffff7ad4e70 "getlex: outer index out of range") at src/core/exceptions.c:853
853     MVM_NO_RETURN void MVM_exception_throw_adhoc(MVMThreadContext *tc, const char *messageFormat, ...) {
(gdb) bt
#0  MVM_exception_throw_adhoc (tc=0x55555555aca0, messageFormat=0x7ffff7ad4e70 "getlex: outer index out of range") at src/core/exceptions.c:853
#1  0x00007ffff7999089 in MVM_interp_run (tc=tc@entry=0x55555555aca0, initial_invoke=0x0, invoke_data=0x2) at src/core/interp.c:344
#2  0x00007ffff7a87625 in MVM_vm_run_file (instance=0x55555555a260, filename=<optimized out>) at src/moar.c:444
#3  0x0000555555555791 in main (argc=27, argv=0x7fffffffdb28) at src/main.c:302
(gdb) call MVM_dump_backtrace(tc)
   at /home/dan/Source/perl6/modules/perl6-all-modules/github/bbkr/jsonrpc/lib/JSON/RPC/Client.pm6 (JSON::RPC::Client):27  (/home/dan/Source/perl6/modules/perl6-all-modules/github/bbkr/jsonrpc/lib/.precomp/6A3EC39990E86A512B66DEB3A967710040D7B925/A3/A3D0BE29E94E4AAD3298D0F286A3D1FCF7F7DBF3:)
 from gen/moar/Metamodel.nqp:3359  (/home/dan/Source/perl6/install/share/nqp/lib/Perl6/Metamodel.moarvm:find_method_fallback)
 from gen/moar/Metamodel.nqp:1122  (/home/dan/Source/perl6/install/share/nqp/lib/Perl6/Metamodel.moarvm:find_method)
 from t/00-client.t:19  (<ephemeral file>:<unit>)
 from t/00-client.t:1  (<ephemeral file>:<unit-outer>)
 from gen/moar/stage2/NQPHLL.nqp:1684  (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:eval)
 from gen/moar/stage2/NQPHLL.nqp:1888  (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:evalfiles)
 from gen/moar/stage2/NQPHLL.nqp:1818  (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from src/Perl6/Compiler.nqp:38  (/home/dan/Source/perl6/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:1773  (/home/dan/Source/perl6/install/share/nqp/lib/NQPHLL.moarvm:command_line)
 from gen/moar/main.nqp:48  (/home/dan/Source/perl6/install/share/perl6/runtime/perl6.moarvm:MAIN)
 from gen/moar/main.nqp:1  (/home/dan/Source/perl6/install/share/perl6/runtime/perl6.moarvm:<mainline>)
 from <unknown>:1  (/home/dan/Source/perl6/install/share/perl6/runtime/perl6.moarvm:<main>)
 from <unknown>:1  (/home/dan/Source/perl6/install/share/perl6/runtime/perl6.moarvm:<entry>)
(gdb)

No change with jit or spesh disabled.

@jnthn
Copy link
Member

jnthn commented Feb 12, 2019

Sticking no precompilation; into the module does, however, fix it.

@jnthn
Copy link
Member

jnthn commented Feb 12, 2019

Golf: Module.pm6 with:

my $x;
BEGIN {
    $x = -> { "foo".subst(/o/, 'a', :g) }
}
$x();

And then:

$ ./perl6-m -I. -e 'use Module'
===SORRY!===
getlex: outer index out of range

jnthn added a commit to Raku/nqp that referenced this issue Feb 12, 2019
When we compile some code to run it at BEGIN time, and a closure is
taken and retained there, then it may have some connections to the
faked-up lexical environment it was compiled in. In such cases, force
lookups of lexicals to be late-bound, so that we do not get wrong
indexes. Fixes the issue exposed in
rakudo/rakudo#2684.
@jnthn
Copy link
Member

jnthn commented Feb 12, 2019

Tracked it down to a more general problem in the QAST compiler and fixed that; both the golfed example and the original module are happy now.

@jnthn jnthn added the tests needed Issue is generally resolved but tests were not written yet label Feb 12, 2019
@AlexDaniel AlexDaniel removed the BLOCKER Preventing the next release of rakudo, or just needing attention before the release label Feb 12, 2019
jnthn added a commit to Raku/nqp that referenced this issue Feb 15, 2019
The previous approach fixed the bug, but was a bit too sweeping, leading
to a large performance regression in some cases. With this fix (plus a
Rakudo commit), rakudo/rakudo#2684 is still
resolved, and the reported performance regression also eliminated.
jnthn added a commit that referenced this issue Feb 15, 2019
An earlier fix for #2684 was a bit too sweeping, and resulted in a
performance regression. This fix deals more precisely with the cases
known to be problematic. Includes a bump to NQP to get a QAST compiler
that uses the new annotation.
Kaiepi pushed a commit to Kaiepi/rakudo that referenced this issue Mar 7, 2019
An earlier fix for rakudo#2684 was a bit too sweeping, and resulted in a
performance regression. This fix deals more precisely with the cases
known to be problematic. Includes a bump to NQP to get a QAST compiler
that uses the new annotation.
Kaiepi pushed a commit to Kaiepi/rakudo that referenced this issue Mar 10, 2019
An earlier fix for rakudo#2684 was a bit too sweeping, and resulted in a
performance regression. This fix deals more precisely with the cases
known to be problematic. Includes a bump to NQP to get a QAST compiler
that uses the new annotation.
Altai-man added a commit to Altai-man/roast that referenced this issue May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ecosystem modules regression Issue did not exist previously tests needed Issue is generally resolved but tests were not written yet
Projects
None yet
Development

No branches or pull requests

4 participants