akpatnam25 commented on code in PR #3630:
URL: https://github.com/apache/celeborn/pull/3630#discussion_r2984693217


##########
worker/src/test/scala/org/apache/celeborn/service/deploy/cluster/SslClusterReadWriteLeakSuite.scala:
##########
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.celeborn.service.deploy.cluster
+
+import java.io.ByteArrayOutputStream
+import java.nio.charset.StandardCharsets
+import java.util.concurrent.atomic.AtomicInteger
+
+import scala.collection.JavaConverters._
+
+import io.netty.buffer.UnpooledByteBufAllocator
+import io.netty.util.{ResourceLeakDetector, ResourceLeakDetectorFactory}
+import org.apache.commons.lang3.RandomStringUtils
+import org.junit.Assert
+import org.scalatest.BeforeAndAfterAll
+import org.scalatest.funsuite.AnyFunSuite
+
+import org.apache.celeborn.client.{LifecycleManager, ShuffleClientImpl}
+import org.apache.celeborn.client.read.MetricsCallback
+import org.apache.celeborn.common.CelebornConf
+import org.apache.celeborn.common.identity.UserIdentifier
+import org.apache.celeborn.common.internal.Logging
+import org.apache.celeborn.common.network.ssl.SslSampleConfigs
+import org.apache.celeborn.common.protocol.{CompressionCodec, 
TransportModuleConstants}
+import org.apache.celeborn.service.deploy.MiniClusterFeature
+
+/**
+ * Integration test verifying that the SslMessageEncoder memory-leak fix holds 
under a realistic
+ * mini-cluster workload with TLS enabled on every transport channel.
+ *
+ * <p>The test installs a custom Netty ResourceLeakDetector in PARANOID mode 
before the cluster
+ * starts, runs a full push+replicate+read shuffle cycle with payloads large 
enough to require
+ * multi-record TLS framing (> 16 KB per push), then forces GC and asserts 
that the detector
+ * reported zero leaks.
+ */
+class SslClusterReadWriteLeakSuite
+  extends AnyFunSuite
+  with MiniClusterFeature
+  with BeforeAndAfterAll
+  with Logging {
+
+  private val reportedLeaks = new AtomicInteger(0)
+
+  private var testMasterPort: Int = _
+
+  private lazy val serverSslConf: Map[String, String] = {
+    val modules = Seq(
+      TransportModuleConstants.PUSH_MODULE,
+      TransportModuleConstants.REPLICATE_MODULE,
+      TransportModuleConstants.FETCH_MODULE)
+    modules
+      .flatMap(m => 
SslSampleConfigs.createDefaultConfigMapForModule(m).asScala.toSeq)
+      .toMap
+  }
+
+  override def beforeAll(): Unit = {
+
+    // Install the leak-counting detector BEFORE any Netty buffers are 
allocated so that
+    // AbstractByteBuf.leakDetector (a static final field) is initialised with 
our instance
+    // rather than the default one.
+    installLeakCountingDetector()
+

Review Comment:
   @SteNicholas  this seems too complex and unnecessary. Let us just validate 
simply that we are using the right leak detector. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to