forked from percona/percona-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[plugin/group_replication] PS-8592: XCom connection stalled forever i…
…n read() syscall over network https://jira.percona.com/browse/PS-8592 Description ----------- GR suffered from problems caused by the security probes and network scanner processes connecting to the group replication communication port. This usually is not a problem, but poses a serious threat when another member tries to join the cluster by initialting a connection to the member which is affected by external processes using the port dedicated for group communication for longer durations. On such activites by external processes, the SSL enabled server stalled forever on the SSL_accept() call waiting for handshake data. Below is the stacktrace: Thread 55 (Thread 0x7f7bb77ff700 (LWP 2198598)): #0 in read () #1 in sock_read () percona#2 in BIO_read () percona#3 in ssl23_read_bytes () percona#4 in ssl23_get_client_hello () percona#5 in ssl23_accept () percona#6 in xcom_tcp_server_startup(Xcom_network_provider*) () When the server stalled in the above path forever, it prohibited other members to join the cluster resulting in the following messages on the joiner server's logs. [ERROR] [MY-011640] [Repl] Plugin group_replication reported: 'Timeout on wait for view after joining group' [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member is already leaving or joining a group.' Solution -------- This patch adds two new variables 1. group_replication_xcom_ssl_socket_timeout It is a file-descriptor level timeout in seconds for both accept() and SSL_accept() calls when group replication is listening on the xcom port. When set to a valid value, say for example 5 seconds, both accept() and SSL_accept() return after 5 seconds. The default value has been set to 0 (waits infinitely) for backward compatibility. This variable is effective only when GR is configred with SSL. 2. group_replication_xcom_ssl_accept_retries It defines the number of retries to be performed before closing the socket. For each retry the server thread calls SSL_accept() with timeout defined by the group_replication_xcom_ssl_socket_timeout for the SSL handshake process once the connection has been accepted by the first accept() call. The default value has been set to 10. This variable is effective only when GR is configred with SSL. Note: - Both of the above variables are dynamically configurable, but will become effective only on START GROUP_REPLICATION. ------------------------------------------------------------------------- PS-8844: Fix the failing main.mysqldump_gtid_purged https://jira.percona.com/browse/PS-8844 This patch fixes the test failure of main.mysqldump_gtid_purged that failed due to the uninitialized variable $redirect_stderr in the start_proc_in_background.inc. ---------------------------------------------------------------------- PS-9218: Merge MySQL 8.4.0 (fix terminology in replication tests) https://perconadev.atlassian.net/browse/PS-9218 mysql/mysql-server@44a77b5
- Loading branch information
1 parent
9fe12b4
commit 65856a5
Showing
19 changed files
with
452 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# ==== Purpose ==== | ||
# | ||
# Start process in background. Optionally store its PID in the file | ||
# | ||
# This functionality cannot be achieved by mysqltest built-in --exec_in_background | ||
# because we need to start it like: | ||
# cmd param1 param2 > output.log & echo $! > cmd.pid | ||
# | ||
# The way to pass $! through Perl to mysqltest binary is to escape $! like \$! | ||
# This will prevent attemption to resolve $! variable on Perl layer, | ||
# but will pass down \$! to mysqltest. | ||
# mysqltest handles \$! literally (recognizes that $ has been escaped | ||
# and adds escape character to the constructed command, so we end up with: | ||
# cmd param1 param2 > output.log & echo \$! > cmd.pid | ||
# | ||
# ==== Usage ==== | ||
# | ||
# --let $command = process_to_be_executed | ||
# [--let $command_opt = opt1 opt2 ...] | ||
# [--let $output_file = output_file] | ||
# [--let $pid_file = pid_file] | ||
# [--let $redirect_stderr = 0 | 1 ] | ||
# --source include/start_proc_in_backcground.inc | ||
# | ||
# Parameters: | ||
# $command | ||
# Process to be executed in background. | ||
# | ||
# $command_opt | ||
# Options to be passed to the process via command line at its startup. | ||
# | ||
# $output_file | ||
# Redirect process output to this file. | ||
# | ||
# $pid_file | ||
# Store started process PID in this file. | ||
# | ||
|
||
|
||
if (!$command) | ||
{ | ||
--die ERROR IN TEST: 'command' parameter not specified | ||
} | ||
|
||
--let $line = $command $command_opt | ||
|
||
if ($output_file) | ||
{ | ||
if ($redirect_stderr) | ||
{ | ||
--let $line = $line 2> $output_file | ||
} | ||
if (!$redirect_stderr) | ||
{ | ||
--let $line = $line > $output_file | ||
} | ||
} | ||
|
||
--let $line = $line & | ||
|
||
if ($pid_file) | ||
{ | ||
--let $line = $line echo \$! > $pid_file | ||
} | ||
|
||
--let _LINE = $line | ||
--perl | ||
my $cmd= $ENV{'_LINE'}; | ||
system("$cmd"); | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
mysql-test/suite/group_replication/r/gr_ssl_socket_timeout.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
include/group_replication.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. | ||
[connection server1] | ||
|
||
############################################################ | ||
# 1. Start one member with GCS SSL enabled. | ||
[connection server1] | ||
SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode; | ||
SET GLOBAL group_replication_ssl_mode= REQUIRED; | ||
SET @group_replication_xcom_ssl_socket_timeout_save= @@GLOBAL.group_replication_xcom_ssl_socket_timeout; | ||
SET @group_replication_xcom_ssl_accept_retries_save= @@GLOBAL.group_replication_xcom_ssl_accept_retries; | ||
SET GLOBAL group_replication_xcom_ssl_socket_timeout= 3; | ||
SET GLOBAL group_replication_xcom_ssl_accept_retries= 3; | ||
include/start_and_bootstrap_group_replication.inc | ||
Occurrences of 'Group communication SSL configuration: group_replication_ssl_mode: "REQUIRED"' in the input file: 1 | ||
|
||
############################################################ | ||
# 2. Start the second member with GCS SSL enabled, the member | ||
# will be able to join the group. | ||
[connection server2] | ||
SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode; | ||
SET GLOBAL group_replication_ssl_mode= REQUIRED; | ||
include/start_group_replication.inc | ||
include/rpl/gr_wait_for_number_of_members.inc | ||
Occurrences of 'Group communication SSL configuration: group_replication_ssl_mode: "REQUIRED"' in the input file: 1 | ||
|
||
############################################################ | ||
# 3. Verify that any connection on group_replication | ||
# communication port is aborted by the server after the | ||
# timout configured by the group_replication_xcom_ssl_socket_timeout. | ||
include/stop_group_replication.inc | ||
SET @group_replication_communication_debug_options_save = @@GLOBAL.group_replication_communication_debug_options; | ||
SET GLOBAL group_replication_communication_debug_options= "XCOM_DEBUG_BASIC"; | ||
START GROUP_REPLICATION; | ||
SET @@GLOBAL.group_replication_communication_debug_options= @group_replication_communication_debug_options_save; | ||
include/assert_grep.inc [Assert that the mysql connection has been ended by the server] | ||
include/assert_grep.inc [Assert that message about aborting the connection has been logged to GCS_DEBUG_TRACE file] | ||
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2 | ||
|
||
############################################################ | ||
# 4. Clean up. | ||
[connection server1] | ||
SET GLOBAL group_replication_ssl_mode= @group_replication_ssl_mode_save; | ||
SET GLOBAL group_replication_xcom_ssl_socket_timeout= @group_replication_xcom_ssl_socket_timeout_save; | ||
SET GLOBAL group_replication_xcom_ssl_accept_retries= @group_replication_xcom_ssl_accept_retries_save; | ||
[connection server2] | ||
SET GLOBAL group_replication_ssl_mode= @group_replication_ssl_mode_save; | ||
include/group_replication_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.