Skip to content

Instantly share code, notes, and snippets.

@vrurg
Created January 28, 2024 15:15
Show Gist options
  • Save vrurg/37e9b23a29d225ab43c9db034d79b8d1 to your computer and use it in GitHub Desktop.
Save vrurg/37e9b23a29d225ab43c9db034d79b8d1 to your computer and use it in GitHub Desktop.
Operation 'bind_key' cannot obtain write lock for VMHash; error code=-16
at NQP::src/HLL/Compiler.nqp:754 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/NQPHLL.moarvm:linefileof)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:1479 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:compile_annotation)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:1439 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:compile_node)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:696 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:as_mast)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:1518 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:compile_all_the_stmts
)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:1081 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:1059 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:1006 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:compile_node)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:700 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:as_mast)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:845 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:compile_node)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:700 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:as_mast)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:420 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:to_mast)
from NQP::src/vm/moar/QAST/QASTCompilerMAST.nqp:2217 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/QAST.moarvm:to_mast)
from NQP::src/vm/moar/HLL/Backend.nqp:790 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/NQPHLL.moarvm:mast)
from NQP::src/HLL/Compiler.nqp:462 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/NQPHLL.moarvm:execute_stage)
from NQP::src/HLL/Compiler.nqp:501 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/NQPHLL.moarvm:run)
from NQP::src/HLL/Compiler.nqp:504 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/NQPHLL.moarvm:)
from NQP::src/HLL/Compiler.nqp:496 (/home/vrurg/src/Raku/rakudo/install/share/nqp/lib/NQPHLL.moarvm:compile)
from SETTING::src/core.c/ForeignCode.rakumod:105 (/home/vrurg/src/Raku/rakudo/install/share/perl6/runtime/CORE.c.setting.moarvm:)
from SETTING::src/core.c/ForeignCode.rakumod:61 (/home/vrurg/src/Raku/rakudo/install/share/perl6/runtime/CORE.c.setting.moarvm:EVAL)
from SETTING::src/core.c/CompUnit/PrecompilationDependency/File.rakumod:37 (/home/vrurg/src/Raku/rakudo/install/share/perl6/runtime/CORE.
c.setting.moarvm:)
from SETTING::src/core.c/CompUnit/PrecompilationDependency/File.rakumod:25 (/home/vrurg/src/Raku/rakudo/install/share/perl6/runtime/CORE.
c.setting.moarvm:spec)
from SETTING::src/core.c/CompUnit/PrecompilationRepository.rakumod:186 (/home/vrurg/src/Raku/rakudo/install/share/perl6/runtime/CORE.c.se
tting.moarvm:)
from SETTING::src/core.c/CompUnit/PrecompilationRepository.rakumod:183 (/home/vrurg/src/Raku/rakudo/install/share/perl6/runtime/CORE.c.se
tting.moarvm:)
@vrurg
Copy link
Author

vrurg commented Jan 28, 2024

This is an outcome of an attempt to parallelize loading of modules with hash protection turned on. I don't have time to get deeper into this, but hope it helps.

@lizmat
Copy link

lizmat commented Jan 28, 2024

I can't see anything doing something with a hash there, except handling of named arguments.

Which would maybe imply that closure taking is not threadsafe ??

@vrurg
Copy link
Author

vrurg commented Jan 28, 2024

I can't tell without additional analysis. The involvement of nameds is nearly unquestionable.

Wether it's closures or something different is yet to be found out. But if you're right (and that's likely) then our problems here are worse than I'd like them to be. Otherwise it means that RakuAST is likely to be free of the problem as it doesn't use HLL::Compiler.

@lizmat
Copy link

lizmat commented Jan 28, 2024

RakuAST is likely to be free of the problem as it doesn't use HLL::Compiler.

Sadly, this is not true.

% rak HLL::Compiler src/Raku 
src/Raku/Grammar.nqp
421:HLL::Compiler.lineof($B.orig(), $B.from(), :cache(1))
584:line => HLL::Compiler.lineof($cursor.orig, $cursor.pos, :cache(1)),
644::line-real(HLL::Compiler.lineof(self.orig(), self.from(), :cache(1)))
2193:line   => HLL::Compiler.lineof($/.orig, $/.from, :cache(1))
2208:line   => HLL::Compiler.lineof($/.orig, $/.from, :cache(1))
2223:line   => HLL::Compiler.lineof($/.orig, $/.from, :cache(1))

src/Raku/ast/origins.rakumod
43:#      backend compilation code. It currently relies upon HLL::Compiler.linefileof() method which might be unreliable.

Having said that, we can probably get rid of it.

@vrurg
Copy link
Author

vrurg commented Jan 28, 2024

Oh, no! That's exactly why I have developed ast/origins.rakumod back then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment