Skip to content

kbs: initialize EncryptedDb on the existing runtime#196

Merged
jialez0 merged 1 commit into
openanolis:mainfrom
jialez0:agent/fix-encrypted-db-runtime-init
Jul 20, 2026
Merged

kbs: initialize EncryptedDb on the existing runtime#196
jialez0 merged 1 commit into
openanolis:mainfrom
jialez0:agent/fix-encrypted-db-runtime-init

Conversation

@jialez0

@jialez0 jialez0 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • initialize KBS plugins asynchronously on the existing Actix/Tokio runtime
  • initialize EncryptedDb with init_async() instead of creating and blocking a nested runtime
  • add a regression test that constructs the production plugin manager from inside an async runtime
  • run the EncryptedDb test configuration in the Rust CI suite

Root cause

KBS starts under #[actix_web::main], but the EncryptedDb synchronous constructor created another Tokio runtime and called block_on(). Tokio rejects that nested runtime entry and panics before the SQL backend can initialize:

Cannot start a runtime from within a runtime

The container could remain reported as healthy when a wrapper process kept running, while the KBS listener itself was gone.

Impact

KBS can now start with the EncryptedDb resource backend under its normal Actix runtime. The SQLx pool and its background tasks remain attached to the runtime that owns the KBS process.

Validation

  • reproduced the original exit code 101 and nested-runtime backtrace with Rust 1.76, KBS, and MySQL 8.0
  • passed 79 KBS unit tests with --no-default-features --features encrypted-db
  • passed the real MySQL two-replica EncryptedDb E2E test
  • passed the new async plugin-manager regression test
  • started the fixed KBS against MySQL and verified GET /kbs/v0/resource/pubkey returns HTTP 200
  • passed Rust 1.76 EncryptedDb library clippy with warnings denied

Signed-off-by: Jiale Zhang zhangjiale@linux.alibaba.com

Signed-off-by: Jiale Zhang <zhangjiale@linux.alibaba.com>
@shankailun-aliyun

Copy link
Copy Markdown
Collaborator

@jialez0 ,您好,您的请求已接收,请耐心等待结果。

@shankailun-aliyun

Copy link
Copy Markdown
Collaborator

@jialez0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@jialez0
jialez0 merged commit 96517cf into openanolis:main Jul 20, 2026
5 of 6 checks passed
jialez0 added a commit that referenced this pull request Jul 20, 2026
Complete the Trustee 1.8.7-2 RPM changelog with the EncryptedDb nested-runtime startup fix merged in #196.

Signed-off-by: Jiale Zhang <zhangjiale@linux.alibaba.com>
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 this pull request may close these issues.

2 participants