← Back to team overview

launchpad-dev team mailing list archive

Double form submission problem


Hi folks

We had an incident on Friday where the PPA publisher fell over in a heap.  We 
tracked this down the fact that it was trying to write an OOPS report to 
somewhere it didn't have permission, which was easily fixed.

However this has revealed a separate problem which was the cause of the OOPS 
in the first place.  Apparently there were two rows in the PackageUpload table 
for the same thing which should be impossible!

I've done some sleuthing and it turns out that it was a package that was 
copied from a private PPA to a public one.  The way we do this is to create a 
PackageUpload record in the "accepted" state and then the process-accepted 
script will work out that it's a package copy rather than an upload and copy 
the files from the restricted librarian into the public one.  It also has a 
check to see if the packages files are already accepted and if they are - it 
blows up as we saw.

I managed to re-create this on dogfood, eventually, by clicking the "copy 
packages" button twice in quick succession.  If I clicked it on separate page 
loads, then the code that checks for the duplication works as it should.

Today I've tried to write a page test to re-create this by posting the form 
twice from 2 separate browsers, and I can't make it fail, the checker code 
works fine.

So, I've got 2 questions for you Foundations experts:

 1. How is this happening?
 2. How can I write a test for it?

Once these are answered I can work out how to fix it!


Follow ups