epics-base / pvAccessCPP

pvAccessCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvAccessCPP/
Other
9 stars 22 forks source link

"Invalid PVA header 16" / "Bad request ... CA 01 00 16" #135

Open mdavidsaver opened 5 years ago

mdavidsaver commented 5 years ago

Log files at SLAC have been filling up with:

Hexdump [Invalid PVA header 16, its payload buffer] size = 16 00 00 00 00 00 00 00 00 00 00 FF FF AC 1B 00 18 .... .... .... ....

Note that "header 16" is really 0x16.

Hexdump [Bad request] size = 65487 CA 01 00 16 10 00 00 00 00 00 00 00 00 00 00 00 .... .... .... .... 00 00 FF FF 86 4F 97 24 CA 01 00 03 38 00 00 00 .... .O.$ .... 8... 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .... .... .... .... 00 00 FF FF AC 1B 08 1F 97 B8 01 03 74 63 70 01 .... .... .... tcp. 00 01 00 00 00 12 51 55 41 44 3A 4C 54 55 31 3A .... ..QU AD:L TU1: 38 38 30 3A 52 4D 41 54 3A 4C 49 32 36 3A 33 31 880: RMAT :LI2 6:31 ... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .... .... .... ....

mdavidsaver commented 5 years ago

It look like somehow CMD_ORIGIN_TAG message have been getting past, or going around, the special case handling for them in BlockingUDPTransport::processBuffer() and triggering warnings in the regular server processing in ServerResponseHandler::handleResponse() and ServerBadResponse::handleResponse().

mdavidsaver commented 5 years ago

As background:

CMD_ORIGIN_TAG is part of the "local multicast hack" (my name for it). A unicast UDP message (according to it's sender) is redirected, by whichever socket happens to receive it (client or server), to 224.0.0.128 on which all local clients and servers are listening. When this happens a CMD_ORIGIN_TAG message is prepended to the packet body.

The idea (as I understand it) is to allow unicast UDP search to "just work" for hosts with multiple PVA servers, without having to manually manage TCP port numbers.

The only (as yet hypothetical) problem which I know of with this idea is that it will cause both sides of a PVA gateway to see unicast searches or beacons from either sides.

redirection on the server side:

https://github.com/epics-base/pvAccessCPP/blob/f84774e3ecd947f82a724bf3c354b817a8cb4431/src/server/responseHandlers.cpp#L290-L301

redirection on the client side:

https://github.com/epics-base/pvAccessCPP/blob/31261cee24754fd8f1cc2438d2947b535185cd85/src/remoteClient/clientContextImpl.cpp#L2661-L2677

Handling in UDP receiver common to both client and server:

https://github.com/epics-base/pvAccessCPP/blob/8d2edc0bb8a04da7f641e05790c592381288a8f8/src/remote/blockingUDPTransport.cpp#L354

mdavidsaver commented 5 years ago

https://github.com/epics-base/pvAccessCPP/blob/f84774e3ecd947f82a724bf3c354b817a8cb4431/src/server/responseHandlers.cpp#L161-L164