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

Mailing List Archive: Request Tracker: Users

race condition with scrips updating db?

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


ch at awry

Apr 14, 2008, 1:38 PM

Post #1 of 3 (129 views)
Permalink
race condition with scrips updating db?

Hi,

I'm using the ExtractCustomFieldValues extension to extract an email
address out of the body of a message and set it as the requestor of the
ticket.

My template first removes the original requestor from the ticket, then
adds the new address as a requestor. In the RT history for the ticket,
I see this work correctly.

My Extraction scrip has a description '00_extract_fields' and the
autoreply scrip has a description '20_autoreply_on_create'. The scrips
appear to be firing in the proper order (00_extract_fields first, then
20_autoreply_on_create). Nevertheless, the outgoing email in the
autoreply picks up the address of the first requestor.

My theory is that this is a race condition: the autoreply scrip is
properly firing after the extract scrip, but the extract scrip hasn't
finished updating the database by the time the autoreply scrip starts.

Is there a way to test this theory and fix the problem?


Thanks,


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

Community help: http://wiki.bestpractical.com
Commercial support: sales[at]bestpractical.com


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


torsten.brumm at Kuehne-Nagel

May 7, 2008, 7:20 AM

Post #2 of 3 (80 views)
Permalink
Re: race condition with scrips updating db? [In reply to]

Hi Chris,

Hopefully you got a answer to your request already, if not try the following:

1. create a tiny scrip in which only wait for some seconds?
2. i'm not 100% sure, but try to set both scrip at the Stage to Transaction Batch

Torsten


Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: Hans-Georg Brinkmann (Vors.), Uwe Bielang (Stellv.), Bruno Mang, Dirk Blesius (Stellv.), Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persönlich haftende Gesellschaft: Kühne & Nagel A.G., Sitz: Contern/Luxemburg Geschäftsführender Verwaltungsrat: Klaus-Michael Kühne


-----Ursprüngliche Nachricht-----
Von: rt-users-bounces[at]lists.bestpractical.com [mailto:rt-users-bounces[at]lists.bestpractical.com] Im Auftrag von Chris Haumesser
Gesendet: Montag, 14. April 2008 22:39
An: rt-users[at]lists.bestpractical.com
Betreff: [rt-users] race condition with scrips updating db?

Hi,

I'm using the ExtractCustomFieldValues extension to extract an email address out of the body of a message and set it as the requestor of the ticket.

My template first removes the original requestor from the ticket, then adds the new address as a requestor. In the RT history for the ticket, I see this work correctly.

My Extraction scrip has a description '00_extract_fields' and the autoreply scrip has a description '20_autoreply_on_create'. The scrips appear to be firing in the proper order (00_extract_fields first, then 20_autoreply_on_create). Nevertheless, the outgoing email in the autoreply picks up the address of the first requestor.

My theory is that this is a race condition: the autoreply scrip is properly firing after the extract scrip, but the extract scrip hasn't finished updating the database by the time the autoreply scrip starts.

Is there a way to test this theory and fix the problem?


Thanks,


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

Community help: http://wiki.bestpractical.com Commercial support: sales[at]bestpractical.com


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

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

Community help: http://wiki.bestpractical.com
Commercial support: sales[at]bestpractical.com


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


KFCrocker at lbl

May 7, 2008, 9:16 AM

Post #3 of 3 (79 views)
Permalink
Re: race condition with scrips updating db? [In reply to]

Chris,


Yes, I had the same problem awhile back. I change the condition to user
defined and set up my own, then I changed the Stage to TransactionBatch.
The "TransactionBatch" will only work if it is turned on in your
RT_SiteCinfig.pm file "Set($UseTransactionBatch, '1');". For some
reason, it SEEMS that if the condition is NOT user-defined, RT appears
to re-set a lot of values before executing the building of the template
code. By using "TransactionBatch" and "User-defined" and coding

my $trans = $self->TransactionObj;

return ($trans->Type eq "Status" &&
$trans->NewValue eq "rejected");

I was able to get around that. I'm not a perl guru so my ability to
really analyze the code that does all this is quite limited (I can't
even figure out why I can't install Rights Matrix and THAT should be
simple). What I do now works without fail. Hope this helps.


Kenn
LBNL

On 5/7/2008 7:20 AM, Ham MI-ID, Torsten Brumm wrote:
> Hi Chris,
>
> Hopefully you got a answer to your request already, if not try the following:
>
> 1. create a tiny scrip in which only wait for some seconds?
> 2. i'm not 100% sure, but try to set both scrip at the Stage to Transaction Batch
>
> Torsten
>
>
> Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: Hans-Georg Brinkmann (Vors.), Uwe Bielang (Stellv.), Bruno Mang, Dirk Blesius (Stellv.), Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persönlich haftende Gesellschaft: Kühne & Nagel A.G., Sitz: Contern/Luxemburg Geschäftsführender Verwaltungsrat: Klaus-Michael Kühne
>
>
> -----Ursprüngliche Nachricht-----
> Von: rt-users-bounces[at]lists.bestpractical.com [mailto:rt-users-bounces[at]lists.bestpractical.com] Im Auftrag von Chris Haumesser
> Gesendet: Montag, 14. April 2008 22:39
> An: rt-users[at]lists.bestpractical.com
> Betreff: [rt-users] race condition with scrips updating db?
>
> Hi,
>
> I'm using the ExtractCustomFieldValues extension to extract an email address out of the body of a message and set it as the requestor of the ticket.
>
> My template first removes the original requestor from the ticket, then adds the new address as a requestor. In the RT history for the ticket, I see this work correctly.
>
> My Extraction scrip has a description '00_extract_fields' and the autoreply scrip has a description '20_autoreply_on_create'. The scrips appear to be firing in the proper order (00_extract_fields first, then 20_autoreply_on_create). Nevertheless, the outgoing email in the autoreply picks up the address of the first requestor.
>
> My theory is that this is a race condition: the autoreply scrip is properly firing after the extract scrip, but the extract scrip hasn't finished updating the database by the time the autoreply scrip starts.
>
> Is there a way to test this theory and fix the problem?
>
>
> Thanks,
>
>
> -C-
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com Commercial support: sales[at]bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales[at]bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>

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

Community help: http://wiki.bestpractical.com
Commercial support: sales[at]bestpractical.com


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

Request Tracker 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.