Skip to content

Commit

Permalink
branch-3.0: [fix](regression)Add log for Reach limit of connections #…
Browse files Browse the repository at this point in the history
…45887 (#46820)

Cherry-picked from #45887

Co-authored-by: James <[email protected]>
  • Loading branch information
github-actions[bot] and Jibing-Li authored Jan 11, 2025
1 parent 347277f commit 797cf0c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ public boolean submit(ConnectContext context) {
// Register one connection with its connection id.
public boolean registerConnection(ConnectContext ctx) {
if (numberConnection.incrementAndGet() > maxConnections) {
LOG.info("Number connection {} has reach upper limit {}. Connection map : [{}]",
numberConnection.get(), maxConnections, connectionMap);
numberConnection.decrementAndGet();
return false;
}
// Check user
connByUser.putIfAbsent(ctx.getQualifiedUser(), new AtomicInteger(0));
AtomicInteger conns = connByUser.get(ctx.getQualifiedUser());
if (conns.incrementAndGet() > ctx.getEnv().getAuth().getMaxConn(ctx.getQualifiedUser())) {
LOG.info("User {}'s connection {} has reached upper limit {}. connByUser: [{}]", ctx.getQualifiedUser(),
conns.get(), ctx.getEnv().getAuth().getMaxConn(ctx.getQualifiedUser()), connByUser);
conns.decrementAndGet();
numberConnection.decrementAndGet();
return false;
Expand Down

0 comments on commit 797cf0c

Please sign in to comment.