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-

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@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von Chris Haumesser
Gesendet: Montag, 14. April 2008 22:39
An: rt-users@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@bestpractical.com

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

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
LBNLOn 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@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von Chris Haumesser
Gesendet: Montag, 14. April 2008 22:39
An: rt-users@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-


The rt-users Archives

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

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


The rt-users Archives

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

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