mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
Catch and report aborted connects.
This commit is contained in:
@@ -3132,6 +3132,18 @@ sub parse_event {
|
||||
if ( $packet->{data_len} == 0 ) {
|
||||
PTDEBUG && _d('TCP control:',
|
||||
map { uc $_ } grep { $packet->{$_} } qw(syn ack fin rst));
|
||||
if ( $packet->{'fin'}
|
||||
&& ($session->{state} || '') eq 'server_handshake' ) {
|
||||
PTDEBUG && _d('Client aborted connection');
|
||||
my $event = {
|
||||
cmd => 'Admin',
|
||||
arg => 'administrator command: Connect aborted',
|
||||
ts => $packet->{ts},
|
||||
};
|
||||
$event = $self->_make_event($event, $packet, $session);
|
||||
delete $self->{sessions}->{$session->{client}};
|
||||
return $event;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -340,6 +340,18 @@ sub parse_event {
|
||||
if ( $packet->{data_len} == 0 ) {
|
||||
PTDEBUG && _d('TCP control:',
|
||||
map { uc $_ } grep { $packet->{$_} } qw(syn ack fin rst));
|
||||
if ( $packet->{'fin'}
|
||||
&& ($session->{state} || '') eq 'server_handshake' ) {
|
||||
PTDEBUG && _d('Client aborted connection');
|
||||
my $event = {
|
||||
cmd => 'Admin',
|
||||
arg => 'administrator command: Connect aborted',
|
||||
ts => $packet->{ts},
|
||||
};
|
||||
$event = $self->_make_event($event, $packet, $session);
|
||||
delete $self->{sessions}->{$session->{client}};
|
||||
return $event;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -1709,6 +1709,7 @@ $protocol = new MySQLProtocolParser(
|
||||
server => '127.0.0.1',
|
||||
port => '12345',
|
||||
);
|
||||
|
||||
test_protocol_parser(
|
||||
parser => $tcpdump,
|
||||
protocol => $protocol,
|
||||
@@ -1744,7 +1745,59 @@ test_protocol_parser(
|
||||
protocol => $protocol,
|
||||
file => "$sample/tcpdump042.txt",
|
||||
desc => 'Client went away during handshake',
|
||||
result => [],
|
||||
result => [
|
||||
{
|
||||
Error_no => 'none',
|
||||
No_good_index_used => 'No',
|
||||
No_index_used => 'No',
|
||||
Query_time => '9.998411',
|
||||
Rows_affected => 0,
|
||||
Thread_id => 24,
|
||||
Warning_count => 0,
|
||||
arg => 'administrator command: Connect aborted',
|
||||
bytes => 38,
|
||||
cmd => 'Admin',
|
||||
db => undef,
|
||||
host => '127.0.0.1',
|
||||
ip => '127.0.0.1',
|
||||
port => '62133',
|
||||
pos_in_log => undef,
|
||||
ts => '130124 12:55:48.274417',
|
||||
user => undef,
|
||||
}
|
||||
],
|
||||
);
|
||||
|
||||
$protocol = new MySQLProtocolParser(
|
||||
server => '100.0.0.1',
|
||||
);
|
||||
|
||||
test_protocol_parser(
|
||||
parser => $tcpdump,
|
||||
protocol => $protocol,
|
||||
file => "$sample/tcpdump044.txt",
|
||||
desc => 'Client aborted connection (bug 1103045)',
|
||||
result => [
|
||||
{
|
||||
Error_no => 'none',
|
||||
No_good_index_used => 'No',
|
||||
No_index_used => 'No',
|
||||
Query_time => '3.819507',
|
||||
Rows_affected => 0,
|
||||
Thread_id => 13,
|
||||
Warning_count => 0,
|
||||
arg => 'administrator command: Connect aborted',
|
||||
bytes => 38,
|
||||
cmd => 'Admin',
|
||||
db => undef,
|
||||
host => '100.0.0.2',
|
||||
ip => '100.0.0.2',
|
||||
port => '44432',
|
||||
pos_in_log => undef,
|
||||
ts => '130122 09:55:57.793375',
|
||||
user => undef,
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
|
70
t/lib/samples/tcpdump/tcpdump044.txt
Normal file
70
t/lib/samples/tcpdump/tcpdump044.txt
Normal file
@@ -0,0 +1,70 @@
|
||||
2013-01-22 09:55:53.973868 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
|
||||
0x0000: 4510 003c bbae 4000 4006 f033 0a1c bd48
|
||||
0x0010: 0a1c bd49 ad90 0cea af89 ab81 0000 0000
|
||||
0x0020: a002 16d0 f7a5 0000 0204 05b4 0402 080a
|
||||
0x0030: 850b 102f 0000 0000 0103 0307
|
||||
2013-01-22 09:55:53.973885 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
|
||||
0x0000: 4500 003c 0000 4000 4006 abf2 0a1c bd49
|
||||
0x0010: 0a1c bd48 0cea ad90 bcdd 5ddd af89 ab82
|
||||
0x0020: a012 16a0 e720 0000 0204 05b4 0402 080a
|
||||
0x0030: 7a96 7b52 850b 102f 0103 0307
|
||||
2013-01-22 09:55:53.973886 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
|
||||
0x0000: 4500 003c 0000 4000 4006 abf2 0a1c bd49
|
||||
0x0010: 0a1c bd48 0cea ad90 bcdd 5ddd af89 ab82
|
||||
0x0020: a012 16a0 e720 0000 0204 05b4 0402 080a
|
||||
0x0030: 7a96 7b52 850b 102f 0103 0307
|
||||
2013-01-22 09:55:53.973929 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
|
||||
0x0000: 4510 0034 bbaf 4000 4006 f03a 0a1c bd48
|
||||
0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5dde
|
||||
0x0020: 8010 002e 2c5f 0000 0101 080a 850b 102f
|
||||
0x0030: 7a96 7b52
|
||||
2013-01-22 09:55:53.974017 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 113
|
||||
0x0000: 4508 00a5 268c 4000 4006 84f5 0a1c bd49
|
||||
0x0010: 0a1c bd48 0cea ad90 bcdd 5dde af89 ab82
|
||||
0x0020: 8018 002e 8f61 0000 0101 080a 7a96 7b52
|
||||
0x0030: 850b 102f 6d00 0000 0a35 2e35 2e32 382d
|
||||
0x0040: 656e 7465 7270 7269 7365 2d63 6f6d 6d65
|
||||
0x0050: 7263 6961 6c2d 6164 7661 6e63 6564 2d6c
|
||||
0x0060: 6f67 000d 0000 006c 706d 5338 5d4a 3c00
|
||||
0x0070: fff7 0802 000f 8015 0000 0000 0000 0000
|
||||
0x0080: 0000 2f72 7265 247e 7347 4565 4f3c 006d
|
||||
0x0090: 7973 716c 5f6e 6174 6976 655f 7061 7373
|
||||
0x00a0: 776f 7264 00
|
||||
2013-01-22 09:55:53.974019 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 113
|
||||
0x0000: 4508 00a5 268c 4000 4006 84f5 0a1c bd49
|
||||
0x0010: 0a1c bd48 0cea ad90 bcdd 5dde af89 ab82
|
||||
0x0020: 8018 002e 8f61 0000 0101 080a 7a96 7b52
|
||||
0x0030: 850b 102f 6d00 0000 0a35 2e35 2e32 382d
|
||||
0x0040: 656e 7465 7270 7269 7365 2d63 6f6d 6d65
|
||||
0x0050: 7263 6961 6c2d 6164 7661 6e63 6564 2d6c
|
||||
0x0060: 6f67 000d 0000 006c 706d 5338 5d4a 3c00
|
||||
0x0070: fff7 0802 000f 8015 0000 0000 0000 0000
|
||||
0x0080: 0000 2f72 7265 247e 7347 4565 4f3c 006d
|
||||
0x0090: 7973 716c 5f6e 6174 6976 655f 7061 7373
|
||||
0x00a0: 776f 7264 00
|
||||
2013-01-22 09:55:53.974064 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
|
||||
0x0000: 4510 0034 bbb0 4000 4006 f039 0a1c bd48
|
||||
0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5e4f
|
||||
0x0020: 8010 002e 2bee 0000 0101 080a 850b 102f
|
||||
0x0030: 7a96 7b52
|
||||
2013-01-22 09:55:57.793375 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
|
||||
0x0000: 4510 0034 bbb1 4000 4006 f038 0a1c bd48
|
||||
0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5e4f
|
||||
0x0020: 8011 002e 1d02 0000 0101 080a 850b 1f1a
|
||||
0x0030: 7a96 7b52
|
||||
2013-01-22 09:55:57.793485 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
|
||||
0x0000: 4508 0034 268d 4000 4006 8565 0a1c bd49
|
||||
0x0010: 0a1c bd48 0cea ad90 bcdd 5e4f af89 ab83
|
||||
0x0020: 8011 002e 0e16 0000 0101 080a 7a96 8a3d
|
||||
0x0030: 850b 1f1a
|
||||
2013-01-22 09:55:57.793489 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
|
||||
0x0000: 4508 0034 268d 4000 4006 8565 0a1c bd49
|
||||
0x0010: 0a1c bd48 0cea ad90 bcdd 5e4f af89 ab83
|
||||
0x0020: 8011 002e 0e16 0000 0101 080a 7a96 8a3d
|
||||
0x0030: 850b 1f1a
|
||||
2013-01-22 09:55:57.793529 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
|
||||
0x0000: 4510 0034 bbb2 4000 4006 f037 0a1c bd48
|
||||
0x0010: 0a1c bd49 ad90 0cea af89 ab83 bcdd 5e50
|
||||
0x0020: 8010 002e 0e15 0000 0101 080a 850b 1f1b
|
||||
0x0030: 7a96 8a3d
|
||||
|
@@ -90,6 +90,16 @@ ok(
|
||||
'Analysis for tcpdump043 with connection error (bug 1103045)'
|
||||
);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(@args, $sample.'tcpdump044.txt',
|
||||
'--report-format', 'header,query_report,profile',
|
||||
qw(--watch-server 100.0.0.1)) },
|
||||
"t/pt-query-digest/samples/tcpdump044_report.txt"
|
||||
),
|
||||
'Analysis for tcpdump044 with connection error (bug 1103045)'
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
40
t/pt-query-digest/samples/tcpdump044_report.txt
Normal file
40
t/pt-query-digest/samples/tcpdump044_report.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
# Overall: 1 total, 1 unique, 0 QPS, 0x concurrency ______________________
|
||||
# Time range: all events occurred at 2013-01-22 09:55:57.793375
|
||||
# Attribute total min max avg 95% stddev median
|
||||
# ============ ======= ======= ======= ======= ======= ======= =======
|
||||
# Exec time 4s 4s 4s 4s 4s 0 4s
|
||||
# Rows affecte 0 0 0 0 0 0 0
|
||||
# Query size 38 38 38 38 38 0 38
|
||||
# Warning coun 0 0 0 0 0 0 0
|
||||
|
||||
# Query 1: 0 QPS, 0x concurrency, ID 0x1AE4CFF32EE9545A at byte 0 ________
|
||||
# This item is included in the report because it matches --limit.
|
||||
# Scores: Apdex = 0.50 [1.0]*, V/M = 0.00
|
||||
# Query_time sparkline: | ^ |
|
||||
# Time range: all events occurred at 2013-01-22 09:55:57.793375
|
||||
# Attribute pct total min max avg 95% stddev median
|
||||
# ============ === ======= ======= ======= ======= ======= ======= =======
|
||||
# Count 100 1
|
||||
# Exec time 100 4s 4s 4s 4s 4s 0 4s
|
||||
# Rows affecte 0 0 0 0 0 0 0 0
|
||||
# Query size 100 38 38 38 38 38 0 38
|
||||
# Warning coun 0 0 0 0 0 0 0 0
|
||||
# String:
|
||||
# Errors none
|
||||
# Hosts 100.0.0.2
|
||||
# Query_time distribution
|
||||
# 1us
|
||||
# 10us
|
||||
# 100us
|
||||
# 1ms
|
||||
# 10ms
|
||||
# 100ms
|
||||
# 1s ################################################################
|
||||
# 10s+
|
||||
administrator command: Connect aborted\G
|
||||
|
||||
# Profile
|
||||
# Rank Query ID Response time Calls R/Call Apdx V/M Item
|
||||
# ==== ================== ============= ===== ====== ==== ===== ==========
|
||||
# 1 0x1AE4CFF32EE9545A 3.8195 100.0% 1 3.8195 0.50 0.00 ADMIN CONNECT ABORTED
|
Reference in New Issue
Block a user