8219658: Deadlock in sun.security.ssl.SSLSocketImpl
authorxuelei
Thu, 28 Feb 2019 10:04:27 -0800
changeset 53958 196ab0abc685
parent 53957 8b886d62ddc7
child 53959 1542e63eb537
8219658: Deadlock in sun.security.ssl.SSLSocketImpl Reviewed-by: jnimeh
src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java
--- 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;