• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sh shell on linux with a loop that calls java hangs

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an sh shell running on linux. It has a loop and each loop instantiates another sh that instantiates a java class. This works great on a Solaris box (we are transitioning) but hangs on each iteration of the loop on a linux box. Here is the loop...

<snip>

for JRNL in `$DBRUNSCRIPT $FLAG -jm -work -q -j bmj /highwire-dev/journals/mstr/maint/db/find_portal_jobs.sql` #this command returns proper values
do
techo "portaluserjobs: Starting $JRNL"
/mstr/userjobs/scripts/userjobs -n portalRole -j $JRNL
done


<snip>


/mstr/userjobs/scripts/userjobs does...


/mstr/system/mstrjavaexec.sh $JAVA_ARGS org.highwire.mstr.client.misc.UserJobQueueClient $*

Again, this works fine on Solaris. We have made no changes to the shells. Each iteration hangs...then if I go to where the script is running and Ctrl-C it will go on to the next iteration. Not sure if this is a linux issue or not. Covering all bases as investigation thus far has not produced a solution.
-Kathy
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, nothing jumps out at me, but let's dig in a little more.

First, maybe something in mstrjavaexec.sh ? What does that do?

Second, what version of Java are you running -- the real Oracle one, or the IcedTea one, or maybe even the gcj one? They might all act differently.

Third, is the Java program a command-line or GUI program? Just wondering if there's a reason for the JVM not to exit.



 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, there are small, but annoying differences between Java on Linux and Java on Solaris. There are not-so-small differences between the Linux bash shell and the Solaris shell. Circa 2005, the Solaris 8 shell more closely resembled the 1995 Linux bash than it did the 2005 Linux bash. I never really paid attention to what - if any - improvements had been made for Solaris 10 or 11. I did find it very annoying that the distributed Tomcat for Solaris 10 was Tomcat 4, even though Tomcat 4 had passed End of Life and was no longer supported by Apache,

Check and see if hitting "Enter" will advance your script. It's possible that there's a hangup looking for data from stdin (Ctrl-D is a good bet as well). Otherwise there appears to be an issue in your Java app that prevents it from terminating.
 
Kathy King
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, So, you were all on the right track I just didn't see the responses before we solved the issue. (I should change my frequency if I'm going to be posting). So ends up the shells were fine. We are also going from Java 1.42 to 6, and from Weblogic/Apache/Jserv to Tomcat/Apache. So ends up threading is handled a bit differently since we are no longer using the same type of JVM. So adding an additional poll for life was necessary. Now everything works as expected. As to whether the code is still doing the proper tasks is the next to be scrutinized.

Thanks to all who replied!
-Kathy
 
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic