Skip to content

mysql filter fails to parse a partial mysql message #6696

@farcaller

Description

@farcaller

When faced with a fragmented packet, mysql filter fails to parse a mysql message and gives up.

The issue is reproduced with istio-1.1.3 (istio bug), by having php talk to mysql. When the mysql filter is enabled, envoy fails with:

mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.783][30][trace][filter] [external/envoy/source/extensions/filters/network/mysql_proxy/mysql_decoder.cc:140] mysql_proxy: decoding 16384 bytes at offset 16337
mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.783][30][trace][filter] [external/envoy/source/extensions/filters/network/mysql_proxy/mysql_utils.cc:149] mysql_proxy: MYSQL-hdrseq 141, len 61
mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.783][30][trace][filter] [external/envoy/source/extensions/filters/network/mysql_proxy/mysql_decoder.cc:13] mysql_proxy: parsing message, offset 16341, seq 141, len 61
mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.783][30][trace][filter] [external/envoy/source/extensions/filters/network/mysql_proxy/mysql_decoder.cc:136] mysql_proxy: msg parsed, session in state 9
mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.783][30][trace][filter] [external/envoy/source/extensions/filters/network/mysql_proxy/mysql_decoder.cc:160] mysql_proxy: offset after decoding is 16402 out of 16384
mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.783][30][trace][filter] [external/envoy/source/extensions/filters/network/mysql_proxy/mysql_decoder.cc:140] mysql_proxy: decoding 16384 bytes at offset 16402
mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.784][30][info][filter] [external/envoy/source/extensions/filters/network/mysql_proxy/mysql_filter.cc:57] mysql_proxy: decoding error: error parsing mysql packet header
mysql-5f9ff684c-nv5nc istio-proxy [2019-04-24 09:21:32.784][30][trace][filter] [external/envoy/source/common/tcp_proxy/tcp_proxy.cc:501] [C37] upstream connection received 105729 bytes, end_stream=false

after which the connection stalls and php times out.

Here's the last packet forwarded by envoy:

image

The 16402 points at the end of the last full message:

image

This PDU is split in half between the TCP packets and that, I guess, causes the mysql filter to flip out.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions