Please review the original issue and especially its comments. Comments here on closed issues will be ignored. Thanks.
So I've got a script that hits yourls API to get a short url. The script has basic caching to help prevent multiple API hits, however until the first one resolves, it will keep firing off API requests since it has nothing to serve until the cache is primed.
The result here is that if the yourls API is hit quickly with the same URL, you can have duplicate entries. In my case a dozen for the same exact URL. The correct behavior is 1 short url per URL. The rest should return the original URL. This works correctly when it doesn't happen so quickly.
The reason is that the write operation isn't instant, so if multiple requests are fired before it's written, the duplicate 'exists' check is still false.
I think a temporary table, lock file or some other faster mechanism is needed to help prevent this concurrency issue. Otherwise anyone with API access can make a real mess out of the database. I accidentally ran across this and ended up making about 1k bogus short url's. Thankfully I could figure out what they were and delete them pretty easily and restore my next_id.
The text was updated successfully, but these errors were encountered:
This issue being marked as fixed makes me think it was merged in to core
but seeing the add on for the fix in the list of plugins made me question
that. It sounds like it is merged in and I don’t need to enable a special
plugin to get the fixed behavior. Thanks.
Think of it the other way round : do you notice anything with your setup that makes you think you need something special regarding concurrency? Anyway this issue has been open in 2011, chances are the codebase is now very different from back then.