[maker-devel] Use of each() on hash

Carson Holt carsonhh at gmail.com
Sat Apr 26 22:51:30 MDT 2014


If you don't want to wait for the fork.pm maintainer to alter his code and
submit an update to CPAN, you should be able to suppress the warning by
manually editing forks.pm line 1736 yourself.

Change it from this -->
$write = each %WRITE;

To this (make sure to include the {} brackets)-->
{
     no warnings qw(internal);
     $write = each %WRITE;
}


The issue is because the modules author has his code calling 'each',
altering the hash, and then calling 'each' again which causes a warning in
perl 5.18+.  In this case it's relatively innocuous because of how the value
and 'each' function are being used (any hash reordering ends up being
handled in an outer while loop).

Thanks,
Carson


From:  Carson Holt <carsonhh at gmail.com>
Date:  Saturday, April 26, 2014 at 10:06 PM
To:  "Fields, Christopher J" <cjfields at illinois.edu>
Cc:  Matthew MacManes <matthew.macmanes at unh.edu>,
"maker-devel at yandell-lab.org" <maker-devel at yandell-lab.org>
Subject:  Re: [maker-devel] Use of each() on hash

Yah, I had already seen that ticket.  It's related to changing the function
from a while loop to a foreach loop just to suppress the warning.  Not sure
why the forks.pm maintainer hasn't looked at it, but I imagine he will
probably just do something more like --> no warnings qw(each); or whatever
would suppress that warning without altering anything else in the code.

I wouldn't say 5.18 is a development release.  What  said is that it's not
good for 'production'.  The problem is that most system still use 5.10 and
5.12, with a very few only recently moving to 5.16 (amazon's EC2 images for
example).  So you will find that issues with even very popular CPAN modules
(as we see here) will be more common in something like 5.18.X.  Not because
5.18 is flawed, or buggy, but because it's not yet used enough to flush out
all the secondary issues it can cause elsewhere in wider world of perl.

Thanks,
Carson


From:  "Fields, Christopher J" <cjfields at illinois.edu>
Date:  Saturday, April 26, 2014 at 9:34 PM
To:  Carson Holt <carsonhh at gmail.com>
Cc:  Matthew MacManes <matthew.macmanes at unh.edu>,
"maker-devel at yandell-lab.org" <maker-devel at yandell-lab.org>
Subject:  Re: [maker-devel] Use of each() on hash

See this RT ticket:

    https://rt.cpan.org/Public/Bug/Display.html?id=86910

The specific warning in question is there for a good reason, Reini Urban
wrote about it recently and why it is bad:

    http://blogs.perl.org/users/rurban/2014/04/do-not-use-each.html

There is a possible 2-line fix, mainly changing a while loop to a for loop,
but the bug (originally reported in summer 2013) is still unfortunately
open.

Just a note, I don’t agree that perl 5.18.2 is a development release.  Even
numbered minor releases (5.10, 5.12…) are considered stable/production, odd
numbered ones (5.19) are developer.  I do agree that initial .0 ‘patch’
releases (e.g. 5.18.0) are generally to be avoided, but I always try to use
a more recent version of perl when possible.  This version is two releases
past the .0, and perl 5.20 (next stable) is due next month.

chris

On Apr 26, 2014, at 10:26 AM, Carson Holt <carsonhh at gmail.com> wrote:

> The message appears to be coming from forks.pm.  Probably a warning added to
> perl 5.18.2 which is really really new (other versions don't care about this),
> and most developers would not consider 5.18 a fully stable release for
> production purposes (it will have lots of test features and messages that will
> get improved or dropped rather quickly).  You can try updating the forks
> module from CPAN.  Otherwise I would ignore it, as forks is sufficiently
> tested to know it works (it's not a MAKER module, it a widely used CPAN module
> - literally tens of thousands of scripts use it worldwide).  The authors of
> forks.pm will take steps to silence the warning rather quickly, or the warning
> will be removed from the perl interpreter altogether.
> 
> Thanks,
> Carson
> 
> Sent from my iPhone
> 
> On Apr 26, 2014, at 8:56 AM, Matthew MacManes <matthew.macmanes at unh.edu>
> wrote:
> 
>> Hello, 
>> 
>> I am getting a large number of errors, while running maker on my ubuntu
>> server.
>> 
>> Use of each() on hash after insertion without resetting hash iterator results
>> in undefined behavior, Perl interpreter: 0x2045200 at
>> /usr/local/lib/perl/5.18.2/forks.pm <http://forks.pm/>  line 1736.
>> Use of each() on hash after insertion without resetting hash iterator results
>> in undefined behavior, Perl interpreter: 0x837200 at
>> /usr/local/lib/perl/5.18.2/forks.pm <http://forks.pm/>  line 1736.
>> Use of each() on hash after insertion without resetting hash iterator results
>> in undefined behavior, Perl interpreter: 0x9d1200 at
>> /usr/local/lib/perl/5.18.2/forks.pm <http://forks.pm/>  line 1736.
>> 
>> It is unclear how this effects the results or performance of the software,
>> but these errors are repeated thousands of times in even a small run.
>> 
>> For the record, Maker 2.31, Ubuntu 14.04, perl 5.18.2, MPI via OpenMPI
>> 
>> Compiled perl modules using ./build
>> 
>> Thanks for any insight anyone may have.
>> 
>> __________________________________
>> Matthew MacManes, Ph.D.
>> University of New Hampshire  I  Assistant Professor
>> Department of Molecular, Cellular, & Biomedical Sciences
>> Durham, NH  03824
>> Phone: 603-862-4052  I  Twitter: @PeroMHC <https://twitter.com/PeroMHC>
>> Web: genomebio.org <http://genomebio.org/>
>> Office: 189 Rudman Hall I Lab: 145 Rudman Hall
>> _______________________________________________
>> maker-devel mailing list
>> maker-devel at box290.bluehost.com
>> http://box290.bluehost.com/mailman/listinfo/maker-devel_yandell-lab.org
> _______________________________________________
> maker-devel mailing list
> maker-devel at box290.bluehost.com
> http://box290.bluehost.com/mailman/listinfo/maker-devel_yandell-lab.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://yandell-lab.org/pipermail/maker-devel_yandell-lab.org/attachments/20140426/668525f2/attachment-0003.html>


More information about the maker-devel mailing list