You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/09/24 18:40:04 UTC
[pulsar] branch master updated: fix NPE while setting stats (#2633)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 6481a4e fix NPE while setting stats (#2633)
6481a4e is described below
commit 6481a4e0722a4f8860090440584b00f2871b8ca6
Author: Rajan Dhabalia <rd...@apache.org>
AuthorDate: Mon Sep 24 11:39:58 2018 -0700
fix NPE while setting stats (#2633)
### Motivation
It fixes below NPE
```
java.lang.NullPointerException: null
at org.apache.pulsar.functions.proto.InstanceCommunication$FunctionStatus$Builder.setFailureException(InstanceCommunication.java:2155) ~[classes/:?]
at org.apache.pulsar.functions.runtime.ThreadRuntime.getFunctionStatus(ThreadRuntime.java:107) ~[classes/:?]
at org.apache.pulsar.functions.runtime.RuntimeSpawner.getFunctionStatus(RuntimeSpawner.java:107) ~[classes/:?]
at org.apache.pulsar.functions.worker.FunctionRuntimeManager.getFunctionInstanceStatus(FunctionRuntimeManager.java:260) ~[classes/:?]
at org.apache.pulsar.functions.worker.FunctionRuntimeManager.getAllFunctionStatus(FunctionRuntimeManager.java:435) ~[classes/:?]
at org.apache.pulsar.functions.worker.rest.api.FunctionsImpl.getFunctionStatus(FunctionsImpl.java:490) [classes/:?]
at org.apache.pulsar.functions.worker.rest.api.v2.FunctionApiV2Resource.getFunctionStatus(FunctionApiV2Resource.java:115) [classes/:?]
```
---
.../main/java/org/apache/pulsar/functions/runtime/ThreadRuntime.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/ThreadRuntime.java b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/ThreadRuntime.java
index d752ed7..6e8a393 100644
--- a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/ThreadRuntime.java
+++ b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/ThreadRuntime.java
@@ -104,7 +104,10 @@ class ThreadRuntime implements Runtime {
if (!isAlive()) {
FunctionStatus.Builder functionStatusBuilder = FunctionStatus.newBuilder();
functionStatusBuilder.setRunning(false);
- functionStatusBuilder.setFailureException(getDeathException().getMessage());
+ Throwable ex = getDeathException();
+ if (ex != null && ex.getMessage() != null) {
+ functionStatusBuilder.setFailureException(ex.getMessage());
+ }
statsFuture.complete(functionStatusBuilder.build());
return statsFuture;
}