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

when get session from manager with retry mechanism may bring NPE #467

Closed
Real-lilYoung opened this issue Aug 25, 2022 · 0 comments · Fixed by #483
Closed

when get session from manager with retry mechanism may bring NPE #467

Real-lilYoung opened this issue Aug 25, 2022 · 0 comments · Fixed by #483

Comments

@Real-lilYoung
Copy link

When the session is obtained from the manager for the first time, it will determine whether the pool is empty for initialization. However, when initializing, the pool will be constructed first. If the pool initialization is abnormal, an exception will be thrown, and the first session acquisition fails. When retrying for the second time, the pool is no longer empty and will not be initialized again, and the subsequent logic will be performed directly, which may result in a NPE.

Related code:

private void init() throws RuntimeException {
try {
pool = new NebulaPool();
if (!pool.init(config.getAddresses(), config.getPoolConfig())) {
throw new RuntimeException("Init pool failed: services are broken.");
}
…}

public synchronized SessionWrapper getSessionWrapper() throws RuntimeException,
ClientServerIncompatibleException {
checkClose();
if (pool == null) {
init();
}
…}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant