You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by "diedertimmers (via GitHub)" <gi...@apache.org> on 2023/03/29 11:53:46 UTC

[GitHub] [karaf] diedertimmers opened a new pull request, #1717: Changed handling of the TCP connection to send the stop command

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-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [karaf] mattrpav commented on pull request #1717: [KARAF-7682] Changed handling of the TCP connection to send the stop command

Posted by "mattrpav (via GitHub)" <gi...@apache.org>.
mattrpav commented on PR #1717:
URL: https://github.com/apache/karaf/pull/1717#issuecomment-1708475095

   The .flush() here makes good sense. I've seen similar 'hangs' during stop from time-to-time as well. +1 


-- 
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-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [KARAF-7682] Changed handling of the TCP connection to send the stop command [karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre merged PR #1717:
URL: https://github.com/apache/karaf/pull/1717


-- 
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-unsubscribe@karaf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org