Skip to content

Commit

Permalink
[fix](regression)Add log for Reach limit of connections (#45887)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Add log to help investigate Reach limit of connections error.

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

### Release note

None
  • Loading branch information
Jibing-Li authored Dec 25, 2024
1 parent cab074f commit 5d0e510
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 5d0e510

Please sign in to comment.