After more careful checking, I found the bug fix did make it into the October release. A bisect showed it was fixed it in commit 6af44f8d38a02bbd0d68cfd014165d6e33e4d89a. So, in the prior commit, the --version 2017.09-490-g3f595acfb built on MoarVM version 2017.10, and the exception (with --ll-exception) is:
Got exception: Cannot assign to an immutable value in method slurp at SETTING::src/core/IO/Handle.pm line 735 in method slurp at SETTING::src/core/IO/Path.pm line 609 in block at ./concurrency-test.p6 line 40 in block at SETTING::src/core/Promise.pm line 241 in block at SETTING::src/core/ThreadPoolScheduler.pm line 659 in block at SETTING::src/core/ThreadPoolScheduler.pm line 224 in method run-one at SETTING::src/core/ThreadPoolScheduler.pm line 224 in method dispatch:<!> at SETTING::src/core/Mu.pm line 806 in block at SETTING::src/core/ThreadPoolScheduler.pm line 258 Died at SETTING::src/core/Exception.pm:57 (D:\cygwin64\home\p6\rakudo\install\share/perl6/runtime/CORE.setting.moarvm:throw) from SETTING::src/core/control.pm:170 (D:\cygwin64\home\p6\rakudo\install\share/perl6/runtime/CORE.setting.moarvm:die) from SETTING::src/core/control.pm:166 (D:\cygwin64\home\p6\rakudo\install\share/perl6/runtime/CORE.setting.moarvm:die) from ./concurrency-test.p6:54 (<ephemeral file>:MAIN) from SETTING::src/core/Main.pm:198 (D:\cygwin64\home\p6\rakudo\install\share/perl6/runtime/CORE.setting.moarvm:MAIN_HELPER) from ./concurrency-test.p6:33 (<ephemeral file>:<unit>) from ./concurrency-test.p6:1 (<ephemeral file>:<unit-outer>) from gen\moar\stage2\NQPHLL.nqp:1542 (D:\cygwin64\home\p6\rakudo\install\share\nqp\lib/NQPHLL.moarvm:eval) from gen\moar\stage2\NQPHLL.nqp:1779 (D:\cygwin64\home\p6\rakudo\install\share\nqp\lib/NQPHLL.moarvm:evalfiles) from gen\moar\stage2\NQPHLL.nqp:1704 (D:\cygwin64\home\p6\rakudo\install\share\nqp\lib/NQPHLL.moarvm:command_eval) from src/Perl6/Compiler.nqp:42 (D:\cygwin64\home\p6\rakudo\install\share\nqp\lib/Perl6/Compiler.moarvm:command_eval) from gen\moar\stage2\NQPHLL.nqp:1630 (D:\cygwin64\home\p6\rakudo\install\share\nqp\lib/NQPHLL.moarvm:command_line) from gen/moar/main.nqp:47 (D:\cygwin64\home\p6\rakudo\install\share\perl6\runtime\perl6.moarvm:MAIN) from gen/moar/main.nqp:38 (D:\cygwin64\home\p6\rakudo\install\share\perl6\runtime\perl6.moarvm:<mainline>) from <unknown>:1 (D:\cygwin64\home\p6\rakudo\install\share\perl6\runtime\perl6.moarvm:<main>) from <unknown>:1 (D:\cygwin64\home\p6\rakudo\install\share\perl6\runtime\perl6.moarvm:<entry>) I found I can reproduce the error within 1-4 iterations when running the script on the Rakudo tree (built with --gen-moar and --gen-nqp and installed without a prefix to ./install/). Slurping on the file handle you described still produces the exception: open($file-path).slurp: :close; but slurping from a filehandle without :close, followed by $fh.close, is fine. On Thu, Nov 16, 2017 at 7:58 AM Aleks-Daniel Jakimenko-Aleksejev via RT < perl6-bugs-follo...@perl.org> wrote: > Marked as 「testneeded」 to make sure we have tests for it. > > If there are tests already, then it should be linked and the ticket can be > closed. > > On 2017-11-15 14:43:51, d...@zwell.net wrote: > > It seems this has already been resolved on the master branch. After > > making > > a new build, I cannot reproduce the problem. Can you close the bug > > report? > > Thanks! > > > > On Wed, Nov 15, 2017 at 2:59 AM perl6 via RT <perl6-bugs- > > follo...@perl.org> > > wrote: > > > > > Greetings, > > > > > > This message has been automatically generated in response to the > > > creation of a trouble ticket regarding: > > > "IO.slurp throws exception when run in threads", > > > a summary of which appears below. > > > > > > There is no need to reply to this message right now. Your ticket has > > > been > > > assigned an ID of [perl #132447]. > > > > > > Please include the string: > > > > > > [perl #132447] > > > > > > in the subject line of all future correspondence about this issue. To > > > do > > > so, > > > you may reply to this message. > > > > > > Thank you, > > > perl6-bugs-follo...@perl.org > > > > > > > ------------------------------------------------------------------------- > > > The exception is: > > > Cannot assign to an immutable value in method slurp at > > > SETTING::src/core/IO/Handle.pm line 698 > > > in method slurp at SETTING::src/core/IO/Path.pm line 603 > > > in block at ./concurrency-test.p6 line 40 > > > in block at SETTING::src/core/Promise.pm line 217 > > > in block at SETTING::src/core/ThreadPoolScheduler.pm line 284 > > > in block at SETTING::src/core/ThreadPoolScheduler.pm line 173 > > > in block at SETTING::src/core/ThreadPoolScheduler.pm line 166 > > > in block at SETTING::src/core/ThreadPoolScheduler.pm line 163 > > > > > > I've observed this error on both Linux and Windows 10, on the > > > September and > > > October Rakudo releases. It's intermittent, so I use a shell loop to > > > run my > > > test case repeatedly until the problem occurs: > > > > > > while perl6 ./concurrency-test.p6 $DIR; do :; done > > > (where $DIR is any directory that contains several thousand files.) > > > > > > This problem only occurs with slurp. When I instead open a file > > > handle, > > > read its full contents with `.lines.cache`, then close the handle, > > > there is > > > no exception. > > > > > > The test case I used to show this issue is uploaded here: > > > https://gist.github.com/lefth/6d71ca714ca2dc184220a91ceb41334d > > > > > > > >