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

'Insert userIpSessionCount to local cache failed' #4833

Closed
doublex opened this issue Nov 7, 2022 · 3 comments
Closed

'Insert userIpSessionCount to local cache failed' #4833

doublex opened this issue Nov 7, 2022 · 3 comments
Assignees
Labels
affects/none PR/issue: this bug affects none version. process/done Process of bug severity/major Severity of bug type/bug/functionality Bugs preventing the database to deliver a promised function. type/bug Type: something is unexpected
Milestone

Comments

@doublex
Copy link

doublex commented Nov 7, 2022

Nebula graph + python-client: 3.3
Reopen: #4374

nebula-graphd.harmony-2.root.log.ERROR.20221105-105450.17961 reports:

E20221107 10:40:53.825762 17984 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 10:45:45.864709 17990 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 10:47:43.259713 17986 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 10:49:21.894584 17988 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 10:50:55.024781 17987 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 10:56:44.987785 17986 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 11:03:16.014827 17983 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 11:03:21.380504 17980 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 11:07:30.030318 17987 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 11:10:46.747905 17981 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.
E20221107 11:22:42.793710 17981 GraphService.cpp:105] Create session for userName: harmony, ip: ::ffff:10:20:30:40 failed: Insert userIpSessionCount to local cache failed.

nebula-python throws this exception:

Nov 07 11:22:42 harony-3 python3.9[22643]: Traceback (most recent call last):
Nov 07 11:22:42 harony-3 python3.9[22643]: File "./harmony/nebulaapi.py", line 33, in execute
Nov 07 11:22:42 harony-3 python3.9[22643]: with connection.session_context(config.nebula['user'], config.nebula['pass']) as session:
Nov 07 11:22:42 harony-3 python3.9[22643]: File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
Nov 07 11:22:42 harony-3 python3.9[22643]: return next(self.gen)
Nov 07 11:22:42 harony-3 python3.9[22643]: File "/home/python/.local/lib/python3.9/site-packages/nebula3/gclient/net/ConnectionPool.py", line 130, in session_context
Nov 07 11:22:42 harony-3 python3.9[22643]: session = self.get_session(*args, **kwargs)
Nov 07 11:22:42 harony-3 python3.9[22643]: File "/home/python/.local/lib/python3.9/site-packages/nebula3/gclient/net/ConnectionPool.py", line 109, in get_session
Nov 07 11:22:42 harony-3 python3.9[22643]: auth_result = connection.authenticate(user_name, password)
Nov 07 11:22:42 harony-3 python3.9[22643]: File "/home/python/.local/lib/python3.9/site-packages/nebula3/gclient/net/Connection.py", line 112, in authenticate
Nov 07 11:22:42 harony-3 python3.9[22643]: raise AuthFailedException(resp.error_msg)
Nov 07 11:22:42 harony-3 python3.9[22643]: nebula3.Exception.AuthFailedException: b'Insert userIpSessionCount to local cache failed.'
@doublex doublex added the type/bug Type: something is unexpected label Nov 7, 2022
@Sophie-Xie Sophie-Xie added this to the v3.4.0 milestone Nov 8, 2022
@xtcyclist xtcyclist added the type/bug/functionality Bugs preventing the database to deliver a promised function. label Nov 9, 2022
@jinyingsunny jinyingsunny added the severity/major Severity of bug label Nov 10, 2022
@Sophie-Xie Sophie-Xie assigned critical27 and unassigned Aiee Nov 15, 2022
@HarrisChu HarrisChu added the affects/none PR/issue: this bug affects none version. label Dec 1, 2022
@critical27
Copy link
Contributor

It is not very big issue here, it use a ConcurrentHashMap, it can add/sub session count for each user ip. When a new user ip comes up, it will create an entry in hashmap, but there is no lock, so we may return false here, and the create session will failed.

bool GraphSessionManager::addSessionCount(std::string& key) {
  auto countFindPtr = userIpSessionCount_.find(key);
  if (countFindPtr != userIpSessionCount_.end()) {
    countFindPtr->second.get()->fetch_add(1);
  } else {
    auto ret1 = userIpSessionCount_.emplace(key, std::make_shared<SessionCount>());
    if (!ret1.second) {
      return false;
    }
  }
  return true;
}

@critical27
Copy link
Contributor

@Aiee, PTAL.

@critical27
Copy link
Contributor

Not a very severe issue to me. Reopen it if necessary.

@github-actions github-actions bot added the process/fixed Process of bug label Dec 12, 2022
@critical27 critical27 assigned MuYiYong and unassigned critical27 Dec 12, 2022
@Hester-Gu Hester-Gu added the process/done Process of bug label Jan 13, 2023
@github-actions github-actions bot removed the process/fixed Process of bug label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/none PR/issue: this bug affects none version. process/done Process of bug severity/major Severity of bug type/bug/functionality Bugs preventing the database to deliver a promised function. type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

9 participants