[cc-devel] [ cctools-Bugs-2728181 ] Race condition in uploads

SourceForge.net noreply at sourceforge.net
Fri Apr 3 08:22:54 EDT 2009


Bugs item #2728181, was opened at 2009-04-03 14:22
Message generated for change (Tracker Item Submitted) made by mafu_
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=559966&aid=2728181&group_id=80503

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: cchost
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Markus (mafu_)
Assigned to: Victor Stone (fourstones)
Summary: Race condition in uploads

Initial Comment:
When multiple users upload media at the same time, it's possible that a race conditions occurs. The problem lies with the NextID()-method in the class CCTable , which simply gets the next available auto_increment from the database. So if two users call NextID() concurrently, they get the same ID back, but only one can insert into the database with that ID -- the other user gets a MySQL error about a duplicate entry.

We have currently fixed this with a hack, locking the required tables before the insert (in cc-uploadapi.php), but really the row should be inserted first, the ID gotten with mysql_insert_id, which can then be used in the rest of the code.

Regards

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=559966&aid=2728181&group_id=80503


More information about the cc-devel mailing list