JgroupsMessageParser and tunnel - should it work?

23 views
Skip to first unread message

Nikolaos Siafakas

unread,
May 3, 2023, 2:29:04 PM5/3/23
to jgroups-dev
Hi, trying to do a bit of debugging and using JgroupsMessageParser to read messages that go over TUNNEL. 

It usually works,  but not for things on the tunnel.  That is, I'm doing the "tshark -i en0  -Tfields -edata  tcp and port 12001  and host 1.2.3.4  > f.dump"  bit   and then JgroupsMessageParser -tcp  -parse-discovery-responses true -show-views true -file ff.dump

It does end up with 
java.lang.NullPointerException
at org.jgroups.DefaultMessageFactory.create(DefaultMessageFactory.java:31)
at org.jgroups.util.Util.readMessage(Util.java:1370)
at org.jgroups.util.Util.parse(Util.java:1557)
at ..... JgroupsMessageParser.parse(JgroupsMessageParser.java:45)
at......JgroupsMessageParser$InnerParseMessages.parse(JgroupsMessageParser.java:159)

the conf is 
<stack name="relay-global" extends="tcp">
            <TUNNEL
                gossip_router_hosts="1.2.3.4[12001]"
                external_addr="${infinispan.external.addr:}"
                port_range="0"
                stack.combine="REPLACE" stack.position="TCP"/>
            />
 </stack>

Bug or TUNNEL not supported? 

Many thanks, 
Nik

Bela Ban

unread,
May 4, 2023, 2:12:01 AM5/4/23
to jgrou...@googlegroups.com
Hi Nik

unfortunately, this won't work: the client (RouterStub) wraps messages
(REGISTER,UNREGISTER,MESSAGE etc) into GossipData, which is then sent to
GossipRouter.

GossipData.writeTo() looks as follows:

public void writeTo(DataOutput out) throws IOException {
out.writeByte(type.ordinal());
Bits.writeString(group, out);
Util.writeAddress(addr, out);
Util.writeAddress(sender, out);

if(type != GossipType.MESSAGE) {
Bits.writeString(logical_name, out);
out.writeShort(ping_data != null? ping_data.size() : 0);
if(ping_data != null)
for(PingData data : ping_data)
data.writeTo(out);

Util.writeAddress(physical_addr, out);
}

out.writeInt(buffer != null? length : 0);
if(buffer != null)
out.write(buffer, offset, length);
}


So we would have to start parsing not at index 0, but at index 1 +
Bits.size(group) + Util.size(addr) + Util.size(sender).

The problem is that this index is not constant, but type, group, addr
and sender have to be read before the real data can be read.

This is not a bug, but a missing feature... :-) I added support for it: [1]
Cheers

[1] https://issues.redhat.com/browse/JGRP-2694
> --
> You received this message because you are subscribed to the Google
> Groups "jgroups-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jgroups-dev...@googlegroups.com
> <mailto:jgroups-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jgroups-dev/fcb8b3db-5525-46f7-be6e-f3ff3ed1900bn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-dev/fcb8b3db-5525-46f7-be6e-f3ff3ed1900bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Bela Ban | http://www.jgroups.org

Bela Ban

