[ODLPARENT-170] Karaf CLI "java.util.regex.PatternSyntaxException: Illegal repetition near index" when running in container and using dumb terminal Created: 02/Oct/18  Updated: 06/Sep/21  Resolved: 06/Sep/21

Status: Resolved
Project: odlparent
Component/s: Karaf
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Michael Vorburger Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

While investigating GENIUS-211 and using https://github.com/jhershberg/netvirt-ha-docker to run ODL clustered in a container, I've come accross this curious problem:

[laptop-host] $ ./karaf-client 1
[container] opendaylight-user@root> shell:stack-traces-print
[container] opendaylight-user@root>showSvcStatus --help     
DESCRIPTION
        diagstatus:showSvcStatus

	show the status of registered services

SYNTAX
        diagstatus:showSvcStatus [options]

OPTIONS
        --help
java.util.regex.PatternSyntaxException: Illegal repetition near index 4
(\S\S{-16,}|.{1,-16})(\s+|$)
    ^
	at java.util.regex.Pattern.error(Pattern.java:1957)
	at java.util.regex.Pattern.closure(Pattern.java:3159)
	at java.util.regex.Pattern.sequence(Pattern.java:2136)
	at java.util.regex.Pattern.expr(Pattern.java:1998)
	at java.util.regex.Pattern.group0(Pattern.java:2907)
	at java.util.regex.Pattern.sequence(Pattern.java:2053)
	at java.util.regex.Pattern.expr(Pattern.java:1998)
	at java.util.regex.Pattern.compile(Pattern.java:1698)
	at java.util.regex.Pattern.<init>(Pattern.java:1351)
	at java.util.regex.Pattern.compile(Pattern.java:1028)
	at org.apache.karaf.shell.impl.action.command.DefaultActionPreparator.printFormatted(DefaultActionPreparator.java:440)
	at org.apache.karaf.shell.impl.action.command.DefaultActionPreparator.printUsage(DefaultActionPreparator.java:384)
	at org.apache.karaf.shell.impl.action.command.DefaultActionPreparator.prepare(DefaultActionPreparator.java:98)
	at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:83)
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571)
	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497)
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386)
	at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417)
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

What is fun is that if I do the exact same thing on a Karaf running locally outside of the container, with the exact same code (I'm using the binary which jhershberg/netvirt-ha-docker copied into the container), this this does not happen... so must have something to do with running in container and using dumb terminal (where "cursor arrow up" prints "^[[A" instead of working history).

May be it's somehow related to the @Option(name = "-n", aliases = {"--node"}) String nip; in DiagStatusCommand, because the exception above seem to happen just as it's about to print that option, here is the output from when it works (note how the -n, --node is missing above!):

opendaylight-user@root>showSvcStatus --help
DESCRIPTION
        diagstatus:showSvcStatus

	show the status of registered services

SYNTAX
        diagstatus:showSvcStatus [options]

OPTIONS
        --help
                Display this help message
        -n, --node

So definitely very minor, and only filing this here for reference; not important enough to jump on fixing it; skitt FYI.



 Comments   
Comment by Michael Vorburger [ 02/Oct/18 ]

Not sure if this "String index out of range" could be related to above or is a totally separate problem:

$ ./karaf-client 1 
executing "/odlha/karaf/target/assembly/bin/client" on 1.........................................
client: JAVA_HOME not set; results may vary
Logging in as karaf
 
 ________ ________ .__ .__ .__ __ 
 \_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_ 
 / | \\____ \_/ __ \ / \ | | \\__ \< | || | | |/ ___\| | \ __\ 
 / | \ |_> > ___/| | \| ` \/ __ \\___ || |_| / /_/ > Y \ | 
 \_______ / __/ \___ >___| /_______ (____ / ____||____/__\___ /|___| /__| 
 \/|__| \/ \/ \/ \/\/ /_____/ \/

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.

Error in initialization script: /odlha/karaf/target/assembly/etc/shell.init.script: String index out of range: 0
opendaylight-user@root>
Comment by Robert Varga [ 06/Sep/21 ]

This looks like a Karaf problem, really. If it resurfaces, please file an issue with upstream.

Generated at Wed Feb 07 20:27:49 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.