Re: Possible thread issue?

2009-12-16 Thread Leigh
> After changing/updating/fixing/etc the code now runs 100% > reliable and fast! Code put into production yesterday and > looking good! That is good to hear! -Leigh ~| Want to reach the ColdFusion community with someth

Re: Possible thread issue?

2009-12-16 Thread Andre Kapp
> I'v now come across a code problem that I simply cannot understand > what is happending here. > > > > The code is part of a cfc module that is behind a web-service. > This is not inside a loop - just a normal cfc with a function that > enter, process and returns data... > > > The prob

Re: Possible thread issue?

2009-12-08 Thread Jaime Metcher
I can't comment on whether for your app singleton is right or not. Just be aware that in CF singleton is much more common than in Java, largely due to the much higher object instantiation overhead. Jaime On Wed, Dec 9, 2009 at 3:28 PM, Andre Kapp wrote: > > Tks Leigh > > I changed all the vari

Re: Possible thread issue?

2009-12-08 Thread Andre Kapp
> > It pretty much looks like a singleton design! > > Yep. I think Jaime has it right. It looks like few (if any) of the > variables set within the DAO's functions are VAR scoped. So they will > automatically be placed in the shared "variables" scope. Since you are > working with a singleton,

Re: Possible thread issue?

2009-12-08 Thread Leigh
> but you'd have to find where > the service is instantiated to be sure.  Based on the names, I took a leap of faith that it really is what it appears to be ;-) But Jaime is right. You should verify it. -Leigh ~| Wan

Re: Possible thread issue?

2009-12-08 Thread Leigh
> It pretty much looks like a singleton design! Yep. I think Jaime has it right. It looks like few (if any) of the variables set within the DAO's functions are VAR scoped. So they will automatically be placed in the shared "variables" scope. Since you are working with a singleton, those variab

Re: Possible thread issue?

2009-12-08 Thread Jaime Metcher
Andre, Yeah, looks like singleton, but you'd have to find where the service is instantiated to be sure. Throw it back to the guys who wrote the code anyway! They should be var scoping always. Don't know about the classid. You can of course get the hashcode - see http://www.compoundtheory.com/

Re: Possible thread issue?

2009-12-08 Thread Andre Kapp
> >Andre, > > > >Is this DAO a singleton? I notice the queries aren't var scoped. If > this > >is a singleton under load another thread could easily overwrite your > >trans_insert variable in between issuing the query and logging the > generated > >key. > > > >Jaime > > > > > > > >> > Tks Jaim

Re: Possible thread issue?

2009-12-08 Thread Andre Kapp
>Andre, > >Is this DAO a singleton? I notice the queries aren't var scoped. If this >is a singleton under load another thread could easily overwrite your >trans_insert variable in between issuing the query and logging the generated >key. > >Jaime > > > >> Tks Jaime. I have traced the code back t

Re: Possible thread issue?

2009-12-08 Thread Jaime Metcher
Andre, Is this DAO a singleton? I notice the queries aren't var scoped. If this is a singleton under load another thread could easily overwrite your trans_insert variable in between issuing the query and logging the generated key. Jaime On Tue, Dec 8, 2009 at 8:58 PM, Andre Kapp wrote: > >

Re: Possible thread issue?

2009-12-08 Thread Andre Kapp
Ok - changed the pk id field returned to the following: Still the same issue. Here is the complete cfc module sorry for it being a bit long...

Re: Possible thread issue?

2009-12-07 Thread Andre Kapp
Tks for all the feedback so far. The problem is that the ID is returned correctly in the first place(first cflog), but when the variable is referenced later on in the code, it has changed (second cflog)! The total big picture is: One CF server running a program that generates 10 threads. Thes

Re: Possible thread issue?

2009-12-07 Thread Dave Watts
> The ID that was generated is maintained in the server on a per-connection > basis. This means that the value returned by the > function to a given client is the first AUTO_INCREMENT value generated for > most recent statement affecting an > AUTO_INCREMENT column by that client. This value cann

Re: Possible thread issue?

2009-12-07 Thread Dave Watts
> A single request won't necessarily keep the same connection, especially > under load.  So unless you use a transaction, it's entirely possible for the > insert query to run on one connection, and the select last_insert_id() to > run on another connection. See http://lagod.id.au/blog/?p=41 If yo

Re: Possible thread issue?

2009-12-07 Thread Andrew Grosset
thanks Jaime, I'll make sure that I use cftransaction. Andrew. >Andrew G, > >But...:) > >A single request won't necessarily keep the same connection, especially >under load. So unless you use a transaction, it's entirely possible for the >insert query to run on one connection, and the select la

Re: Possible thread issue?

2009-12-07 Thread Jaime Metcher
Andrew G, But...:) A single request won't necessarily keep the same connection, especially under load. So unless you use a transaction, it's entirely possible for the insert query to run on one connection, and the select last_insert_id() to run on another connection. See http://lagod.id.au/blog

Re: Possible thread issue?

2009-12-07 Thread Jaime Metcher
Andrew, I can't help thinking the code you haven't shown is important. Are you creating a CF thread? And are any of your variables in shared scopes? Transactions and threads don't necessarily work the way you might expect. There are lots of possibilites for cross-talk between threads, connectio

Re: Possible thread issue?

2009-12-07 Thread Andrew Grosset
maybe not (wrong)... The ID that was generated is maintained in the server on a per-connection basis. This means that the value returned by the function to a given client is the first AUTO_INCREMENT value generated for most recent statement affecting an AUTO_INCREMENT column by that client. Th

Re: Possible thread issue?

2009-12-07 Thread Dave Watts
> I was under the impression that Last_Insert_ID() in MySQL was the equilavent > of Scope_Identity() in MSSQL.please correct me > if I'm wrong. You're wrong, I think. From the MySQL docs: "For LAST_INSERT_ID(), the most recently generated ID is maintained in the server on a per-connection b

Re: Possible thread issue?

2009-12-07 Thread Andrew Grosset
I was under the impression that Last_Insert_ID() in MySQL was the equilavent of Scope_Identity() in MSSQL.please correct me if I'm wrong. Andrew. > Last_insert_id does just that, gets the last inserted id. > No matter who entered it. > This means that under intense traffic, that select may

RE: Possible thread issue?

2009-12-07 Thread William Seiter
Last_insert_id does just that, gets the last inserted id. No matter who entered it. This means that under intense traffic, that select may not return the id associated with that transactions action. You should find the mysql equivalent to ScopeIdentity() Or if you are using a newer version of c