Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurency issues with yourls-api.php #765

Closed
ozh opened this issue Apr 6, 2013 · 4 comments

Comments

@ozh
Copy link
Member

commented Apr 6, 2013

This is a COPY of Issue 765: Concurency issues with yourls-api.php, filed on Google Code before the project was moved on Github.

  • Submitted on 2011-04-17T02:08:21.000Z by raccettu
  • Status: Fixed

Please review the original issue and especially its comments. Comments here on closed issues will be ignored. Thanks.

Original description

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.

@ozh ozh closed this Apr 6, 2013

@fantapop

This comment has been minimized.

Copy link

commented Oct 4, 2018

@ozh I ran across this issue because I noticed this in the plugin list:

https://bitbucket.org/laceous/yourls-concurrency-fix

Do we still need to install the plugin to get the fix? Or is it handled in the core nowadays?

@dgw

This comment has been minimized.

Copy link
Member

commented Oct 4, 2018

This issue was marked "Fixed" a long time ago…

@fantapop

This comment has been minimized.

Copy link

commented Oct 4, 2018

@ozh

This comment has been minimized.

Copy link
Member Author

commented Oct 4, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.