Details
-
Bug
-
Resolution: Done
-
Major
-
JDG 7.0.0 ER2
-
None
Description
Seems that removeListener doesn't work properly in case of removing the listener from one of the cluster nodes. i.e. the listener is not removed.
You can find the tests for listeners for clusters implemented here:
https://github.com/andyuk1986/js-client/blob/ISPN-6381/spec/infinispan_cluster_spec.js#L337
The "Infinispan cluster client can listen for create/modified/remove events in same listener" test is executed after "Infinispan cluster client can listen for create/modified/remove events in distinct listeners" test, and fails with the following message:
Expected 'listen-same' to be 'listen-distinct'. Stacktrace: Error: Expected 'listen-same' to be 'listen-distinct'. at EventEmitter.<anonymous> (/home/amanukya/Documents/Red Hat Workspace/js-client/spec/utils/testing.js:243:26) at EventEmitter.emit (events.js:106:17) at emitKeyVersion (/home/amanukya/Documents/Red Hat Workspace/js-client/lib/protocols.js:439:29) at /home/amanukya/Documents/Red Hat Workspace/js-client/lib/protocols.js:427:18 at Function.<anonymous> (/home/amanukya/Documents/Red Hat Workspace/js-client/lib/functional.js:185:16) at /home/amanukya/Documents/Red Hat Workspace/js-client/lib/functional.js:173:19 at ListenersMixin.decodeEvent (/home/amanukya/Documents/Red Hat Workspace/js-client/lib/protocols.js:496:18) at Socket.onData (/home/amanukya/Documents/Red Hat Workspace/js-client/lib/io.js:90:38)
which means that the listener from the previous execution was not removed completely.
Also I can see from the logs the following:
[2016-04-09 20:31:13.509] [DEBUG] client - Invoke removeListener(msgId=320,listenerId=listener_313) remotely [2016-04-09 20:31:13.509] [TRACE] encoder - Encode operation with topology id 4 [2016-04-09 20:31:13.509] [TRACE] transport - Write buffer(msgId=320) to 127.0.0.1:11522 [2016-04-09 20:31:13.510] [TRACE] decoder - Read header(msgId=320): opCode=40, status=1, hasNewTopology=0 [2016-04-09 20:31:13.510] [TRACE] decoder - Call decode for request(msgId=320) [2016-04-09 20:31:13.510] [TRACE] connection - After decoding request(msgId=320), buffer size is 6, and offset 6 [2016-04-09 20:31:13.510] [TRACE] connection - Complete success for request(msgId=320) with false
If I compare this logs with the ones for the local execution, there I see the following:
[2016-04-09 20:33:33.611] [DEBUG] client - Invoke removeListener(msgId=135,listenerId=listener_134) remotely [2016-04-09 20:33:33.611] [TRACE] encoder - Encode operation with topology id 0 [2016-04-09 20:33:33.612] [TRACE] transport - Write buffer(msgId=135) to 127.0.0.1:11222 [2016-04-09 20:33:33.612] [TRACE] listener - Event emitted [2016-04-09 20:33:33.612] [TRACE] connection - After decoding request(msgId=32), buffer size is 43, and offset 43 [2016-04-09 20:33:33.612] [TRACE] decoder - Read header(msgId=133): opCode=38, status=0, hasNewTopology=0 [2016-04-09 20:33:33.612] [TRACE] decoder - Call decode for request(msgId=133) [2016-04-09 20:33:33.612] [TRACE] connection - After decoding request(msgId=133), buffer size is 6, and offset 6 [2016-04-09 20:33:33.612] [TRACE] connection - Complete success for request(msgId=133) with true [2016-04-09 20:33:33.613] [TRACE] decoder - Read header(msgId=135): opCode=40, status=0, hasNewTopology=0 [2016-04-09 20:33:33.613] [TRACE] decoder - Call decode for request(msgId=135) [2016-04-09 20:33:33.613] [TRACE] connection - After decoding request(msgId=135), buffer size is 6, and offset 6 [2016-04-09 20:33:33.614] [TRACE] connection - Complete success for request(msgId=135) with true
As you can see, in case of the clustered execution, the removeListener was completed with false (that's why I assume that the listener is not removed).
Please correct me if I am wrong.