Repository navigation
Description
Describe the bug
We run OpenCloud on k8s and one of our nodes has 256 CPUs. On that node the
pod comes up 1/1 Running, /health returns 200, but nothing works: the
embedded IDM was never bootstrapped, so binds as uid=libregraph / uid=reva
fail with "not found", graph gets LDAP 49 when adding users, and the proxy
returns 500 Autoprovisioning user failed.
First IDM start panics while hashing the service user passwords:
opencloud: Failed service 'idm' (1.000000 failures of 5.000000), restarting: true,
panic: argon2: parallelism degree too low
golang.org/x/[email protected]/argon2/argon2.go:110 deriveKey
golang.org/x/[email protected]/argon2/argon2.go:102 IDKey
alexedwards/[email protected]/argon2id.go:97 CreateHash
libregraph/[email protected]/pkg/ldappassword/...:103 Hash
opencloud/services/idm/pkg/command/server.go:179 bootstrap
opencloud/services/idm/pkg/command/server.go:72 Server.func2
thejerf/suture/v4 supervisor.go:549 (restart)
Cause: everything hashes with argon2id.DefaultParams from
alexedwards/argon2id, which sets Parallelism: uint8(runtime.NumCPU()).
nproc in the pod returns 256, uint8(256) is 0, and x/crypto/argon2
panics.
The worse part is what happens next: the panic leaves an empty
idm.boltdb behind. Suture restarts IDM, bootstrap only runs when the store
doesn't exist, so it's skipped, and IDM serves an empty LDAP while looking
healthy. Took us a while to figure out since nothing restarts or crash-loops.
We reproduced it in a sandbox: 256 CPUs → panic + empty store, 32 CPUs →
clean bootstrap. GOMAXPROCS=2 doesn't change anything, it's the CPU
affinity mask that matters (NumCPU), not GOMAXPROCS. The pod CPU limit
(2 CPUs, cpu.max = 200000 100000) doesn't change it either.
Same hashing code is used in auth-guest (PIN hashing) and in reva's app
password manager, so those should panic the same way.
Steps to reproduce
- Run OpenCloud on a node with 256 logical CPUs, fresh IDM data dir
- Start with cleartext
IDM_*_PASSWORDvalues - IDM panics during bootstrap, gets restarted with an empty store, pod
reports healthy, logins / user provisioning fail
Expected behavior
- argon2 parallelism should be a fixed, sane default (1-4 as RFC 9106
suggests) that can't end up at 0, ideally configurable via env vars
(memory / iterations / parallelism). For IDM, setting
ldappassword.Argon2DefaultParamsat startup looks like enough. Existing
hashes keep working since the params are stored in each hash. - If bootstrap fails, IDM shouldn't come back up on a half-initialized
store. Either clean it up and retry, or fail hard so the pod goes
unhealthy.
Setup
OpenCloud 8.1.0 rolling, Kubernetes, 256 CPU node, pod limit 2 CPU
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsQualification
Activity