Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UNIXProcess.forkandExec() hang?

 
R Deepak Ram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings!

I'm using tomcat 3.2 with apache 1.3.x on JDK 1.3.1_03 on RedHat Linux 7.2.

One of my servlets calls an external program using the exec() call.

Sometimes, (noticed no pattern), exec() locks up and the external program does not get called. After this happens, everything else trying to do an exec locks up at the same point too!

Nothing is synchronized, and SingleThreadModel is not used for the servlet.

Here is a thread dump...

"Thread-183" prio=1 tid=0x81f2960 nid=0x2006 waiting on monitor [0xabbfd000..0xabbff8b0]
at java.lang.Object.wait(Native Method)
- waiting on <43b53fe0> (a java.lang.Object)
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:139)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:546)
at java.lang.Runtime.exec(Runtime.java:413)
at java.lang.Runtime.exec(Runtime.java:356)
at java.lang.Runtime.exec(Runtime.java:320)
at CygNet.Html.p2ms.reports.ReportBuilder.drawGraph(ReportBuilder.java:86)
at CygNet.Html.p2ms.reports.ReportGenerator.generateReport(ReportGenerator.java:644)
at CygNet.Html.Reports.LinkUtilServlet.generateUtilReport(LinkUtilServlet.java:119)
at CygNet.Html.Reports.LinkUtilServlet.service(LinkUtilServlet.java:77)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection(Ajp13ConnectionHandler.java:160)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:479)


All the locked processes have a

- waiting on <43b53fe0> (a java.lang.Object)

Any hints?

Thanks
 
R Deepak Ram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also,

"process forker" daemon prio=1 tid=0x682093e8 nid=0x5149 waiting on monitor [0xbe1ff000..0xbe1ff8b0]
at java.lang.Object.wait(Native Method)
- waiting on <43b53fe0> (a java.lang.Object)
at java.lang.UNIXProcessForker.run(Native Method)
at java.lang.Thread.run(Thread.java:479)
 
Ulas Ergin
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try exhausintg our and err streams of the process via seperate threads,

the OS has some buffer for these and if you don't consume them you may got in trouble

hope this helps
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulas Ergin:
try exhausintg our and err streams of the process via seperate threads,

the OS has some buffer for these and if you don't consume them you may got in trouble

hope this helps


'out' and 'err' streams he means.
 
m qasim
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also close the error, output and input streams and call process.waitFor(),process.destroy()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic