You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every call of UserManager.GetUserAsync allocates one connection to postgresql database and doesn't release it. Such action increase connection pool by 1 every time I call it.
public async Task<IActionResult> Test() { var currentUser = await _userManager.GetUserAsync(HttpContext.User); return Ok(currentUser); }
You can control number of the opened connection using SQL:
SELECT * FROM pg_stat_activity
When I do this 100+ times I get fatal error "FATAL: sorry, too many clients already". It happens when DBMS configured by default on my windows platform.
I also noticed that call of GetUserAsync doesn't make any SQL calls into database but opens new connection.
The text was updated successfully, but these errors were encountered:
I had the same problem calling IsInRoleAsync every minute, I went through the source code and I found that the CloseConnection is commented.
With connection pooling I don't understand why it's commented.
I uncommented and call it from dispose too.
With that I don't have any idle connection anymore.
public void CloseConnection()
{
/* if (_connection.State == ConnectionState.Open)
{
// _connection.Close();
}*/
}
Every call of UserManager.GetUserAsync allocates one connection to postgresql database and doesn't release it. Such action increase connection pool by 1 every time I call it.
public async Task<IActionResult> Test() { var currentUser = await _userManager.GetUserAsync(HttpContext.User); return Ok(currentUser); }
You can control number of the opened connection using SQL:
SELECT * FROM pg_stat_activity
When I do this 100+ times I get fatal error "FATAL: sorry, too many clients already". It happens when DBMS configured by default on my windows platform.
I also noticed that call of GetUserAsync doesn't make any SQL calls into database but opens new connection.
The text was updated successfully, but these errors were encountered: