karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Krüger (JIRA) <j...@apache.org>
Subject [jira] [Commented] (KARAF-4069) ConsoleSessionImpl does not close the session in function close()
Date Thu, 15 Oct 2015 11:52:05 GMT

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

Martin Krüger commented on KARAF-4069:

Unfortunately I am not able to provide a patch in this case because I can not say if the order
where the session is closed is relevant in the close function.

public void close() {
        if (!running) {
        if (reader.getHistory() instanceof PersistentHistory) {
            try {
                ((PersistentHistory) reader.getHistory()).flush();
            } catch (IOException e) {
                // ignore
        running = false;
        if (thread != Thread.currentThread()) {
        if (closeCallback != null) {
        if (terminal instanceof Closeable) {
            try {
                ((Closeable) terminal).close();
            } catch (IOException e) {
                // Ignore

I suggest putting the {code}session.close();{code} at the end of the function. It was not
present before and closing the session only improves the situation. But please feel free to
put it where it makes sense.

> ConsoleSessionImpl does not close the session in function close()
> -----------------------------------------------------------------
>                 Key: KARAF-4069
>                 URL: https://issues.apache.org/jira/browse/KARAF-4069
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 4.0.2
>            Reporter: Martin Krüger
> In the class ConsoleSessionImpl does not close the session originated from the class
CommandProcessorImpl (from SessionFactoryImpl.create(...)). Resulting from that the CommandProcessorImpl
keeps all open sessions in a WeakHashMap which will grow over time too.
> On the other hand the HeadlessSessionImpl does close the session in its close function.

This message was sent by Atlassian JIRA

View raw message