Commit 88ad8c26 authored by Julius Goryavsky's avatar Julius Goryavsky

MDEV-30686: Endless loop when trying to establish connection

With wsrep_sst_rsync, node goes into endless loop when trying
to establish connection to donor for IST/SST if the database
is bind on specific IP address, not the "*".

This commit fixes this problem. Separate tests are not
required - the problem can occur in normal configurations
on a number of systems when selecting a bing address other
than "*", especially on FreeBSD and with the IPv6 addresses.
parent 0e273510
...@@ -100,10 +100,9 @@ check_pid_and_port() ...@@ -100,10 +100,9 @@ check_pid_and_port()
local busy=0 local busy=0
if [ $lsof_available -ne 0 ]; then if [ $lsof_available -ne 0 ]; then
port_info=$(lsof -Pnl -i ":$port" 2>/dev/null | \ port_info=$(lsof -Pnl -i ":$port" 2>/dev/null | grep -F '(LISTEN)')
grep -F '(LISTEN)')
echo "$port_info" | \ echo "$port_info" | \
grep -q -E "[[:space:]](\\*|\\[?::\\]?):$port[[:space:]]" && busy=1 grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port[[:space:]]" && busy=1
else else
local filter='([^[:space:]]+[[:space:]]+){4}[^[:space:]]+' local filter='([^[:space:]]+[[:space:]]+){4}[^[:space:]]+'
if [ $sockstat_available -ne 0 ]; then if [ $sockstat_available -ne 0 ]; then
...@@ -122,7 +121,7 @@ check_pid_and_port() ...@@ -122,7 +121,7 @@ check_pid_and_port()
grep -F 'users:(' | grep -o -E "$filter") grep -F 'users:(' | grep -o -E "$filter")
fi fi
echo "$port_info" | \ echo "$port_info" | \
grep -q -E "[[:space:]](\\*|\\[?::\\]?):$port\$" && busy=1 grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port\$" && busy=1
fi fi
if [ $busy -eq 0 ]; then if [ $busy -eq 0 ]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment