[cc-devel] [ cctools-Bugs-2728181 ] Race condition in uploads
SourceForge.net
noreply at sourceforge.net
Wed Apr 22 18:23:13 EDT 2009
Bugs item #2728181, was opened at 2009-04-03 05:22
Message generated for change (Comment added) made by fourstones
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: Fixed
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
----------------------------------------------------------------------
>Comment By: Victor Stone (fourstones)
Date: 2009-04-22 15:23
Message:
checked in svn #12354
----------------------------------------------------------------------
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