You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Alexander Ivanov <rs...@list.ru> on 2017/06/15 19:56:12 UTC

Threads leaks problem...

Hi,  All!

I found that during the execution Ignite 2.0 accumulate threads with the
name 'pool-<n>-thread-<m>' and as result occurs OutOfMemoryException -
unable to create native thread.

Research led me to a method IgniteUtiuls.filterReachable():

/ public static List<InetAddress> filterReachable(Collection<InetAddress>
addrs) {
        final int reachTimeout = 2000;

        if (addrs.isEmpty())
            return Collections.emptyList();

        if (addrs.size() == 1) {
            InetAddress addr = F.first(addrs);

            if (reachable(addr, reachTimeout))
                return Collections.singletonList(addr);

            return Collections.emptyList();
        }

        final List<InetAddress> res = new ArrayList<>(addrs.size());

        Collection<Future&lt;?>> futs = new ArrayList<>(addrs.size());

     *   ExecutorService executor =
Executors.newFixedThreadPool(Math.min(10, addrs.size()));
*
        for (final InetAddress addr : addrs) {
            futs.add(executor.submit(new Runnable() {
                @Override public void run() {
                    if (reachable(addr, reachTimeout)) {
                        synchronized (res) {
                            res.add(addr);
                        }
                    }
                }
            }));
        }

        for (Future<?> fut : futs) {
            try {
                fut.get();
            }
            catch (InterruptedException e) {
                Thread.currentThread().interrupt();

*                throw new IgniteException("Thread has been interrupted.",
e);*
            }
            catch (ExecutionException e) {
*                throw new IgniteException(e);*
            }
        }

*        executor.shutdown();*

        return res;
    }
/

I think that should be mandatory call *executor.shutdown()*, for example in
the finalize block.

Alexander



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Threads-leaks-problem-tp13828.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Threads leaks problem...

Posted by ezhuravlev <e....@gmail.com>.
Hi,

This issue already was fixed, here is a ticket:
https://issues.apache.org/jira/browse/IGNITE-5225

Evgenii



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Threads-leaks-problem-tp13828p13962.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.