diedertimmers opened a new pull request, #1717: URL: https://github.com/apache/karaf/pull/1717
The karaf stop command does not always stop the karaf 4.3.6 framework using the loopback stop option. After research a number of things stand out: · There is always a 'java.net.SocketException' in the logging when the karaf framework is stopped · The try with resource statement is used on the Socket · A System.exit(0) call is used inside the try block. Analysis of these findings shows the following issues: · The send stopCommand does not include al EOL or EOF character. This results in the read loop ShutdownSocketThread not exiting, and ultimately throwing a 'java.net.SocketException: Connection Reset' in the logging. · The mechanism try-with-resource closes the socket, but this does not guaranty the flushing of the sockets Outputstream. Because this is done asynchronous and after this statement a System.exit() call is made effectively terminating the JVM. · The call to System.exit(0) Terminates the proces without calling the implicit finally clause (which is generated by the java compiler see https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-14.20.3 and https://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html ). Because of this calling the close on the Socket is not guaranteed. Suggested changes: · Add EOL to the stopcommand before sending · add flush on the outputstream before calling System.exit(0) · Move the System.exit(0) call out of the try block -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@karaf.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org