real-logic / aeron

Efficient reliable UDP unicast, UDP multicast, and IPC message transport
https://aeron.io
Apache License 2.0
7.43k stars 892 forks source link

Mismatched endianness writing/reading log entries in aeron agent #1666

Closed fbaro closed 2 months ago

fbaro commented 2 months ago

I think there is a mismatch between writing and reading strings in log entries inside the aeron agent.

When writing strings, the length of the string is always LITTLE_ENDIAN. For example: https://github.com/real-logic/aeron/blob/d896eed6bf3bebe41d6d7eb6c8015d49bc2558e0/aeron-agent/src/main/java/io/aeron/agent/CommonEventEncoder.java#L138-L141

However, when reading strings, the endianness of the length is left unspecified. Again, for example: https://github.com/real-logic/aeron/blob/d896eed6bf3bebe41d6d7eb6c8015d49bc2558e0/aeron-agent/src/main/java/io/aeron/agent/ArchiveEventDissector.java#L537-L543

vyazelenko commented 2 months ago

The logs are written and read on the same machine. Most of the existing CPUs using little endian nowadays (see https://news.ycombinator.com/item?id=9451284).

Fixed with https://github.com/real-logic/aeron/commit/a0f21b920aa94d3b71a2bb66446047e213953d7f.