siddhi-io / siddhi-io-email

Extension that receives and publishes events via email
https://siddhi-io.github.io/siddhi-io-email/
Apache License 2.0
2 stars 31 forks source link

Issue in EmailSink.publish method exception handling #43

Closed ksdperera closed 5 years ago

ksdperera commented 5 years ago

Description: In an active/passive wso2sp setup, when a passive member became an active state, it's trying to flush the events in sink callback handler and publish out to an SMTP server. At that time if there is a Runtime Exception throw by the mail server, coordinatorChanged execution not continues and it breaks the other handers(Source/Sink and Store) activation method execution.

Exception:

message [2018-12-02 04:27:18,727]  WARN {org.wso2.carbon.cluster.coordinator.rdbms.RDBMSMemberEventListenerTask} - Error occurred while reading membership events. java.lang.RuntimeException: Error is encountered while sending the message by the email ClientConnector with properties: {From:...,To:...,...,Content-Type=text/html} at org.wso2.extension.siddhi.io.email.sink.EmailSink.publish(EmailSink.java:476) at org.wso2.siddhi.core.stream.output.sink.Sink.publish(Sink.java:135) at org.wso2.extension.siddhi.map.text.sinkmapper.TextSinkMapper.mapAndSend(TextSinkMapper.java:221) at org.wso2.siddhi.core.stream.output.sink.SinkMapper.mapAndSend(SinkMapper.java:165) at org.wso2.siddhi.core.stream.output.sink.SinkHandlerCallback.mapAndSend(SinkHandlerCallback.java:35) at org.wso2.carbon.stream.processor.core.ha.HACoordinationSinkHandler.setAsActive(HACoordinationSinkHandler.java:153) at org.wso2.carbon.stream.processor.core.ha.HAEventListener.coordinatorChanged(HAEventListener.java:77) at org.wso2.carbon.cluster.coordinator.rdbms.RDBMSMemberEventListenerTask.notifyCoordinatorChangeEvent(RDBMSMemberEventListenerTask.java:104) at org.wso2.carbon.cluster.coordinator.rdbms.RDBMSMemberEventListenerTask.run(RDBMSMemberEventListenerTask.java:77) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)

Suggested Labels:

Suggested Assignees:

Affected Product Version: WSO2SP-4.2.0

OS, DB, other environment details and versions:

Steps to reproduce: In an active/passive wso2sp setup, when a passive member became an active state, it's trying to flush the events in sink callback handler and publish out to an SMTP server. At that time if there is a Runtime Exception throw by the mail server, coordinatorChanged execution not continues and it breaks the other hander activation method execution.

Related Issues:

ksdperera commented 5 years ago

Close the issue and will be addressed with issue: https://github.com/wso2/carbon-analytics/issues/1510