Skip to content

[keyman] Remove exception in Keyman on uninitialized platform#3704

Open
AryanMishra1789 wants to merge 1 commit intochaoss:mainfrom
AryanMishra1789:fix-keyman-startup-crash
Open

[keyman] Remove exception in Keyman on uninitialized platform#3704
AryanMishra1789 wants to merge 1 commit intochaoss:mainfrom
AryanMishra1789:fix-keyman-startup-crash

Conversation

@AryanMishra1789
Copy link

Description

  • This PR prevents Keyman from crashing during startup when a key request is received for a platform whose key pools have not yet been initialized.

  • After state cleanup or service restarts, workers may request keys before any keys have been published, which previously caused Keyman to raise InvalidRequest and crash.

This PR fixes #3700

Notes for Reviewers
This change treats the condition as a recoverable startup scenario rather than an invalid request. The fix is intentionally minimal and only adds a warning log while preventing the crash.

Signed commits

  • Yes, I signed my commits.

@MoralCode MoralCode requested a review from Ulincsys February 17, 2026 17:55
Copy link
Contributor

@MoralCode MoralCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Id like to learn more about how adding a try/catch around the redis initialization relates to what you mentioned in the PR description regarding how keyman crashes if a key is fetched before being published.

Comment on lines 20 to 21
except Exception:
conn = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure if swallowing/hiding the exception here is the best way to handle this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out.

The core fix in this PR is the change in new_key() to prevent Keyman from crashing when a key request arrives before platform state is initialized. The try/catch around Redis initialization was added defensively during debugging and isn’t essential to addressing the InvalidRequest crash.

I can remove that change and keep this PR focused solely on the key request handling.

Signed-off-by: AryanMishra17003 <158508418+AryanMishra17003@users.noreply.github.com>
@MoralCode MoralCode changed the title [keyman] Prevent Keyman crash on uninitialized platform during startup [keyman] Remove exception in Keyman on uninitialized platform Feb 17, 2026
@AryanMishra1789 AryanMishra1789 force-pushed the fix-keyman-startup-crash branch from 19ff9a7 to b073e41 Compare February 17, 2026 18:51
@AryanMishra1789
Copy link
Author

I have removed the redis try/catch and updated the PR to reflect the requested change.

@MoralCode
Copy link
Contributor

Sounds good! i'd like to talk to John (the maintainer who wrote keyman) to see whether removing this exception is likely the best way to handle this underlying issue, or whether something else (like adding a try catch around the invocation in keyclient) would be better

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.

keyman crashing with Invalid platform: github_rest

2 participants