Zombie threads on CalculateGradient class.

jbastosneto's picture

it seems that in the CalculateGradient Class is NOT releasing its threads.
My activity monitor shows 3000 "newly created" threads - then the program crashes:

Exception: unable to create new native thread
at org.encog.neural.networks.training.propagation.gradient.CalculateGradient.runWorkersMultiThreaded(CalculateGradient.java:351)

I have a macbook pro, 1 processor/2 cores.
I tried the finance predict example, using ScaledConjugateGradient to train the datased (360 days, inputwindow=100, hidden1count=100, hidden2Count=0)

jeffheaton's picture

I can reproduce this. No idea why, it is now using the Java thread pool. I will track it down.

You can turn off threading, and it seems to work okay. Just do this(or similar for other training types).

final ResilientPropagation train = new ResilientPropagation(network, trainingSet);
train.setNumThreads(1);

jeffheaton's picture

Through a coding error, I was creating a new threadpool on each training iteration. That was not working real well! I checked in a fix, the market example seems to work just fine. You can download it from the latest Encog 2.4 build:

http://build.heatonresearch.com/cruisecontrol/


Copyright 2005 - 2012 by Heaton Research, Inc.. Heaton Research™ and Encog™ are trademarks of Heaton Research. Click here for copyright, license and trademark information.