in reply to Mason app dies with "Bizarre copy of array in aassign"

Scant info to go on, but maybe this will help some.

Devel::StackTrace is called from Exception::Class::Base which is a part of Exception::Class which is used by HTML::Mason.

Working back from the other end, the actual error message you are seeing is being raised in sv.c (line 3734 in 5.8.1-rc4) in the function Perl_sv_setsv_flags(). The stated purpose of this function (although it can be called from the perl sources and/ or XS code under the guise of several macros) is to copy one scalar to another. The situation in which it raises this error is when it encounters a source scalar that is a reference to a HASH/ARRAY/CODE/IO. It doesn't explain why this is considered bizarre, but it's probably obvious to those (few) that understand it:).

In the most generic sense, it would appear that an exception is being raised inside Mason and it is in the process of trying to generate a stack trace, and specifically, trying to get a copy of the arguments (DB::args) to the function (or probably method) that was called before the exception was raised, and it is during the process of copying these args from an array in the DB package to a local array that it encounters a scalar that is a reference which is considered an error, either because of the time when it is being copied, or because of the method being used to copy it.

Beyond this purely circumstantial evidence, there's not much more that can be identified until you can identify the code at your end that is causing the exception to be raised. Looking at the sample you posted in your follow up, it looks some sort of linked list is being set up. The archetypical error with this sort of code is that somewhere, a node in the link list gets linked back to itself and the next time a search or insert occurs, it starts looping around forever. Total speculation, but I think that's about the best you hope for given the sparsity of the info.

To try and debug this further, you either need to re-create the problem whilst running under the debugger, which is a PIA to do for a webapp, or you need to litter warn statements through your app. Starting at the highest level, isolate where the Bizzarre msg is coming from and track it in function by function, line by line until you find where your leaving your code, and with what parameters, prior to the msg.

The fact that the exception reporting mechanism is itself riasing an exception is decidedly unhelpful:), and is probably something that the author of most of the modules I listed above, Dave Rolsky would be interested in. Of course, he'd prefer a 5 line script that demonstrated the problem along with your bug report, but it might be worth contacting him even without that as this miight be something he has encountered before.

It would also be worth ensuring that you are running the latest version of Mason and its dependancies and that the error still exists, before you do make contact though, as that's almost certainly the first question you will be asked.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.

  • Comment on Re: Mason app dies with "Bizarre copy of array in aassign"