[ 
https://issues.apache.org/jira/browse/KARAF-8001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18013934#comment-18013934
 ] 

Robert Varga commented on KARAF-8001:
-------------------------------------

This kind of circles back to the intention of StaticConfigurationImpl, but does 
not affect the bug:
* if the intention is for it to be read-only, it should return 
ConfigurationAttribute.READ_ONLY from its getAttributes() and throw 
ReadOnlyConfigurationException
* if the intention is for it to always fail to persist, it should be throwing 
an IOException

The former seems better, as it would be detectable by LogServiceImpl.setLevel() 
and it could do the right thing?

The problem seems to be that this codepath should only be invoked on sessions 
connected via SSH -- if it is local terminal, I may want to actually be 
debugging SSH issues.
Futhermore, there seems to also be the TOCTOU problem with concurrent session:
# session 1 runs log:tail, changing logging from INFO to ERROR, remembering 
INFO (or DEBUG)
# session 2 runs log:tail, changing logging from ERROR to ERROR, remembering 
ERROR
# session 1 ends log:tail, restoring level to INFO (or DEBUG), causing session 
2 to run into the problem described in KARAF-5559
# session 2 ends log:tail, restoring level to ERROR
hence after the dust settles, the configuration is left in a different state to 
where it started

 

> log:tail in static distribution reports an UnsupportedOperationException
> ------------------------------------------------------------------------
>
>                 Key: KARAF-8001
>                 URL: https://issues.apache.org/jira/browse/KARAF-8001
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>            Reporter: Robert Varga
>            Priority: Major
>
> Using a static distribution like the one available here: 
> [https://repo1.maven.org/maven2/org/opendaylight/odlparent/test-static/14.1.1/test-static-14.1.1.tar.gz]
> and issuing 'log:tail' results in failing to tail:
> {noformat}
> opendaylight-user@root>log:tail
> 16:41:12.762 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Registering commands for bundle 
> org.apache.karaf.log.core/4.4.8
> 16:41:12.799 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Registering commands for bundle 
> org.apache.karaf.shell.commands/4.4.8
> 16:41:12.800 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Updating commands for bundle 
> org.apache.karaf.shell.commands/4.4.8
> 16:41:12.805 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Registering commands for bundle 
> org.apache.karaf.event/4.4.8
> 16:41:12.808 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Binding HTTP Service for bundle: 
> [org.apache.karaf.http.core_4.4.8 [36]]
> 16:41:12.811 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Registering commands for bundle 
> org.apache.karaf.http.core/4.4.8
> 16:41:12.822 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Registering commands for bundle 
> org.apache.karaf.system.core/4.4.8
> 16:41:12.831 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] Registering commands for bundle 
> org.apache.karaf.features.command/4.4.8
> 16:41:12.837 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] bundle org.apache.felix.scr:2.2.6 (52) 
> Starting with globalExtender setting: false
> 16:41:12.839 INFO [Refresh Thread: Equinox Container: 
> 24f4ec3f-0828-4769-9775-a63b04469992] bundle org.apache.felix.scr:2.2.6 (52)  
> Version = 2.2.6
> 16:41:12.847 INFO [features-3-thread-1] Done.
> Error executing command: java.lang.UnsupportedOperationException
> opendaylight-user@root>{noformat}
> The full splat is logged each time as:
> {noformat}
> 2025-08-14T16:41:30,047 | ERROR | Karaf local console user karaf | ShellUtil  
>                       | 28 - org.apache.karaf.shell.core - 4.4.8 | Exception 
> caught while executing command
> java.lang.UnsupportedOperationException: null
>         at 
> org.apache.karaf.services.staticcm.StaticConfigurationImpl.update(StaticConfigurationImpl.java:54)
>  ~[?:?]
>         at 
> org.apache.karaf.log.core.internal.LogServiceImpl.setLevel(LogServiceImpl.java:117)
>  ~[?:?]
>         at 
> org.apache.karaf.log.command.LogTail$LogServiceTracker.addingService(LogTail.java:95)
>  ~[?:?]
>         at 
> org.apache.karaf.log.command.LogTail$LogServiceTracker.addingService(LogTail.java:76)
>  ~[?:?]
>         at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
>  ~[osgi.core-8.0.0.jar:?]
>         at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871)
>  ~[osgi.core-8.0.0.jar:?]
>         at 
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) 
> ~[osgi.core-8.0.0.jar:?]
>         at 
> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) 
> ~[osgi.core-8.0.0.jar:?]
>         at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:321) 
> ~[osgi.core-8.0.0.jar:?]
>         at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:264) 
> ~[osgi.core-8.0.0.jar:?]
>         at org.apache.karaf.log.command.LogTail.execute(LogTail.java:54) 
> ~[?:?]
>         at 
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:88)
>  ~[?:?]
>         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:599) 
> ~[?:?]
>         at 
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) 
> ~[?:?]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) 
> ~[?:?]
>         at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
>         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:317) ~[?:?]
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
>  ~[?:?]
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
>  ~[?:?]
>         at java.lang.Thread.run(Thread.java:1583) [?:?]
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to