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
Bug in threads->tid #10213
Comments
From singwang.ho08@imperial.ac.ukHello, I have been using a perl code I wrote in an older perl version. After The code was built to support older version of perl that do not support The code now gives me an error saying an undefined object is requested I believe this is an issue to do with how 'threads->tid()' stores the Best, A test case is attached here: use strict; my $max_threads = 10; my $thread_created = 0; my @joinable_tid : shared = (); for(my $i=0; $i < 100; $i++) { # Thread Monitoring # Worker Thread Flags: Site configuration information for perl 5.10.0: Configured by Debian Project at Thu Oct 1 22:38:45 UTC 2009. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Locally applied patches: @INC for perl 5.10.0: Environment for perl 5.10.0: PATH=/home/singwang/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games |
From @iabynOn Fri, Mar 05, 2010 at 12:46:56PM -0800, Sing Wang Ho wrote:
I think the issue is a race condition: once the parent has called join, but It's a regression, introduced in 5.8.9, 5.9.5 and 5.10.0 and is still The following short test case demonstrates the issue: use threads; The fix is probably to delay the thread->state |= PERL_ITHR_JOINED; in ithread_join() in threads.xs, or introduce a further flag, -- |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Sun, Mar 07, 2010 at 08:53:57PM +0000, Dave Mitchell wrote:
On further reflection, the test code below demonstrates a different bug The OP's bug is actually that ithread_object() tests for SvOK without my @joinable_tid : shared = (); $tid is a fresh PVLV and is thus not SvOK To the OP: you can work round this bug in 5.10.0 by using "$tid" (i.e. in threads->object("$tid")->join(); Note also that from 5.8.9 onwards, there's an easy way to get a list of my @joinable = threads->list(threads::joinable);
-- |
From @jdhedden
Dave, void + arg = ST(1); - if ((items < 2) || ! SvOK(ST(1))) { /* threads->object($tid) */ Also, not knowing how to generate a PVLV, is this a sufficient test threads->create(sub { sleep(1); }); my @tids = qw/1/; for my $tid (@tids) { Thanks. |
From @nwc10On Sun, Mar 07, 2010 at 09:37:59PM +0000, Dave Mitchell wrote:
Actually, given that threads (and threads::shared) are dual life, it's viable [assuming that I'm not missing a special case, because this is conditionally Nicholas Clark |
From @jdheddenSubmitted patch to blead for threads v1.76 which contains fixes for the - Handle magic on arg to ->object() (bug #73330) |
From singwang.ho08@imperial.ac.ukHello, Using: Is the workaround I am looking for, thanks! I am not a perl expert but I don't think it is a race condition because sleep 1; Furthermore, I used lock() to prevent other threads from using it. Best, |
From @iabynOn Mon, Mar 08, 2010 at 10:35:01AM -0500, Jerry D. Hedden wrote:
Looks okay
Tied elements (or shared array elements) are PVLVs. The following is a use threads; { tie my $tid, Mytie; -- |
From @iabynOn Mon, Mar 08, 2010 at 04:26:48PM -0500, Jerry D. Hedden wrote:
I thought I'd just mention once again how intensely I hate this sort of Its one big patch that conflates multiple separate fixes, plus a whole As regards the specifics of this patch: * I don't see how
Appears in this bug report. The second issue I noticed is that a thread Absent a clear discussion of the issue in RT, the patch needs a better * Is it really necessary to create a new test file, object.t? * The "Memory consumption" section: I don't like "On most systems, frequent and continual creation and -- |
From @iabynOn Mon, Mar 08, 2010 at 05:54:58PM +0000, Sing Wang Ho wrote:
Sorry I didn't make it clear. While attempting to diagnose your issue, I -- |
From @jdheddenOn Tue, Mar 9, 2010 at 09:46, Dave Mitchell <davem@iabyn.com> wrote:
Understood. I've withdrawn the patch, and will resubmit accordingly.
The problem you noted was that my $tid = threads->tid(); did not work inside the child thread if the parent thread had already done I did see an inconsistency with how ->object() and ->self() work inside a Regarding the JOINED flag, again, I don't see anything that needs changing.
Sure, it could be put into an existing file. Which do you think might be best?
I have seen several postings to p5p, and I think, also, there have been some The only idea I have for why Perl might be responsible is related to memory At any rate, given the non-responsiveness of the developers to grapple with |
From @iabynOn Tue, Mar 09, 2010 at 10:34:34AM -0500, Jerry D. Hedden wrote:
Okay thanks. Note that because of the code freeze, I'm assuming these will get applied
Ah I see. The idea of having a thread marked as 'JOINED' while its still "Thread is being / has been joined"
Ok fair enough. -- |
From pshaydo@elverils.comOn Tue, 9 Mar 2010 10:34:34 -0500
http://rt.perl.org/rt3/Public/Bug/Display.html?id=69598 is one of such
Not quite understand. I have some multithreaded programs written in C
My system perl's RSS grows about 3.8M per 1000 threads, ActiveState Perl -- |
From @khwilliamsonDave Mitchell wrote:
I maintain that wording needs to be added in either perlhack or |
Migrated from rt.perl.org#73330 (status was 'open')
Searchable as RT73330$
The text was updated successfully, but these errors were encountered: