ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Ivanov <rsm...@list.ru>
Subject Threads leaks problem...
Date Thu, 15 Jun 2017 19:56:12 GMT
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.

Mime
View raw message