On Thu, Jul 10, 2008 at 5:09 PM, Dave Mitchell <davem@iabyn.com> wrote: > On Thu, Jul 10, 2008 at 05:56:08PM +0100, Andy Armstrong wrote: > > There's a thread[1] on the mod_perl mailing list at the moment which > > suggests[2] that > > > > my $foo = "bar" if $baz; > > > > is causing memory corruption with mod_perl on 5.10.0. On 5.8.8 the same > > code worked fine. > > > > It's understood that it's a bad idea but it doesn't seem great that it > > can screw things so badly. Is this a known problem with 5.10? > > I'm not aware of any such problem. > > The diagnosis may be a red herring; removing the statement modifiers > may have simply changed the execution in such a way that the corruption > (elsewhere) was no longer triggered. > > Difficult to comment further without a test case. Or perhaps you could > suggest to the OP that he run his prog under valgrind? Hi, I'm the OP on this. I think you're partially right wrt the red herring -- I don't believe "my $foo if $bar" is completely to blame. I should add some details that never came out on the modperl list. The "my $foo if $bar" code was in the <%shared> section of a Mason component. Mason does some interesting voodoo behind the scenes involving weakrefs. I think the combination of the two was causing all the problems. Sadly I lack the time to try to reproduce it, and it was such a heisenbug anyway I'm not sure I could come up with a reliable test case. All I can say is that it resulted in a lot of interesting errors (Attempt to free unreferenced scalar, attempt to copy value to a freed scalar, free from wrong pool, use of freed value in iteration), and each one was sourced at a line that involved assigning to or from one of the "my $foo if $bar" variables. Fixing those fixed the problem completely. I should also note that this is on a Fedora 9 system (using their perl, mod_perl, and Mason). It could be an issue introduced by a local patch. Sorry it's not a test case, but maybe that gives one of you smarter core developers a clue on where to start looking. -- Stephen Clouse <stephenclouse@gmail.com>Thread Previous | Thread Next