spring-projects / spring-integration-extensions

The Spring Integration Extensions project provides extension components for Spring Integration
http://www.springintegration.org/
279 stars 265 forks source link

spring-integration-hazelcast LeaderInitiator shutting if error is catched during event propagation #173

Closed philnate closed 7 years ago

philnate commented 7 years ago

Hi,

I have the following scenario, where an exception is thrown during the LeaderEvent propagation. It seems like it's actually making it's way into the org.springframework.integration.hazelcast.leader.LeaderInitiator class, where it's not catched and even worse the error is swallowed and neither causes the app to die. This will leave you with an broken instance without further details to why it failed.

Not sure if I'm doing something wrong in my listener or if the LeaderInitiator should be more safeguarded around the LeaderEvent propagations.

artembilan commented 7 years ago

I think it's really just an omission, but would be better to have some test-case to play with.

Thank you!

philnate commented 7 years ago

Okay, let me put something together for you to play around.

philnate commented 7 years ago

@artembilan please see https://github.com/philnate/issues/tree/spring-intex-hzlcst-173 for a minimal example of the described scenario. I guess having at least the error logged, would be beneficial.

artembilan commented 7 years ago

OK. The problem is confirmed. And that really doesn't look like event publishing error has to lead to revoke leadership.

Yes, I agree: the simple warn should be great compromise.

One of the workaround is an executor for the SimpleApplicationEventMulticaster to prevent exception bubbling from the event listener. Another solution is a custom LeaderEventPublisher, probably just a simple extension of the DefaultLeaderEventPublisher to try...catch the target delegate invocation.

We would implement that in the DefaultLeaderEventPublisher, but that really from design perspective doesn't mean that we should allow to blow up granting by the event error.

The try...catch and warn. That's all.

For reference: https://jira.spring.io/browse/INT-4220