Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

$row->copy causing exit from controller(!)

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


paulm at paulm

May 1, 2008, 3:31 AM

Post #1 of 11 (313 views)
Permalink
$row->copy causing exit from controller(!)

I'm seeing something exceedingly odd: copying data causing a premature
return from the controller, like a detach(),

foreach my $table (@chart_related_tables) {
my $rs = $ds->resultset($table);
warn "copying $table for ", $new_chart->uid;
for my $row ($rs->search({web_chart_spec_uid => $chart->uid})) {
warn "..row ", $row->web_chart_spec_uid, $row;
$row->copy({web_chart_spec_uid => $new_chart->uid}); # XXX
}
#$_->copy({web_chart_spec_uid => $new_chart->uid})
#for $rs->search({web_chart_spec_uid => $chart->uid});
die "cloned", $new_chart->uid;
}

There's no further execution past the line marked XXX: the template is
rendered from that point on. The die is never called.

I have a feeling it's something to do with has_many

Chart:
__PACKAGE__->has_many(chartview_company => 'IDL::Schema::ChartCompany'
=> 'web_chart_spec_uid', {cascade_delete => 0});

If I exclude from @chart_related_tables ChartCompany it works.

**

I realize there's scads of debug I could provide but wanted to check
first this wasn't something someone had run into before. If not, what
kind of debug can I provide?

DBIC $VERSION = '0.08009';
Catalyst 5.7012

Paul

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


jon at jrock

May 1, 2008, 5:25 AM

Post #2 of 11 (303 views)
Permalink
Re: $row->copy causing exit from controller(!) [In reply to]

* On Thu, May 01 2008, Paul Makepeace wrote:
> I'm seeing something exceedingly odd: copying data causing a premature
> return from the controller, like a detach(),
>
> foreach my $table (@chart_related_tables) {
> my $rs = $ds->resultset($table);
> warn "copying $table for ", $new_chart->uid;
> for my $row ($rs->search({web_chart_spec_uid => $chart->uid})) {
> warn "..row ", $row->web_chart_spec_uid, $row;
> $row->copy({web_chart_spec_uid => $new_chart->uid}); # XXX
> }
> #$_->copy({web_chart_spec_uid => $new_chart->uid})
> #for $rs->search({web_chart_spec_uid => $chart->uid});
> die "cloned", $new_chart->uid;
> }
>

Is copy throwing an exception? Are you using an old version of
stacktrace?

If yes and yes: upgrade StackTrace (it eats exceptions)
If no and no: something is horribly wrong (perl -d may help)
If yes and no: see above.

I have a feeling it's the first one. Another possibility is that "copy"
is last-ing out of itself.

Regards,
Jonathan Rockway

--
print just => another => perl => hacker => if $,=$"

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


ash_cpan at firemirror

May 1, 2008, 5:33 AM

Post #3 of 11 (302 views)
Permalink
Re: $row->copy causing exit from controller(!) [In reply to]

On 1 May 2008, at 13:25, Jonathan Rockway wrote:

> * On Thu, May 01 2008, Paul Makepeace wrote:
>> I'm seeing something exceedingly odd: copying data causing a
>> premature
>> return from the controller, like a detach(),
>>
>> foreach my $table (@chart_related_tables) {
>> my $rs = $ds->resultset($table);
>> warn "copying $table for ", $new_chart->uid;
>> for my $row ($rs->search({web_chart_spec_uid => $chart-
>> >uid})) {
>> warn "..row ", $row->web_chart_spec_uid, $row;
>> $row->copy({web_chart_spec_uid => $new_chart->uid}); #
>> XXX
>> }
>> #$_->copy({web_chart_spec_uid => $new_chart->uid})
>> #for $rs->search({web_chart_spec_uid => $chart->uid});
>> die "cloned", $new_chart->uid;
>> }
>>
>
> Is copy throwing an exception? Are you using an old version of
> stacktrace?
>
> If yes and yes: upgrade StackTrace (it eats exceptions)
> If no and no: something is horribly wrong (perl -d may help)
> If yes and no: see above.
>
> I have a feeling it's the first one. Another possibility is that
> "copy"
> is last-ing out of itself.

If also occasionally seen exceptions disappear without stack trace
one. Its a right pain to track down what causes it (lots of source
diving and perl -d)

-ash

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


ash_cpan at firemirror

May 1, 2008, 5:37 AM

Post #4 of 11 (302 views)
Permalink
Re: $row->copy causing exit from controller(!) [In reply to]

On 1 May 2008, at 13:33, Ash Berlin wrote:

>
> On 1 May 2008, at 13:25, Jonathan Rockway wrote:
>
>> * On Thu, May 01 2008, Paul Makepeace wrote:
>>> I'm seeing something exceedingly odd: copying data causing a
>>> premature
>>> return from the controller, like a detach(),
>>>
>>> foreach my $table (@chart_related_tables) {
>>> my $rs = $ds->resultset($table);
>>> warn "copying $table for ", $new_chart->uid;
>>> for my $row ($rs->search({web_chart_spec_uid => $chart-
>>> >uid})) {
>>> warn "..row ", $row->web_chart_spec_uid, $row;
>>> $row->copy({web_chart_spec_uid => $new_chart->uid}); #
>>> XXX
>>> }
>>> #$_->copy({web_chart_spec_uid => $new_chart->uid})
>>> #for $rs->search({web_chart_spec_uid => $chart->uid});
>>> die "cloned", $new_chart->uid;
>>> }
>>>
>>
>> Is copy throwing an exception? Are you using an old version of
>> stacktrace?
>>
>> If yes and yes: upgrade StackTrace (it eats exceptions)
>> If no and no: something is horribly wrong (perl -d may help)
>> If yes and no: see above.
>>
>> I have a feeling it's the first one. Another possibility is that
>> "copy"
>> is last-ing out of itself.
>
> If also occasionally seen exceptions disappear without stack trace
> one. Its a right pain to track down what causes it (lots of source
> diving and perl -d)

er... 'I've also .... stack trace plugin'

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


paulm at paulm

May 1, 2008, 7:47 AM

Post #5 of 11 (296 views)
Permalink
Re: $row->copy causing exit from controller(!) [In reply to]

On Thu, May 1, 2008 at 1:25 PM, Jonathan Rockway <jon[at]jrock.us> wrote:
> * On Thu, May 01 2008, Paul Makepeace wrote:
> > I'm seeing something exceedingly odd: copying data causing a premature
> > return from the controller, like a detach(),
> >
> > foreach my $table (@chart_related_tables) {
> > my $rs = $ds->resultset($table);
> > warn "copying $table for ", $new_chart->uid;
> > for my $row ($rs->search({web_chart_spec_uid => $chart->uid})) {
> > warn "..row ", $row->web_chart_spec_uid, $row;
> > $row->copy({web_chart_spec_uid => $new_chart->uid}); # XXX
> > }
> > #$_->copy({web_chart_spec_uid => $new_chart->uid})
> > #for $rs->search({web_chart_spec_uid => $chart->uid});
> > die "cloned", $new_chart->uid;
> > }
> >
>
> Is copy throwing an exception? Are you using an old version of
> stacktrace?

There's no exception. Imagine a "return;" and that's what is happening AFAICT.

How does one use perl -d in the context of a FastCGI instance? Any
other debugging tips?

P

>
> If yes and yes: upgrade StackTrace (it eats exceptions)
> If no and no: something is horribly wrong (perl -d may help)
> If yes and no: see above.
>
> I have a feeling it's the first one. Another possibility is that "copy"
> is last-ing out of itself.
>
> Regards,
> Jonathan Rockway
>
> --
> print just => another => perl => hacker => if $,=$"
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


pagaltzis at gmx

May 1, 2008, 8:21 AM

Post #6 of 11 (295 views)
Permalink
Re: $row->copy causing exit from controller(!) [In reply to]

