ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Karachentsev <dkarachent...@gridgain.com>
Subject Re: Connection Cleanup when IgniteCallable Killed
Date Fri, 11 Nov 2016 14:55:51 GMT
Hi Jaime.

Actually tasks are interrupted, you can find how it works in following
code: (for Ignite 1.7) in GridJobProcessor.onEvent() calls
GridJobProcessor.cancelJob(GridJobWorker, boolean) for each task that leads
to interruption.

If there down on your code was caught InterruptedException but not called
Thread.currentThread().interrupt() the interrupted flag will be false.
Please check if you can get exceptions that have InterruptedException in
their cause and close your resources properly.

If it's not possible, you may use a workaround, for example, pass to
callable client's ClusterNode and check periodically if it's alive:

// Call on client side before broadcasting
final ClusterNode locNode = ignite.cluster().localNode();

// Check in callable if it's not null
if (Ignition.localIgnite().cluster().forNode(locNode).node() == null)
  // Close resources

But it's better to handle interruption correctly, because task may be
cancelled due to various reasons.

Hope that helps.

On Fri, Nov 11, 2016 at 6:59 AM, jaime spicciati <jaime.spicciati@gmail.com>
wrote:

> All,
> I currently broadcast an IgniteCallable in my cluster which opens
> connections to various resources, specifically Zookeeper via Apache
> Curator.
>
> If the originating node (the client that launched the IgniteCallable) is
> stopped prematurely I see that Ignite will rightfully cancel the broadcast
> call within the cluster. This is all great but Apache Curator has a thread
> in the background watching Zookeeper. So when Ignite stops the
> IgniteCallable in the cluster the connection to Zookeeper is still open
> which is keeping ephemeral nodes from being deleted.
>
> I tried implementing logic to handle thread interrupts to close the
> zookeeper connection but it doesn't look like IgniteCallable is cancelled
> through interrupts. I looked through the Ignite code base and can't quite
> figure out how it is cancelling my IgniteCallable so that I can hook into
> the IgniteCallable life cycle.
>
> Long story short, how do I do resource/connection cleanup in an
> IgniteCallable when the client disconnects ungracefully, and the connection
> is held by a thread launched from within the IgniteCallable?
>
> Thanks
>

Mime
View raw message