Re: [rt-users] Simple RT script makes Mysql Server go away

2009-09-29 Thread Joop
Hello Todd,
 All,

 I am customizing RT to add an attribute to transactions that meet
 certain criteria. The script below is meant to update all the existing
 transactions but after a while the Mysal server goes away. Is there
 anything obvious about the script causing this? Thanks!

 #!/opt/perl/bin/perl

 use strict;
 use warnings;

 use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
 use RT;
 use RT::Transactions;;

 RT::LoadConfig();
 RT::Init();

 my $last = 1;

 for my $id ( (500_000, 1_000_000, 1_500_000, 2_000_000, 2_500_000,
 3_000_000, 3_500_000, 4_000_000, 4_500_000,
 5_000_000, 5_500_000, 6_000_000, 6_500_000, 7_000_000,
 7_500_000, 8_000_000, 8_500_000, 9_000_000,
 9_500_000, 10_000_000) ) {

 my $transactions = RT::Transactions-new( $RT::SystemUser );
 $transactions-Limit( FIELD = 'ObjectType', VALUE = RT::Ticket );
 $transactions-Limit( FIELD = 'Type', VALUE = EmailRecord );
 $transactions-Limit( FIELD = 'id', VALUE = $last, OPERATOR = = );
 $transactions-Limit( FIELD = 'id', VALUE = $id, OPERATOR =
 , ENTRYAGGREGATOR = AND );

 while (my $trans = $transactions-Next) {

 my $ticket = $trans-Object;

 if ( $ticket-RequestorIsExternal ) {
 $trans-SetAttribute( Name = ExternalEmail, Content = 1);
 }
 }

 $last = $id;

 }
   
Maybe I missed something in your script logic or in how mysql handles 
commits but when is your modification committed to the database?
If its and the end then maybe mysql is running out of space somewhere.

Regards,

Joop

___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


[rt-users] Simple RT script makes Mysql Server go away

2009-09-28 Thread Todd Chapman
All,

I am customizing RT to add an attribute to transactions that meet
certain criteria. The script below is meant to update all the existing
transactions but after a while the Mysal server goes away. Is there
anything obvious about the script causing this? Thanks!

#!/opt/perl/bin/perl

use strict;
use warnings;

use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;
use RT::Transactions;;

RT::LoadConfig();
RT::Init();

my $last = 1;

for my $id ( (500_000, 1_000_000, 1_500_000, 2_000_000, 2_500_000,
3_000_000, 3_500_000, 4_000_000, 4_500_000,
5_000_000, 5_500_000, 6_000_000, 6_500_000, 7_000_000,
7_500_000, 8_000_000, 8_500_000, 9_000_000,
9_500_000, 10_000_000) ) {

my $transactions = RT::Transactions-new( $RT::SystemUser );
$transactions-Limit( FIELD = 'ObjectType', VALUE = RT::Ticket );
$transactions-Limit( FIELD = 'Type', VALUE = EmailRecord );
$transactions-Limit( FIELD = 'id', VALUE = $last, OPERATOR = = );
$transactions-Limit( FIELD = 'id', VALUE = $id, OPERATOR =
, ENTRYAGGREGATOR = AND );

while (my $trans = $transactions-Next) {

my $ticket = $trans-Object;

if ( $ticket-RequestorIsExternal ) {
$trans-SetAttribute( Name = ExternalEmail, Content = 1);
}
}

$last = $id;

}
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Simple RT script makes Mysql Server go away

2009-09-28 Thread Jesse Vincent



On Mon, Sep 28, 2009 at 03:23:53PM -0400, Todd Chapman wrote:
 All,
 
 I am customizing RT to add an attribute to transactions that meet
 certain criteria. The script below is meant to update all the existing
 transactions but after a while the Mysal server goes away. Is there
 anything obvious about the script causing this? Thanks!

When one can make ones database server go away by issuing SQL
commands What's the mysql server's error log say?
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Simple RT script makes Mysql Server go away

2009-09-28 Thread Kenneth Marshall
Todd,

Checking the MySQL logs would help. One MySQL configuration parameter
that seems to cause behavior of this type is the connection timeout,
maybe it should be larger or the behavior disabled? Just an idea.

Cheers,
Ken

On Mon, Sep 28, 2009 at 03:23:53PM -0400, Todd Chapman wrote:
 All,
 
 I am customizing RT to add an attribute to transactions that meet
 certain criteria. The script below is meant to update all the existing
 transactions but after a while the Mysal server goes away. Is there
 anything obvious about the script causing this? Thanks!
...
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Simple RT script makes Mysql Server go away

2009-09-28 Thread Todd Chapman
On Mon, Sep 28, 2009 at 3:32 PM, Jesse Vincent je...@bestpractical.com wrote:



 On Mon, Sep 28, 2009 at 03:23:53PM -0400, Todd Chapman wrote:
 All,

 I am customizing RT to add an attribute to transactions that meet
 certain criteria. The script below is meant to update all the existing
 transactions but after a while the Mysal server goes away. Is there
 anything obvious about the script causing this? Thanks!

 When one can make ones database server go away by issuing SQL
 commands What's the mysql server's error log say?


Number of processes running now: 0
090928 16:18:27  mysqld restarted

Not very helpful. RT doesn't seem to recognize when the server goes
away and I get a lot of these on STDERR:

[Mon Sep 28 20:27:01 2009] [crit]: HasRight called with no valid
object (/opt/rt3/lib/RT/Principal_Overlay.pm:321)
[Mon Sep 28 20:27:01 2009] [crit]: RT::Ticket=HASH(0x2ec83530) tried
to load a bogus ticket: 106681 (/opt/rt3/lib/RT/Ticket_Overlay.pm:258)

This is a development server so there is no load. I think maybe the
load or memory of the script is growing and causing slowness that
results in a timeout, but I can't say for certain and don't know how
to proceed.

Ideas?
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com