liu4lin / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

Data race in MemcachedClient.shutdown() #238

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
2.8.0

Tell me more...
MemcachedClient.shuttingDown field is volatile but it is checked and modified 
with regular read, compare, set operations (not an atomic CAS) - data race 
possible.

This field should be AtomicBoolean and should be used like:

protected final AtomicBoolean shuttingDown = new AtomicBoolean();

public boolean shutdown() {
if (!shuttingDown.compareAndSet(false, true)) {
      getLogger().info("Suppressing duplicate attempt to shut down");
      return false;
}

Original issue reported on code.google.com by Ash2kk@gmail.com on 28 Feb 2012 at 12:06

GoogleCodeExporter commented 9 years ago

Original comment by ingen...@gmail.com on 16 Mar 2012 at 5:05