-
Notifications
You must be signed in to change notification settings - Fork 567
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
Off-by-one when truncating *shared* array by: $#ary -= $chop_this_many #14151
Comments
From andy@hmc.eduThis is a bug report for perl from andy@hmc.edu, Off-by-one when truncating *shared* array by: $#ary -= $chop_this_many What should happen: Shared array max index should drop to a new, lower value. What does happen: Actual new max index is *too large by one* (Too few elements chopped off) See additional notes and environment details after example code and example output below. $ ./perl-shared-array-truncate.pl Before truncation, shared array highest index is: 9 Shared array now contains: 0 | 1 | 2 | 3 | 4 | 5 $ cat perl-shared-array-truncate.pl use threads; ### First with an ordinary array printf "Before truncation, ordinary array highest index is: %s\n", $#ordinary_array; ### Then try it with a shared array printf "Before truncation, shared array highest index is: %s\n", $#shared_array; ----- environment and notes ----- $ uname -a $ /usr/bin/perl -v Notes: Although I am using the "threads" module in this example script, I am not spawning I am aware that for removing a small number of elements I can "pop" a few times however I am aware that splice is not allowed with shared arrays. This truncation does not appear cpansearch.perl.org/src/RJBS/perl-5.17.6/dist/threads-shared/t/av_simple.t uses this method to truncate an array. I am aware of Thread::Queue. I have also repeated this on these environments with same results: Linux xxxxxxxx 2.6.32-358.2.1.el6.centos.plus.x86_64 #1 SMP Wed Mar 13 02:09:07 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Linux andy2 3.11.0-26-generic #45-Ubuntu SMP Tue Jul 15 04:02:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Thank you very much. Andy Flags: Site configuration information for perl 5.18.2: Configured by Red Hat, Inc. at Tue Jan 7 14:45:19 UTC 2014. Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Locally applied patches: @INC for perl 5.18.2: Environment for perl 5.18.2: |
From @iabynOn Sat, Oct 11, 2014 at 03:34:23AM -0700, via RT wrote:
Thanks for the report. Now fixed in blead by the following two commits: commit 399547d threads::shared "$#shared = N" off-by-one error M dist/threads-shared/lib/threads/shared.pm commit 76eea78 threads: $#shared = N should destroy M dist/threads-shared/shared.xs -- |
The RT System itself - Status changed from 'new' to 'open' |
@iabyn - Status changed from 'open' to 'pending release' |
From @khwilliamsonThanks for submitting this ticket The issue should be resolved with the release today of Perl v5.22. If you find that the problem persists, feel free to reopen this ticket -- |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#122950 (status was 'resolved')
Searchable as RT122950$
The text was updated successfully, but these errors were encountered: