shade
shade copied to clipboard
Uncaught exception in enqueueOperation
The calls to mconn.enqueueOperation
in SpyMemcachedIntegration can throw IllegalStateException when the queue is full:
java.lang.IllegalStateException: Timed out waiting to add Cmd: 1 Opaque: 229348 Key: XXX Cas: 0 Exp: 1556244278 Flags: 0 Data Length: 0(max wait=10000ms)
at net.spy.memcached.protocol.TCPMemcachedNodeImpl.addOp(TCPMemcachedNodeImpl.java:362)
at net.spy.memcached.MemcachedConnection.addOperation(MemcachedConnection.java:1278)
at net.spy.memcached.MemcachedConnection.addOperation(MemcachedConnection.java:1240)
at net.spy.memcached.MemcachedConnection.enqueueOperation(MemcachedConnection.java:1196)
at shade.memcached.internals.SpyMemcachedIntegration.realAsyncSet(SpyMemcachedIntegration.scala:235)
at shade.memcached.MemcachedImpl.set(MemcachedImpl.scala:60)
This ends up breaking the implied contract of always returning a Future when calling set
, etc.
Oh nice find. Maybe we can wrap those queue inserts in a try {} catch {}
, maybe abstracted in another method, and on failure, fulfil the Promise
with the exception.
My "random guy on the internet" two cents would be push the call to mconn.enqueueOperation
down into prepareFuture
where this error case can be handled in a central place. It looks like every call to prepareFuture(key, op, ...)
is preceded by a call to mcomm.enqueueOperation(key, op)
.