Skip Menu |

This queue is for tickets about the Params-Validate CPAN distribution.

Report information
The Basics
Id: 86811
Status: resolved
Priority: 0/
Queue: Params-Validate

People
Owner: Nobody in particular
Requestors: bill+pause [...] blunn.org
DUCKBILL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.20



Subject: Blanked parameters / Bizarre copy of ARRAY
I am getting an issue when using MooseX::Params::Validate::validated_list. So, we have a bit of code which goes like this sub _apply_action_to_sale_flags_by_pid { my ($self, $sale_flags_by_pid, $list_action) = validated_list( \@_, sale_flags_by_pid => { isa => Map[ProductId, Bool] }, list_action => { isa => Dict[ action => ListAction, # create or delete type => Str, pids => ArrayRef, slurpy HashRef # Allow any other keys # (Don't put anything after "slurpy") ] }, ); ... where ProductId and ListAction are types declared using MooseX::Types. Under certain circumstances, we can pass in both named parameters, verified as defined values, but the results in $sale_flags_by_pid and $list_action both end up as undef. Under other circumstances, it has also come back with the “Bizarre copy of ARRAY” error. Diagnostics reveal that when it is failing, 'validated_list' is returning a 3-element list where the first element looks like a ref to the invocant, and the other two elements are undef. Now, it only seems to fail when perl has done a "lot" of work previously to this call. When perl hasn't done much work, it works fine. If I arrange things to make it fail (i.e. making perl do "a lot" of work), then run the program under PARAMS_VALIDATE_IMPLEMENTATION=PP, then that makes things work again. The context in which it fails is rather involved, and it's not convenient for me to try to construct a minimal failure case. But I thought it might be an idea to at least raise an issue so that if anyone else sees a similar issue we can get statistics and perhaps that can guide where best to expend diagnostic resource. For now I may need to force the pure perl implementation.
Forgot to mention version numbers. The problem was first noticed under Params::Validate 1.07. The problem also manifests under Params::Validate 1.08.
Subject: Re: [rt.cpan.org #86811] Blanked parameters / Bizarre copy of ARRAY
Date: Wed, 10 Jul 2013 11:00:19 -0500 (CDT)
To: William Blunn via RT <bug-Params-Validate [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Tue, 9 Jul 2013, William Blunn via RT wrote: Show quoted text
> Under other circumstances, it has also come back with the “Bizarre copy of ARRAY” error.
This means something went wrong in the XS code. Unfortunately, figuring out what can be pretty difficult, especially since I'm not much of an XS guru. Show quoted text
> Now, it only seems to fail when perl has done a "lot" of work previously to this call. > > When perl hasn't done much work, it works fine.
I suspect some sort of stack corruption or something like that. It could also be a bug in Perl itself. What version of Perl are you using, and can you replicate this problem with 5.18 if you're not using it? -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: [rt.cpan.org #86811] Test Case
Date: Sat, 21 Mar 2015 13:03:29 -0400
To: bug-ParamsValidate [...] rt.cpan.org
From: Noel Maddy <zhtwnpanta [...] gmail.com>
I've been running into this bug as well. Finally was able to track it down (and start learning a bit of XS as well). In validate_with(), the local stack pointer is set up by PPCODE (through dXSARGS and dSP) as a copy of the global stack pointer. The validation process may reallocate the stack. In this test case, the callbacks set up by MooseX::Params::Validate for a large arrayref of arrayrefs can cause this reallocation. Upon returning, the local stack pointer now refers to the old, free'd stack, but the RETURN_ARRAY and RETURN_HASH macros use the stale local stack pointer. I don't know enough about XS macros yet to know how to reset the local stack pointer within validate_with() after the validation functions are called. I'm attaching a test case that fails consistently, by doubling the size of the structure to be validated until it crashes. Sadly, it still relies on MooseX::Params::Validate -- ideally, I'd like to strip Moose out of the picture for better testing. In a Fedora 20 environment, 5.20.2 and 5.18.4 fail when the test case reaches 128 arrayrefs. However, 5.16.3 doesn't fail until 1024 arrayrefs. I haven't tested it with anything earlier than 5.16.3

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Download valgrind.out
application/octet-stream 4.9k

Message body not shown because it is not plain text.

Subject: [rt.cpan.org #86811] Pull request
Date: Mon, 6 Apr 2015 20:26:21 -0700
To: bug-Params-Validate [...] rt.cpan.org
From: Noel Maddy <zhtwnpanta [...] gmail.com>
I think I've got this one nailed down, now -- see https://github.com/autarch/Params-Validate/pull/5 Tested on 5.10.1 and 5.20.2 so far.
RT-Send-CC: autarch [...] urth.org
Hello Dave Rolsky, I don't know if you're seeing this thread already, but Noel Maddy appears to be making progress with the bug in Params::Validate I raised in 2013. (Thinking about it, you will probably have received a pull request https://github.com/autarch/Params-Validate/pull/5 ) Regards, Bill On Mon Apr 06 23:26:30 2015, zhtwnpanta@gmail.com wrote: Show quoted text
> I think I've got this one nailed down, now -- see > https://github.com/autarch/Params-Validate/pull/5 > > > Tested on 5.10.1 and 5.20.2 so far.