ydb-java-sdk icon indicating copy to clipboard operation
ydb-java-sdk copied to clipboard

Cannot create session, code: OVERLOADED

Open alex-dorokhov opened this issue 3 years ago • 0 comments

I'm running a cloud function every minute. Periodically I'm getting the following error while trying to get a db session. I'm closing a session at the end of the handler by calling close().await(), but still it does not help.

Caused by: com.yandex.ydb.core.UnexpectedResultException: cannot create session, code: OVERLOADED, issues: [Active sessions limit exceeded, maximum allowed: 1000 (S_ERROR)]
	at com.yandex.ydb.core.Result$Fail.newException(Result.java:217)
	at com.yandex.ydb.core.Result$Fail.expect(Result.java:169)
	at com.yandex.ydb.table.impl.SessionPool.lambda$create$0(SessionPool.java:57)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
	... 22 more

This is how I create the client:

TableClient
            .newClient(GrpcTableRpc.useTransport(transport))
            .build()

And I switched to this recently (but the error is still there):

TableClient
            .newClient(GrpcTableRpc.useTransport(transport))
            .sessionPoolSize(0, 10)
            .sessionMaxIdleTime(Duration.of(120, ChronoUnit.SECONDS))
            .build()

What could be wrong?

The version is 1.10.3.

alex-dorokhov avatar Feb 11 '22 21:02 alex-dorokhov