I am running tests with a lot of threads. I've seen that when I push it to about 200 threads, it can get into trouble when the task of the thread is large enough. Now, looking at some system monitor(atop on linux), I can see that the user time of 3 or 4 processors(of 8) soared up to 100% but not finishing the tasks. In one of those sessions I even got got an error (reported bug #128172):

*** Error in `/home/marcel/Software/perl6/rakudo/install/bin/moar': double free or corruption (fasttop): 0x0000000005da0090 ***

or the test is finished in a abrupt way saying that there are 'no subtests run'. Or it can give other errors like;

Cannot invoke this object (REPR: Null; VMNull)
  in block  at t/100-rw.t line 118
  in block <unit> at t/100-rw.t line 118

It gives an indication that the program gets corrupted at some point which is of course not good but where it happens is not tracable for me. Not easy to golf this down e.g. less treads (50 or even a 100 with less work) always finish properly.

The question I have now is how to check in a program for resource info so that the program can behave like a nice computer citizen.


I've included the sources for anyone interested. The tests are commented out except for the 'readers and writers' test. Here the number of threads is 100 with 40 writers and 60 readers. This is to test the semaphore readers writers pattern. The module is not yet completed. It will be published in the ecosystem when ready.

This is Rakudo version 2016.06-178-gf7c6e60 built on MoarVM version 2016.06-9-g8fc21d5
implementing Perl 6.c.

Attachment: ReadersWriters.pm6
Description: application/pagemaker

Attachment: 100-rw.t
Description: Perl program

Reply via email to