You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/12 03:26:29 UTC

[GitHub] [skywalking] muse-dev[bot] commented on a change in pull request #5995: Fix potential gRPC connection leak(not closed) for the channels among OAP instances.

muse-dev[bot] commented on a change in pull request #5995:
URL: https://github.com/apache/skywalking/pull/5995#discussion_r541488845



##########
File path: oap-server/server-cluster-plugin/cluster-kubernetes-plugin/src/main/java/org/apache/skywalking/oap/server/cluster/plugin/kubernetes/KubernetesCoordinator.java
##########
@@ -66,23 +65,25 @@ public KubernetesCoordinator(final ModuleDefineHolder manager,
             List<V1Pod> pods = NamespacedPodListInformer.INFORMER.listPods().orElseGet(this::selfPod);
             if (log.isDebugEnabled()) {
                 List<String> uidList = pods
-                        .stream()
-                        .map(item -> item.getMetadata().getUid())
-                        .collect(Collectors.toList());
+                    .stream()
+                    .map(item -> item.getMetadata().getUid())
+                    .collect(Collectors.toList());
                 log.debug("[kubernetes cluster pods uid list]:{}", uidList.toString());
             }
             if (port == -1) {
                 port = manager.find(CoreModule.NAME).provider().getService(ConfigService.class).getGRPCPort();
             }
-            List<RemoteInstance> remoteInstances =  pods.stream()
+            List<RemoteInstance> remoteInstances =
+                pods.stream()
+                    .filter(pod -> StringUtil.isNotBlank(pod.getStatus().getPodIP()))

Review comment:
       *NULL_DEREFERENCE:*  object returned by `pod.getStatus()` could be null and is dereferenced at line 78.

##########
File path: oap-server/server-cluster-plugin/cluster-kubernetes-plugin/src/main/java/org/apache/skywalking/oap/server/cluster/plugin/kubernetes/KubernetesCoordinator.java
##########
@@ -66,23 +65,25 @@ public KubernetesCoordinator(final ModuleDefineHolder manager,
             List<V1Pod> pods = NamespacedPodListInformer.INFORMER.listPods().orElseGet(this::selfPod);
             if (log.isDebugEnabled()) {
                 List<String> uidList = pods
-                        .stream()
-                        .map(item -> item.getMetadata().getUid())
-                        .collect(Collectors.toList());
+                    .stream()
+                    .map(item -> item.getMetadata().getUid())
+                    .collect(Collectors.toList());
                 log.debug("[kubernetes cluster pods uid list]:{}", uidList.toString());
             }
             if (port == -1) {
                 port = manager.find(CoreModule.NAME).provider().getService(ConfigService.class).getGRPCPort();
             }
-            List<RemoteInstance> remoteInstances =  pods.stream()
+            List<RemoteInstance> remoteInstances =
+                pods.stream()
+                    .filter(pod -> StringUtil.isNotBlank(pod.getStatus().getPodIP()))
                     .map(pod -> new RemoteInstance(
-                            new Address(pod.getStatus().getPodIP(), port, pod.getMetadata().getUid().equals(uid))))
+                        new Address(pod.getStatus().getPodIP(), port, pod.getMetadata().getUid().equals(uid))))

Review comment:
       *NULL_DEREFERENCE:*  object returned by `pod.getStatus()` could be null and is dereferenced at line 80.




----------------------------------------------------------------
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.

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