Lock handling problems in the REST API (src/services/api/rest/routers.py):
- /config-file serializes with an asyncio.Lock, while /configure and /import-pki use the global threading.Lock. A config-file load/merge can therefore run at the same time as a /configure call and both modify the shared config session.
- When a /config-file load or merge fails (e.g. the commit fails), the error paths do not discard the session, so the loaded changes stay pending in the shared session and are committed by the next unrelated /configure request. GraphQL load_config_file has the same gap.
- In /configure, Config() is created after lock.acquire() but outside the try/finally. If it raises, the global lock is never released and every later configure request hangs until the API service restarts.
Fix: /config-file takes the same global lock (acquired in a thread so the event loop is not blocked), discards the session on errors (REST and GraphQL), and Config() moves inside the try block.