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
Problem using "local" with "threads::shared" #8207
Comments
From dean@cs.serenevy.netThis is a bug report for perl from dean@cs.serenevy.net, Localizing variables bound to shared variables can cause the shared 1..32 #### BEGIN test script: threads_and_local.t # Tests localization in threaded situations use strict; BEGIN { my $value :shared; my $test = 1; # You have to do it this way or VMS will get confused. printf "# Failed test at line %d\n", (caller)[2] unless $ok; sub test_it { test_it sub { local__($_[0]) }, 'direct passing (local $_)'; test_it sub { map local__($_), @_ }, 'map (local $_)'; test_it sub { for $g (@_) { local__($g) } }, 'for $g (local $_)'; test_it sub { for (@_) { $g = $_; local__($g) } }, 'for copy of $g (local $_)'; sub local__ { sub local_g { sub my_g { sub my_x { Flags: Site configuration information for perl v5.8.4: Configured by Debian Project at Tue Mar 8 20:31:23 EST 2005. Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Locally applied patches: @INC for perl v5.8.4: Environment for perl v5.8.4: |
From @smpeters
In bleadperl, I get a coredump at test 9 instead of a test failure #0 0x080e48f3 in Perl_mg_find (my_perl=0x81dd008, sv=0x81f4690, I decided to Dump out what the $_ looks like in test script and it SV = PVMG(0x8292af8) at 0x82f851c So, here's my question. Can you have a PVMG with no magic? If so, do |
The RT System itself - Status changed from 'new' to 'open' |
From @ysthOn Fri, Dec 16, 2005 at 08:18:36AM -0800, Steve Peters via RT wrote:
Absolutely. $ perl -we'$x=*x; $x=0; use Devel::Peek; Dump $x'
Yes, I'd think so.
|
From @iabynOn Fri, Dec 16, 2005 at 08:18:36AM -0800, Steve Peters via RT wrote:
There are two separate issues here. The OP's test code failures are in essence variants of $ perl -e '$! = 1; print "[$!]\n"; local $ perl -e 'use Tie::Scalar; tie $s, "Tie::StdScalar"; $s = 1; print "[$s]\n"; local $s = $s; print "[$s]\n"' I can't yet think of an easy way of fixing this. The second isssue is the coredump in bleedperl. This is because I It adds an optional new slot to the magic vtable, svt_local, that can be This currently only fixes local $scalar; I still need to check out local Dave -- Change 26569 by davem@davem-cyril on 2006/01/02 12:09:37 add svt_local slot to magic vtable, and fix local $shared Affected files ... ... //depot/perl/ext/threads/shared/shared.xs#53 edit Differences ... ==== //depot/perl/ext/threads/shared/shared.xs#53 (text) ==== @@ -196,6 +196,7 @@ /* Access to shared things is heavily based on MAGIC - in mg.h/mg.c/sv.c sense */ + /* Now the arrays/hashes stuff */ U32 =for apidoc sharedsv_unlock ==== //depot/perl/mg.c#393 (text) ==== @@ -430,15 +430,12 @@ ==== //depot/perl/mg.h#24 (text) ==== @@ -20,6 +20,7 @@ @@ -38,8 +39,9 @@ #define MgTAINTEDDIR(mg) (mg->mg_flags & MGf_TAINTEDDIR) |
From @iabynOn Mon, Jan 02, 2006 at 06:00:43PM +0000, Dave Mitchell wrote:
Actually there are three issues, the third one being the 'scalars leaked' Basically something like foo(\@a); would create a tmp ref, which then gets added to @_ (but not refcounted). Dave -- Change 26591 by davem@davem-cyril on 2006/01/03 02:20:28 ithreads: SVs that were only on the tmps stack leaked Affected files ... ... //depot/perl/sv.c#1092 edit Differences ... ==== //depot/perl/sv.c#1092 (text) ==== @@ -10767,6 +10767,20 @@ PL_start_env = proto_perl->Tstart_env; /* XXXXXX */ |
From @iabynOn Mon, Jan 02, 2006 at 06:00:43PM +0000, Dave Mitchell wrote:
local $shared[N] now fixed by change #26693 (local @shared wasn't broken). -- |
From @jkeenanOn Fri Jan 06 17:26:18 2006, davem@iabyn.com wrote:
[snip]
Were those tests and documentation ever added? Are there still issues outstanding in this ticket? Thank you very much. Jim Keenan |
From @iabynOn Fri, Apr 20, 2012 at 06:31:58PM -0700, James E Keenan via RT wrote:
A quick look shows that MGf_LOCAL is now documented, but by removing its -- |
Migrated from rt.perl.org#37671 (status was 'open')
Searchable as RT37671$
The text was updated successfully, but these errors were encountered: