Otavio Rodolfo Piske created CAMEL-15117:
--------------------------------------------
Summary: Consuming a subscribed message during shutdown causes NPE
Key: CAMEL-15117
URL: https://issues.apache.org/jira/browse/CAMEL-15117
Project: Camel
Issue Type: Bug
Components: camel-salesforce
Reporter: Otavio Rodolfo Piske
It seems that, sporadically, the code may throw an NPE.
I am speculating*because I cannot confirm entirely due to the sporadic nature
of the issue, but by looking at the logs and the behavior, it seems that the
onMessage handler for subscriptions can still be called during the shutdown.
{quote}2020-05-27 09:19:21,017 [orceConnector-0] INFO
org.apache.camel.impl.engine.DefaultShutdownStrategy - Graceful shutdown of 1
routes completed in 0 seconds
2020-05-27 09:19:21,018 [orceConnector-0] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - State updated: CONNECTED ->
DISCONNECTING
2020-05-27 09:19:21,018 [orceConnector-0] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - Sending messages
[\{clientId=hr1cjxz3pqn37al6x32wuz369e0, channel=/meta/disconnect, id=19}]
2020-05-27 09:19:21,018 [orceConnector-0] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - Sent disconnect
\{clientId=hr1cjxz3pqn37al6x32wuz369e0, channel=/meta/disconnect, id=19}
2020-05-27 09:19:21,018 [orceConnector-0] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - Notifying threads in waitFor()
2020-05-27 09:19:21,018 [orceConnector-0] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - Waiting 60000ms for [DISCONNECTED]
2020-05-27 09:19:21,147 [nt@4ae82baa-204] DEBUG
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$5 -
Received messages [\{clientId=hr1cjxz3pqn37al6x32wuz369e0,
channel=/meta/disconnect, id=19, successful=true}]09:19:21,147
[nt@4ae82baa-204] DEBUG org.cometd.client.BayeuxClient.67a9cb3f - Processing
\{clientId=hr1cjxz3pqn37al6x32wuz369e0, channel=/meta/disconnect, id=19,
successful=true}
2020-05-27 09:19:21,147 [nt@4ae82baa-204] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - State updated: DISCONNECTING ->
TERMINATING
2020-05-27 09:19:21,147 [nt@4ae82baa-203] DEBUG
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$5 -
Received messages [\{clientId=hr1cjxz3pqn37al6x32wuz369e0,
channel=/meta/connect, id=17, successful=true}]27 09:19:21,147
[nt@4ae82baa-203] DEBUG org.cometd.client.BayeuxClient.67a9cb3f - Processing
\{clientId=hr1cjxz3pqn37al6x32wuz369e0, channel=/meta/connect, id=17,
successful=true}
2020-05-27 09:19:21,148 [nt@4ae82baa-204] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - State updated: TERMINATING ->
DISCONNECTED
2020-05-27 09:19:21,148 [nt@4ae82baa-204] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - Notifying threads in waitFor()
2020-05-27 09:19:21,148 [orceConnector-0] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - Waited 129/60000ms for
[DISCONNECTED], state is DISCONNECTED
2020-05-27 09:19:21,148 [nt@4ae82baa-203] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - State not updated: DISCONNECTED ->
CONNECTED
2020-05-27 09:19:21,148 [nt@4ae82baa-203] DEBUG
org.cometd.client.BayeuxClient.67a9cb3f - Notifying threads in waitFor()
2020-05-27 09:19:21,169 [nt@4ae82baa-209] DEBUG
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$5 -
Received messages [\{clientId=hr1cjxz3pqn37al6x32wuz369e0,
channel=/meta/subscribe, id=18, subscription=/topic/CamelKafkaConnectorTopic,
successful=true}]td.client.BayeuxClient.67a9cb3f - Processing
\{clientId=hr1cjxz3pqn37al6x32wuz369e0, channel=/meta/subscribe, id=18,
subscription=/topic/CamelKafkaConnectorTopic, successful=true}7 09:19:21,169
[nt@4ae82baa-209] DEBUG
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper -
[CHANNEL:META_SUBSCRIBE]: \{clientId=hr1cjxz3pqn37al6x32wuz369e0,
channel=/meta/subscribe, id=18, subscription=/topic/CamelKafkaConnectorTopic,
successful=true}mel.component.salesforce.internal.streaming.SubscriptionHelper
- Subscribed to channel /topic/CamelKafkaConnectorTopic
2020-05-27 09:19:21,169 [nt@4ae82baa-209] INFO
org.cometd.bayeux.client.ClientSession - Exception while invoking listener
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$7@62e79206
java.lang.NullPointerException: null
at
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$7.onMessage(SubscriptionHelper.java:458)
~[camel-salesforce-3.3.0.jar:3.3.0]
at
org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyOnMessage(AbstractClientSession.java:583)
~[cometd-java-common-4.0.4.jar:4.0.4]
at
org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyMessageListeners(AbstractClientSession.java:568)
~[cometd-java-common-4.0.4.jar:4.0.4]
at
org.cometd.common.AbstractClientSession.notifyListeners(AbstractClientSession.java:308)
~[cometd-java-common-4.0.4.jar:4.0.4]
at
org.cometd.common.AbstractClientSession.lambda$receive$4(AbstractClientSession.java:269)
~[cometd-java-common-4.0.4.jar:4.0.4]
at org.cometd.bayeux.Promise$2.succeed(Promise.java:103)
[bayeux-api-4.0.4.jar:4.0.4]
...
{quote}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)