You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Arunan Sugunakumar (Jira)" <ji...@apache.org> on 2020/08/04 03:42:00 UTC

[jira] [Commented] (HTTPCORE-644) High CPU usage noticed for SSLIOSession.close() after JDK upgrade

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

Arunan Sugunakumar commented on HTTPCORE-644:
---------------------------------------------

Hi [~olegk],

I upgraded the Httpcore version to 4.4.11 in Apache Synapse[1] and invoked an API with HTTPS. I tried this with Oracle JDK 1.8.0_261 and still I could see that the issue is getting reproduced. For every request, the CPU usage is increasing. This behaviour is not observed in older JDK 8 versions.

CPU load observed from JProfiler. (CPU keeps on spinning)

!Screenshot 2020-08-04 at 08.53.58.png|width=539,height=155!

 

I took a thread dump and observed that it is continuously trying to process a writable event.

!Screenshot 2020-08-04 at 08.48.18.png|width=715,height=249!

 

I captured the TCP packets for reference as well. (50269 is the client, 8243 is the server)

 

!Screenshot 2020-08-04 at 08.57.47.png|width=854,height=366!

 

I still believe this issue is due to the commit[2] I mentioned in the description above. We tried removing the commit and patched AdoptOpenJDK11, and this issue was not observed. It seems JDK has made a breaking change which affects Httpcore.

[1]- [https://github.com/apache/synapse][
[2] - https://github.com/AdoptOpenJDK/openjdk-jdk11u/commit/8d1b63a4db2c6348a97b3cf45bd4d2caa7cad6b5|https://github.com/apache/synapse]

 

Regards,
Arunan

> High CPU usage noticed for SSLIOSession.close() after JDK upgrade
> -----------------------------------------------------------------
>
>                 Key: HTTPCORE-644
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-644
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore, HttpCore NIO
>         Environment: Oracle JDK 1.8.0_261 (released in July 2020)
> AdoptOpenJDK (build 11.0.8+10)
> All versions after Oracle JDK 11.0.1
>            Reporter: Arunan Sugunakumar
>            Priority: Major
>         Attachments: Screenshot 2020-08-04 at 08.48.18.png, Screenshot 2020-08-04 at 08.53.58.png, Screenshot 2020-08-04 at 08.57.47.png, image-2020-08-03-13-02-35-195.png
>
>
> We are using a *forked version (4.3.3)* of HttpCore NIO. We recently had an issue because of JDK upgrade. When a HTTPS connection is closed from the server side, the server CPU usage seems to be increasing and stays on forever. We debugged and found out that after the HTTPS response is written back to the client, the server tries to close the connection and the SSLIOSession. Prior to JDK 8 261 versions (& Prior to Oracle JDK 11.0.2), after SSLIOSession closes the outBound connection, the Handshake status is returned as NEED_UNWRAP. When such status is returned, we set the new event Mask as Read EventMask. In the new JDK versions it is returned as NOT_HANDSHAKING. In such cases, the SSLSession is not getting closed properly, and the server is constantly trying to close the connection with Write events which causes the CPU spike. We debugged the JDK code, and we were able to find a commit[1], which might have caused this behaviour. With this JDK commit, TransportContext Handshake status is returned as NOT_HANDSHAKING even after closeOutbound() is called. (The issue is reproducible for both TLSv1.2 and TLSv1.3)
>  
> (Code snippet from JDK 11 commit)
> !image-2020-08-03-13-02-35-195.png!
>  
> *I am not sure, whether this issue is reproducible in the latest HttpCore version*. But since this a JDK level change, it might affect all versions. We observed the issue with the following JDK versions.
>  * Oracle JDK 1.8.0_261 (released in July 2020)
>  * AdoptOpenJDK (build 11.0.8+10)
>  * All versions after Oracle JDK 11.0.1
>  
> Any help here is appreciated.  
>  
> [1]- [https://github.com/AdoptOpenJDK/openjdk-jdk11u/commit/8d1b63a4db2c6348a97b3cf45bd4d2caa7cad6b5]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org