tags:

views:

83

answers:

1

I have probably overlooked something simple, but I have been trying to understand what is going wrong here for a few weeks and I need a fresh set of eyes.

I have a CGI application that processes Paypal Payment notifications. When someone subscribes I actually get a subscription IPN followed by a payment IPN. On is right behind the other so I two CGI processes are launched. I create a seperate log for each one and teh time stamps are identical (to the resolution of the timestamp - seconds).

The CGii application is designed to create a user account for a new subscriber and then the payment IPN adds information to the newly created account. Simple enough.

The problem is that the second IPN is not able to find the account. I assumed this is because it had finished being created at the time the second IPN went looking for it, so I delayed the second IPN by 5 seconds.

Now the timestamps show that the function that creates the account for the first IPN have returned before the second IPN begins looking for it, meaning the INSERT is complete before the first SELECT is issued. No luck.

I wondered if it was caching issue: http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html But I dont think so.

I am not using TRANSACTIONS at all here, but I have not releaase the handle for the first CGI application before the second issues its SELECT, but this should not matter. I guess I could try issuing a I have probably overlooked something simple, but I have been trying to understand what is going wrong here for a few weeks and I need a fresh set of eyes.

I have a CGI application that processes Paypal Payment notifications. When someone subscribes I actually get a subscription IPN followed by a payment IPN. On is right behind the other so I two CGI processes are launched. I create a seperate log for each one and teh time stamps are identical (to the resolution of the timestamp - seconds).

The CGii application is designed to create a user account for a new subscriber and then the payment IPN adds information to the newly created account. Simple enough.

The problem is that the second IPN is not able to find the account. I assumed this is because it had finished being created at the time the second IPN went looking for it, so I delayed the second IPN by 5 seconds.

Now the timestamps show that the function that creates the account for the first IPN have returned before the second IPN begins looking for it, meaning the INSERT is complete before the first SELECT is issued. No luck.

I wondered if it was caching issue: http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html But I dont think so.

I am not using TRANSACTIONS, but I have not tried issuing a COMMIT after the INSERT.

What am I missing here?

+1  A: 

MYISAM tables don't support transactions, so it won't be a problem there. Without any code to look at, it honestly sounds to me like your second query is using the wrong id. What are you logging besides the timestamps? I'd log the entire queries and make sure the ids correspond and that the second query is looking for the right record. Perhaps try to reproduce the situation manually using only SQL, and leave the scripts out of it while you test your queries.

zombat
Great Idea. I will try that. Thanks
Mike Trader