Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.OutOfMemoryError: unable to create new native thread #36

Open
JieyingChenChen opened this issue Apr 7, 2016 · 6 comments
Open

Comments

@JieyingChenChen
Copy link

I am trying to use ELK by owlapi on a server(Linux russell 3.2.0-4-amd64 #1 SMP Debian 3.2.73-2+deb7u2 x86_64).
--java version "1.8.0_66"
--the ontology I test is snomed CT

The reasoner crashes with the error:
Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1357)
at org.semanticweb.elk.util.concurrent.computation.ComputationExecutor.start(ComputationExecutor.java:120)
at org.semanticweb.elk.util.concurrent.computation.ConcurrentComputation.start(ConcurrentComputation.java:127)
at org.semanticweb.elk.reasoner.ReasonerComputation.process(ReasonerComputation.java:90)
at org.semanticweb.elk.reasoner.stages.PropertyReflexivityComputationStage.executeStage(PropertyReflexivityComputationStage.java:58)
at org.semanticweb.elk.reasoner.stages.AbstractReasonerStage.execute(AbstractReasonerStage.java:184)
at org.semanticweb.elk.reasoner.stages.PropertyReflexivityComputationStage.execute(PropertyReflexivityComputationStage.java:28)
at org.semanticweb.elk.reasoner.stages.LoggingStageExecutor.execute(LoggingStageExecutor.java:53)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:53)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:47)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:47)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:47)
at org.semanticweb.elk.reasoner.stages.AbstractReasonerState.isInconsistent(AbstractReasonerState.java:341)
at org.semanticweb.elk.reasoner.stages.AbstractReasonerState.getTaxonomy(AbstractReasonerState.java:383)
at org.semanticweb.elk.reasoner.Reasoner.getTaxonomyNode(Reasoner.java:259)
at org.semanticweb.elk.reasoner.Reasoner.getEquivalentClasses(Reasoner.java:356)
at org.semanticweb.elk.owlapi.ElkReasoner.getEquivalentClasses(ElkReasoner.java:465)

I run the code by using the parameters: -Xmx6G -Xss1024m -Xss1024k

@ykazakov
Copy link
Member

ykazakov commented Apr 7, 2016

Which version of ELK do you use?
Also, why do you set -Xss two times? What happens with just -Xmx2G? This should be more than enough for Snomed.

@JieyingChenChen
Copy link
Author

I used an earlier version of ELK. But the same error occurred when I tried the latest version of ELK(elk-distribution-0.4.3-owlapi-library.zip) and with the parameters: -Xmx2G -Xss1024m.

The following is the error information:
Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1357)
at org.semanticweb.elk.util.concurrent.computation.ComputationExecutor.start(ComputationExecutor.java:120)
at org.semanticweb.elk.util.concurrent.computation.ConcurrentComputation.start(ConcurrentComputation.java:146)
at org.semanticweb.elk.reasoner.ReasonerComputation.process(ReasonerComputation.java:90)
at org.semanticweb.elk.reasoner.stages.PropertyReflexivityComputationStage.executeStage(PropertyReflexivityComputationStage.java:57)
at org.semanticweb.elk.reasoner.stages.AbstractReasonerStage.execute(AbstractReasonerStage.java:165)
at org.semanticweb.elk.reasoner.stages.PropertyReflexivityComputationStage.execute(PropertyReflexivityComputationStage.java:28)
at org.semanticweb.elk.reasoner.stages.LoggingStageExecutor.execute(LoggingStageExecutor.java:53)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:55)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:51)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:51)
at org.semanticweb.elk.reasoner.stages.AbstractStageExecutor.complete(AbstractStageExecutor.java:51)
at org.semanticweb.elk.reasoner.stages.AbstractReasonerState.complete(AbstractReasonerState.java:145)
at org.semanticweb.elk.reasoner.stages.AbstractReasonerState.isInconsistent(AbstractReasonerState.java:290)
at org.semanticweb.elk.reasoner.stages.AbstractReasonerState.getTaxonomy(AbstractReasonerState.java:324)
at org.semanticweb.elk.reasoner.Reasoner.getTaxonomyNode(Reasoner.java:260)
at org.semanticweb.elk.reasoner.Reasoner.getEquivalentClasses(Reasoner.java:357)
at org.semanticweb.elk.owlapi.ElkReasoner.getEquivalentClasses(ElkReasoner.java:471)

@ykazakov
Copy link
Member

ykazakov commented Apr 8, 2016

Thanks for your report! I am not sure how to diagnose this.
Does this problem happen on every run or only occasionally?
Can you make a thread dump to see if any ridiculous number of threads is created?
Do you use any custom elk.properties file, in which, e.g., the number of workers is set?
Can you set the log level to DEBUG and paste the log output?

@ykazakov
Copy link
Member

@JieyingChenChen do you still have this problem or it has been resolved? If so, could you, please, comment what you did to prevent it?

@spolavar
Copy link

@ykazakov and @JieyingChenChen, I am still experiencing randomly occurring java.lang.OutOfMemoryError error. But whenever this happens it just brings down my entire application. Here is the typical error I find:

"SEVERE: The web application [/neuroMorphoReview] appears to have started a thread named [elk-reasoner-thread-2] but has failed to stop it. This is very likely to create a memory leak."

Seem like every request I make, it is spawning some 12 threads, which are not being freed, and over time when it hits the cap, which is a default setting controlled by the tomcat container it is bringing down the application, and i see this error:

"Exception in thread "http-bio-8080-exec-21905" java.lang.OutOfMemoryError: unable to create new native thread"
I am using the elk-owlapi 0.4.3 version, and i create my reasoner object whenever needed by calling a static method, ceateReasoner.

reasoner = createReasoner(o);//o is OWLOntology object
reasoner.flush();

Any thoughts on how to trace and fix this problem will be of great help!

Thank you,
Sridevi

@ykazakov
Copy link
Member

@spolavar
ELK indeed creates threads (by default as many as there are native threads on the machine) for every reasoning request, but they should terminate when the reasoning request finishes.
Can you make a thread dump of your application and post it here so that I can check how many threads are created and where they got "stuck"?
Also, if you create a reasoner many times, do you call reasoner.dispose() after you are done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants