Skip to content

Connection leak detected when UserManager.GetUserAsync call #17

@xpsdim

Description

@xpsdim

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions