Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster_mgr pg连接失败,导致句柄 #4

Open
jd-zhang opened this issue Apr 6, 2022 · 0 comments
Open

cluster_mgr pg连接失败,导致句柄 #4

jd-zhang opened this issue Apr 6, 2022 · 0 comments

Comments

@jd-zhang
Copy link
Contributor

jd-zhang commented Apr 6, 2022

Issue migrated from trac ticket # 556

component: DBA GUI | priority: major

2022-04-06 17:42:08: barney created the issue


int PGSQL_CONN::connect(const char *database)
{
if(connected && db == database)
return 0;
else
close_conn();

char conninfo[256];
sprintf(conninfo, "dbname=%s host=%s port=%d user=%s password=%s",
database, ip.c_str(), port, user.c_str(), pwd.c_str());

conn = PQconnectdb(conninfo);

if (PQstatus(conn) != CONNECTION_OK)
{
syslog(Logger::ERROR, "Connected to pgsql fail: %s", PQerrorMessage(conn));

          PQfinish(conn);   //pg socket leak.
  return 1;

}

db = database;
connected = true;

return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant