Skip to content

fix(shell): prevent LinkageError from killing the local console thread (karaf-4.4.x)#2316

Merged
jbonofre merged 1 commit intoapache:karaf-4.4.xfrom
jbonofre:backport-2313-karaf-4.4.x
Mar 14, 2026
Merged

fix(shell): prevent LinkageError from killing the local console thread (karaf-4.4.x)#2316
jbonofre merged 1 commit intoapache:karaf-4.4.xfrom
jbonofre:backport-2313-karaf-4.4.x

Conversation

@jbonofre
Copy link
Member

Backport of #2313 to karaf-4.4.x.

When the JLine bundle is refreshed during runtime (e.g., due to feature install/update), the bundle classloader changes and AttributedString may be loaded by two different classloaders. This causes a LinkageError in ShellUtil.applyStyle().

The logException() error handler only caught Exception, not Error, so the LinkageError escaped and killed the console thread. Broaden the catch to Throwable so classloading errors during exception display are handled gracefully.

Also set command to empty string in readCommand()'s catch-all handler so transient errors re-prompt instead of exiting the session.

@jbonofre jbonofre changed the title fix(shell): prevent LinkageError from killing the local console thread fix(shell): prevent LinkageError from killing the local console thread (karaf-4.4.x) Mar 13, 2026
When the JLine bundle is refreshed during runtime (e.g., due to feature
install/update), the bundle classloader changes and AttributedString may
be loaded by two different classloaders. This causes a LinkageError in
ShellUtil.applyStyle().

The logException() error handler only caught Exception, not Error, so
the LinkageError escaped and killed the console thread. Broaden the
catch to Throwable so classloading errors during exception display are
handled gracefully.

Also set command to empty string in readCommand()'s catch-all handler
so transient errors re-prompt instead of exiting the session.
@jbonofre jbonofre force-pushed the backport-2313-karaf-4.4.x branch from 6cdf1d5 to 7f0ac30 Compare March 14, 2026 10:06
@jbonofre jbonofre merged commit 1a18b0e into apache:karaf-4.4.x Mar 14, 2026
2 checks passed
@jbonofre jbonofre deleted the backport-2313-karaf-4.4.x branch March 14, 2026 11:06
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.

1 participant