unread,
May 4, 2023, 3:09:01 AM5/4/23
to jgrou...@googlegroups.com
I fixed JGRP-2694, the output should look like:
[belasmacmini] /Users/bela$ jt ParseMessages -file ./dump.txt
-binary-to-ascii true -tcp -show-views true -gossip
-- gossip: REGISTER(group=chat,
addr=3d6c8383-4248-4a25-9737-80bb894fd621, logical_name=A,
physical_addr=10.3.3.3:64709)
1: [A to <all>, 33 bytes, flags=OOB|DONT_BUNDLE], hdrs: PING:
[GET_MBRS_REQ cluster=chat initial_discovery=true], TP: [cluster=chat]
2: [A to <all>, 33 bytes, flags=OOB|DONT_BUNDLE], hdrs: PING:
[GET_MBRS_REQ cluster=chat initial_discovery=true], TP: [cluster=chat]
3: [A to <all>, 23 bytes, flags=OOB|NO_RELIABILITY], obj: A: [0 (0)],
hdrs: STABLE: [STABILITY] view-id= [A|0], TP: [cluster=chat]
4: [A to <all>, 23 bytes, flags=OOB|NO_RELIABILITY], obj: A: [0 (0)],
hdrs: STABLE: [STABILITY] view-id= [A|0], TP: [cluster=chat]
5: [A to <all>, 15 bytes, flags=SERIALIZED], obj: helleo, hdrs: NAKACK2:
[MSG, seqno=1], TP: [cluster=chat]
6: [A to <all>, 15 bytes, flags=SERIALIZED], obj: helleo, hdrs: NAKACK2:
[MSG, seqno=1], TP: [cluster=chat]
7: [A to <all>, 0 bytes, flags=OOB], hdrs: NAKACK2: [HIGHEST_SEQNO,
seqno=1], TP: [cluster=chat]
8: [A to <all>, 0 bytes, flags=OOB], hdrs: NAKACK2: [HIGHEST_SEQNO,
seqno=1], TP: [cluster=chat]
9: [A to <all>, 14 bytes, flags=SERIALIZED], obj: world, hdrs: NAKACK2:
[MSG, seqno=2], TP: [cluster=chat]
10: [A to <all>, 14 bytes, flags=SERIALIZED], obj: world, hdrs: NAKACK2:
[MSG, seqno=2], TP: [cluster=chat]
11: [A to <all>, 0 bytes], hdrs: MERGE3: INFO: view_id=[A|0],
logical_name=A, physical_addr=10.3.3.3:64709, TP: [cluster=chat]
12: [A to <all>, 0 bytes], hdrs: MERGE3: INFO: view_id=[A|0],
logical_name=A, physical_addr=10.3.3.3:64709, TP: [cluster=chat]
13: [A to <all>, 0 bytes, flags=OOB], hdrs: NAKACK2: [HIGHEST_SEQNO,
seqno=2], TP: [cluster=chat]
14: [A to <all>, 0 bytes, flags=OOB], hdrs: NAKACK2: [HIGHEST_SEQNO,
seqno=2], TP: [cluster=chat]
-- gossip: REGISTER(group=chat,
addr=545812c4-19ca-4002-b5fb-9b95a982b245, logical_name=B,
physical_addr=10.3.3.3:50977)
15: [B to <all>, 33 bytes, flags=OOB|DONT_BUNDLE], hdrs: PING:
[GET_MBRS_REQ cluster=chat initial_discovery=true], TP: [cluster=chat]
16: [B to <all>, 33 bytes, flags=OOB|DONT_BUNDLE], hdrs: PING:
[GET_MBRS_REQ cluster=chat initial_discovery=true], TP: [cluster=chat]
17: [B to <all>, 33 bytes, flags=OOB|DONT_BUNDLE], hdrs: PING:
[GET_MBRS_REQ cluster=chat initial_discovery=true], TP: [cluster=chat]
18: [A to B, 33 bytes, flags=OOB|DONT_BUNDLE], hdrs: PING: [GET_MBRS_RSP
cluster=null initial_discovery=false], TP: [cluster=chat]
19: [A to B, 33 bytes, flags=OOB|DONT_BUNDLE], hdrs: PING: [GET_MBRS_RSP
cluster=null initial_discovery=false], TP: [cluster=chat]
...


Cheers

On 03.05.23 20:29, Nikolaos Siafakas wrote:

Nikolaos Siafakas

unread,
May 4, 2023, 3:19:00 AM5/4/23
to jgroups-dev
That was scary fast :) Thanks Bela. 

Bela Ban

unread,
May 4, 2023, 3:19:35 AM5/4/23
to jgrou...@googlegroups.com


On 04.05.23 09:19, Nikolaos Siafakas wrote:
> That was scary fast :) Thanks Bela.

You're welcome! :-)


> On Thursday, May 4, 2023 at 8:09:01 AM UTC+1 Bela Ban wrote:
>
> I fixed JGRP-2694, the output should look like:
> [belasmacmini] /Users/bela$ jt ParseMessages -file ./dump.txt
> -binary-to-ascii true -tcp -show-views true -gossip
> -- gossip: REGISTER(group=chat,
> addr=3d6c8383-4248-4a25-9737-80bb894fd621, logical_name=A,
> physical_addr=10.3.3.3:64709 <http://10.3.3.3:64709>)
> <http://10.3.3.3:64709>, TP: [cluster=chat]
> 12: [A to <all>, 0 bytes], hdrs: MERGE3: INFO: view_id=[A|0],
> logical_name=A, physical_addr=10.3.3.3:64709
> <http://10.3.3.3:64709>, TP: [cluster=chat]
> 13: [A to <all>, 0 bytes, flags=OOB], hdrs: NAKACK2: [HIGHEST_SEQNO,
> seqno=2], TP: [cluster=chat]
> 14: [A to <all>, 0 bytes, flags=OOB], hdrs: NAKACK2: [HIGHEST_SEQNO,
> seqno=2], TP: [cluster=chat]
> -- gossip: REGISTER(group=chat,
> addr=545812c4-19ca-4002-b5fb-9b95a982b245, logical_name=B,
> physical_addr=10.3.3.3:50977 <http://10.3.3.3:50977>)
> https://groups.google.com/d/msgid/jgroups-dev/fcb8b3db-5525-46f7-be6e-f3ff3ed1900bn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-dev/fcb8b3db-5525-46f7-be6e-f3ff3ed1900bn%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-dev/fcb8b3db-5525-46f7-be6e-f3ff3ed1900bn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-dev/fcb8b3db-5525-46f7-be6e-f3ff3ed1900bn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
>
> --
> You received this message because you are subscribed to the Google
> Groups "jgroups-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jgroups-dev...@googlegroups.com
> <mailto:jgroups-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jgroups-dev/1db5c73a-95f9-4033-988c-a9593dada57cn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-dev/1db5c73a-95f9-4033-988c-a9593dada57cn%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages