roc230 / spymemcached

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

Get canceled #208

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
spy version: 2.7
os: ubuntu

I'm using the regular get(String) function and this happened:

java.io.IOException: Disconnected unexpected, will reconnect.
    at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:484)
    at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:425)
    at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:278)
    at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1981)
2011-09-30 22:06:00.288 WARN net.spy.memcached.MemcachedConnection:  Closing, 
and reopening {QA sa=address:22133, #Rops=1, #Wops=0, #iq=0, 
topRop=net.spy.memcached.protocol.ascii.GetOperationImpl@b38dba, topWop=null, 
toWrite=0, interested=1}, attempt 0.
2011-09-30 22:06:00.289 WARN 
net.spy.memcached.protocol.ascii.AsciiMemcachedNodeImpl:  Discarding partially 
completed op: net.spy.memcached.protocol.ascii.GetOperationImpl@b38dba
Exception in thread "Thread-5" java.lang.RuntimeException: Exception waiting 
for value
    at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1140)
    at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1157)
    at org.myapp.search.Kestrel.get(Kestrel.java:93)
    at org.myapp.search.KestrelReader.run(KestrelReader.java:196)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: 
Cancelled
    at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:75)
    at net.spy.memcached.internal.GetFuture.get(GetFuture.java:37)
    at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1135)
    ... 3 more
Caused by: java.lang.RuntimeException: Cancelled
    ... 6 more
2011-09-30 22:06:02.297 INFO net.spy.memcached.MemcachedConnection:  
Reconnecting {QA sa=address:22133, #Rops=0, #Wops=0, #iq=0, topRop=null, 
topWop=null, toWrite=0, interested=0}
2011-09-30 22:06:02.299 INFO net.spy.memcached.MemcachedConnection:  Connection 
state changed for sun.nio.ch.SelectionKeyImpl@150818a
2011-09-30 22:06:02.299 INFO net.spy.memcached.MemcachedConnection:  
Reconnecting due to failure to connect to {QA sa=address:22133, #Rops=0, 
#Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
    at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:414)
    at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:278)
    at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1981)
2011-09-30 22:06:02.299 WARN net.spy.memcached.MemcachedConnection:  Closing, 
and reopening {QA sa=address:22133, #Rops=0, #Wops=0, #iq=0, topRop=null, 
topWop=null, toWrite=0, interested=0}, attempt 1.

A regular restart of the entire app connected successfully. Should I switch to 
asyncGet to get rid of this issue until fixing?

Original issue reported on code.google.com by caraman.mihai@gmail.com on 2 Oct 2011 at 7:48

GoogleCodeExporter commented 9 years ago
This doesn't look like an error. Your get operation was cancelled because the 
client got disconnected from the server. Also, the get function just calls 
asyncGet() and calls get() on the Future that is returned so if there is an 
issue here calling asyncGet() over get() won't help you.

Can you provide more detail on the problem if you still think there is an issue 
with the client.

Original comment by mikewie...@gmail.com on 4 Oct 2011 at 5:36

GoogleCodeExporter commented 9 years ago
hmmm.. it's weird that it couldn't reconnect until I restarted the entire app. 
It kept repeating that same step. Have any ideea why?

Original comment by caraman.mihai@gmail.com on 4 Oct 2011 at 5:44

GoogleCodeExporter commented 9 years ago
I think I misinterpreted the error you were trying to communicate. Is the issue 
that when the client gets disconnected from the server it is unable to connect? 
If so this is something I will look into because that shouldn't happen.

Can you tell me what you are doing in your application code?

Original comment by mikewie...@gmail.com on 6 Oct 2011 at 6:59

GoogleCodeExporter commented 9 years ago
I opened 3 clients (each with another server) and used a weighted roundrobin 
distribution on them for setting, but mostly for getting. It tried a 'get' 
every one second.It got about 30 items per min. When this error appeared, It 
kept trying to reconnect until i restarted it. The detail that i don't missed 
to remember is if it tried to reconnect for one or for all servers(but I think 
it was for the server that was next to be read). I switched to gwhalin's 
version because of failover and failbacks. All the best. Mihai

Original comment by caraman.mihai@gmail.com on 7 Oct 2011 at 7:36

GoogleCodeExporter commented 9 years ago
We're pretty confident reconnection works, it's in our automated test suite and 
we've tested with a similar client.  There were a couple minor thread safety 
issues fixed recently.  As best I can tell, it may have been one of those.  

If there's any more info available, please let us know.

Original comment by ingen...@gmail.com on 16 Oct 2011 at 1:52