Bug #98106 .net core centos 7 MySqlConnection time out socket not close
Submitted: 2 Jan 2020 3:36 Modified: 8 Feb 2020 6:24
Reporter: SunFei Sun Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:8.0.18 OS:Any
Assigned to: CPU Architecture:Any
Tags: MySqlConnection time out socket not close

[2 Jan 2020 3:36] SunFei Sun
Description:
.net core centos 7 MySqlConnection time out  socket not close

[root@test63 ~]# strace -p 10554
strace: Process 10554 attached
restart_syscall(<... resuming interrupted futex ...>) = -1 ETIMEDOUT (Connection timed out)
futex(0x11213f0, FUTEX_WAKE_PRIVATE, 1) = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 682
setsockopt(682, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(682, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl(682, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl(682, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(682, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.12.63")}, 16) = -1 EINPROGRESS (Operation now in progress)
epoll_ctl(64, EPOLL_CTL_ADD, 682, {EPOLLIN|EPOLLOUT|EPOLLET, {u32=610, u64=610}}) = 0
getsockopt(682, SOL_SOCKET, SO_ERROR, [111], [4]) = 0
sendto(72, "<15>Jan  2 11:27:02 dotnet: Cons"..., 51, MSG_NOSIGNAL, NULL, 0) = 51
sendto(72, "<15>Jan  2 11:27:02 dotnet: Unab"..., 83, MSG_NOSIGNAL, NULL, 0) = 83
write(1, "\33[39;49m", 8)               = 8
write(1, "\33[31m", 5)                  = 5
write(28, "Unable to connect to any of the "..., 55) = 55
write(1, "\33[39;49m", 8)               = 8
futex(0x112141c, FUTEX_WAIT_BITSET_PRIVATE, 2425, {4981040, 917943541}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x11213f0, FUTEX_WAKE_PRIVATE, 1) = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 683
setsockopt(683, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(683, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl(683, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl(683, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(683, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("192.168.12.63")}, 16) = -1 EINPROGRESS (Operation now in progress)
epoll_ctl(64, EPOLL_CTL_ADD, 683, {EPOLLIN|EPOLLOUT|EPOLLET, {u32=611, u64=611}}) = 0
getsockopt(683, SOL_SOCKET, SO_ERROR, [111], [4]) = 0
sendto(72, "<15>Jan  2 11:27:02 dotnet: Cons"..., 51, MSG_NOSIGNAL, NULL, 0) = 51
sendto(72, "<15>Jan  2 11:27:02 dotnet: Unab"..., 83, MSG_NOSIGNAL, NULL, 0) = 83
write(1, "\33[39;49m", 8)               = 8
write(1, "\33[31m", 5)                  = 5
write(28, "Unable to connect to any of the "..., 55) = 55

How to repeat:
.net core centos 7 MySqlConnection time out  socket not close
[8 Jan 2020 6:24] MySQL Verification Team
Hello SunFei Sun,

Thank you for the report and feedback.
Tried steps from https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-centos7 & https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install on a freshly built centOS 7 VM with the dummy test case but not seeing any issues.

--
[root@centos7 myApp]# cat Program.cs 
using MySql.Data.MySqlClient;
using System;

namespace myApp
{
    class Program
    {
    
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            MySqlConnectionStringBuilder csb2 = new MySqlConnectionStringBuilder
            {
                Server = "xxxxxxx.no.oracle.com",
                UserID = "ushastry",
                Password = "abc",
                Port     = 3333
            };
            MySqlConnection conn = new MySqlConnection(csb2.ToString());
            conn.Open();
        }
 }
}
[root@centos7 myApp]# dotnet run
Hello World!
[root@centos7 myApp]# 

Could you please provide sample project to reproduce the issue at our end? Thank you.

This issue reminds me of Bug #97872, are you using 'keepalive' in the connection string on? Please let us know.

regards,
Umesh
[9 Feb 2020 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".