Hi Paul,

* Paul Makepeace <paulm[at]paulm.com> [2008-05-01 17:00]:
> How does one use perl -d in the context of a FastCGI instance?
> Any other debugging tips?

does your problem happen only with the FastCGI engine or can you
reproduce it with others?

If you can, well, there you go.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


paulm at paulm

May 2, 2008, 6:04 AM

Post #7 of 11 (279 views)
Permalink
Re: Re: $row->copy causing exit from controller(!) [In reply to]

On Thu, May 1, 2008 at 4:21 PM, Aristotle Pagaltzis <pagaltzis[at]gmx.de> wrote:
> Hi Paul,
>
> * Paul Makepeace <paulm[at]paulm.com> [2008-05-01 17:00]:
>
> > How does one use perl -d in the context of a FastCGI instance?
> > Any other debugging tips?
>
> does your problem happen only with the FastCGI engine or can you
> reproduce it with others?

You mean like running the foo_server.pl on port 3000? I haven't done
that yet, partly as my app is a Cat/PHP hybrid so I'm having to modify
my login system to work without PHP.

That aside, and so I'm understanding what's being proposed here:
modifying the foo_server.pl to use perl -d and breakpointing the
controller, then stepping through based on a hit?

P

>
> If you can, well, there you go.
>
> Regards,
> --
> Aristotle Pagaltzis // <http://plasmasturm.org/>
>
>
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


diment at gmail

May 2, 2008, 6:22 AM

Post #8 of 11 (279 views)
Permalink
Re: Re: $row->copy causing exit from controller(!) [In reply to]

On 2 May 2008, at 23:04, Paul Makepeace wrote:

> On Thu, May 1, 2008 at 4:21 PM, Aristotle Pagaltzis
> <pagaltzis[at]gmx.de> wrote:
>> Hi Paul,
>>
>> * Paul Makepeace <paulm[at]paulm.com> [2008-05-01 17:00]:
>>
>>> How does one use perl -d in the context of a FastCGI instance?
>>> Any other debugging tips?
>>
>> does your problem happen only with the FastCGI engine or can you
>> reproduce it with others?
>
> You mean like running the foo_server.pl on port 3000? I haven't done
> that yet, partly as my app is a Cat/PHP hybrid so I'm having to modify
> my login system to work without PHP.
>
> That aside, and so I'm understanding what's being proposed here:
> modifying the foo_server.pl to use perl -d and breakpointing the
> controller, then stepping through based on a hit?
>

Yeah, that works, but if you're having a problem with web server
deployment, you're probably better off writing test cases and dumping
data:

CATALYST_SERVER=http://somewhere.com/myapp prove -l t

then you know if you're getting identical behaviour with the test
server and your 'real' server which is important information,
especially as the test server is much easier to debug.



_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


paulm at paulm

May 2, 2008, 7:10 AM

Post #9 of 11 (280 views)
Permalink
Re: Re: $row->copy causing exit from controller(!) [In reply to]

On Fri, May 2, 2008 at 2:22 PM, Kieren Diment <diment[at]gmail.com> wrote:
>
> On 2 May 2008, at 23:04, Paul Makepeace wrote:
>
>
> > On Thu, May 1, 2008 at 4:21 PM, Aristotle Pagaltzis <pagaltzis[at]gmx.de>
> wrote:
> >
> > > Hi Paul,
> > >
> > > * Paul Makepeace <paulm[at]paulm.com> [2008-05-01 17:00]:
> > >
> > >
> > > > How does one use perl -d in the context of a FastCGI instance?
> > > > Any other debugging tips?
> > > >
> > >
> > > does your problem happen only with the FastCGI engine or can you
> > > reproduce it with others?
> > >
> >
> > You mean like running the foo_server.pl on port 3000? I haven't done
> > that yet, partly as my app is a Cat/PHP hybrid so I'm having to modify
> > my login system to work without PHP.
> >
> > That aside, and so I'm understanding what's being proposed here:
> > modifying the foo_server.pl to use perl -d and breakpointing the
> > controller, then stepping through based on a hit?
> >
> >
>
> Yeah, that works, but if you're having a problem with web server
> deployment, you're probably better off writing test cases and dumping data:
>
> CATALYST_SERVER=http://somewhere.com/myapp prove -l t
>
> then you know if you're getting identical behaviour with the test server
> and your 'real' server which is important information, especially as the
> test server is much easier to debug.

I'm assuming I can just click in the test server and readily
re-exhibit the bug myself without writing test cases (although I don't
doubt their worth in the general case).

The question I'm asking is how to debug the system given the test
server & FastCGI are both exhibiting this weird failure mode.

P

>
>
>
>
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


pagaltzis at gmx

May 2, 2008, 8:29 PM

Post #10 of 11 (275 views)
Permalink
Re: $row->copy causing exit from controller(!) [In reply to]

* Paul Makepeace <paulm[at]paulm.com> [2008-05-02 15:15]:
> That aside, and so I'm understanding what's being proposed
> here: modifying the foo_server.pl to use perl -d and
> breakpointing the controller, then stepping through based on a
> hit?

You don’t need to modify anything. You can call any Perl script
by passing it to `perl`, with appropriate perl switches, and the
`script/myapp_server.pl` is no exception. Just invoke it with
`perl -d script/myapp_server.pl`, set a breakpoint, run, pop over
to your browser, hit a page that will trigger the breakpoint, and
there you are.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


paulm at paulm

May 8, 2008, 2:42 AM

Post #11 of 11 (230 views)
Permalink
Re: $row->copy causing exit from controller(!) [In reply to]

On Thu, May 1, 2008 at 11:31 AM, Paul Makepeace <paulm[at]paulm.com> wrote:
> I'm seeing something exceedingly odd: copying data causing a premature
> return from the controller, like a detach(),
>
> foreach my $table (@chart_related_tables) {
> my $rs = $ds->resultset($table);
> warn "copying $table for ", $new_chart->uid;
> for my $row ($rs->search({web_chart_spec_uid => $chart->uid})) {
> warn "..row ", $row->web_chart_spec_uid, $row;
> $row->copy({web_chart_spec_uid => $new_chart->uid}); # XXX
> }
> #$_->copy({web_chart_spec_uid => $new_chart->uid})
> #for $rs->search({web_chart_spec_uid => $chart->uid});
> die "cloned", $new_chart->uid;
> }
>
> There's no further execution past the line marked XXX: the template is
> rendered from that point on. The die is never called.
>
> I have a feeling it's something to do with has_many
>
> Chart:
> __PACKAGE__->has_many(chartview_company => 'IDL::Schema::ChartCompany'
> => 'web_chart_spec_uid', {cascade_delete => 0});
>
> If I exclude from @chart_related_tables ChartCompany it works.

I had the stroke of intuition to wrap the call to copy() in an "eval
{}; warn @$ if $@;" and saw what is going on. It seems like the copy()
is not just copying the row but other rows as well, which is in turn
causing duplicate key errors, in particular the rels mentioned above
that have has_many. The controller at least completes now. (Why an
error like this would bypass the exception handler is a mystery and
presumably a bug.)

There's a series of BEGIN/COMMIT/ROLLBACK lines coming out of
somewhere in the FastCGI screen too, FWIW.

http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Row.pm#copy
doesn't give any hint that multiple rows would be inserted.

Does this sound plausible?

Sorry I haven't got more debug, I'm squeezing this into occasional
spare minutes here and there. If there's something specific I can try
or provide, let me know. Unfortunately getting the fastcgi working
with perl -d isn't likely any time soon. I don't think it's there in
any case; it feels more DBIx::Class related.

P

>
> **
>
> I realize there's scads of debug I could provide but wanted to check
> first this wasn't something someone had run into before. If not, what
> kind of debug can I provide?
>
> DBIC $VERSION = '0.08009';
> Catalyst 5.7012
>
> Paul
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.