Skip to content

fix: exit cleanly on failed login in oiecommand#265

Open
dowel015 wants to merge 1 commit intoOpenIntegrationEngine:mainfrom
dowel015:fix/oiecommand-hangs-on-failed-login-224
Open

fix: exit cleanly on failed login in oiecommand#265
dowel015 wants to merge 1 commit intoOpenIntegrationEngine:mainfrom
dowel015:fix/oiecommand-hangs-on-failed-login-224

Conversation

@dowel015
Copy link
Copy Markdown

Summary

  • oiecommand hung indefinitely after a failed login because UnauthorizedException was caught by the generic ClientException handler, which only printed a stack trace and returned — leaving Jersey HTTP client threads alive and the JVM running
  • Added a specific UnauthorizedException catch before the generic ClientException catch that prints a clear "invalid username or password" message and calls System.exit(1)
  • Also changed the generic ClientException handler to exit rather than silently return, preventing the same hang for other connection errors

Fixes #224

Test plan

  • Run oiecommand -a https://localhost:8443 -u admin -p wrongpassword — confirm it prints a clean error and exits immediately with code 1
  • Run with correct credentials — confirm normal login and operation still works

🤖 Generated with Claude Code

@dowel015 dowel015 force-pushed the fix/oiecommand-hangs-on-failed-login-224 branch from 60fee51 to 7e5b7e5 Compare March 13, 2026 15:52
@mgaffigan
Copy link
Copy Markdown
Contributor

@dowel015, Thanks for the PR! It looks good to me, but you need to sign your commit to comply with the MPL license of the project. See https://www.secondstate.io/articles/dco/ or the failing check for details.

@kryskool
Copy link
Copy Markdown
Contributor

Be carefull, commit come from claude AI, a licencing problem can appear

@ChristopherSchultz
Copy link
Copy Markdown

This does not look like the right approach to solve the problem.

The real question is "why isn't the process ending on its own?"

The error path looks like main() should terminate, which suggests that there is a thread which is being created which is not a daemon thread, and not being cleaned up.

@dowel015 dowel015 force-pushed the fix/oiecommand-hangs-on-failed-login-224 branch 2 times, most recently from 5e9f93f to e530439 Compare April 2, 2026 18:10
…e#224)

new Client(server) creates a JAX-RS client and HTTP connection pool with
non-daemon threads. On any failure path (UnauthorizedException,
ClientException, or non-SUCCESS login status), client.close() was never
called, leaving those threads running and the process hanging.

Move client.close() into a finally block — it is idempotent via
AtomicBoolean — so it always runs regardless of exit path. Remove
System.exit(1) calls that were masking the root cause.

Fixes OpenIntegrationEngine#224

Signed-off-by: Joshua Dowell <joshua.dowell@centrallogic.com>
@dowel015 dowel015 force-pushed the fix/oiecommand-hangs-on-failed-login-224 branch from e530439 to 9b5a771 Compare April 2, 2026 18:21
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.

oiecommand hangs after failed login attempt

4 participants