changeset 54447:196ab0abc685

8219658: Deadlock in sun.security.ssl.SSLSocketImpl Reviewed-by: jnimeh
author xuelei
date Thu, 28 Feb 2019 10:04:27 -0800
parents 8b886d62ddc7
children 1542e63eb537
files src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Feb 28 09:10:58 2019 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Feb 28 10:04:27 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -916,8 +916,12 @@
         /**
          * Try the best to use up the input records so as to close the
          * socket gracefully, without impact the performance too much.
+         *
+         * Note: please don't synchronize this method as the read() method
+         * may hold the lock. A race should be fine as this method is
+         * designed for cleanup only.
          */
-        private synchronized void deplete() {
+        private void deplete() {
             if (!conContext.isInboundClosed()) {
                 if (!(conContext.inputRecord instanceof SSLSocketInputRecord)) {
                     return;