Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
But when i deploy or start the script i always get
an error as -9: command not found
I have tried all the kill signals to kill the process (-SIGKILL , -15 etc..) also i tried putting single quotes instead of double quotes like JVM_ARGS="-Xms1536m -Xms1536m -XX:OnOutOfMemoryError='kill -9 %p'"
but nothing seems to work.
it's a strange behaviour on command line parser, instead of spaces use semicolons to separate arguments, some people asked oracle to change this (about two years ago), but it never happened
Offhand, it strikes me that "unleashing the Finger Of God," in the form of "the killing curse that cannot be ignored," probably isn't the best thing to do in this case.
The process will run out of memory, and if it does so, it will ... vanish without a trace and without a clue. You might at the very least wish to use a signal that will force a core-dump so that you can try to figure out what the root-cause of the problem is.
JVM has very good memory-management and should never "run out of memory," unless there is (and, undoubtedly, there is...) a very serious programming bug (logic error ... design flaw) in the system that it's being called upon to run. Well, you'll never solve the problem by destroying the evidence. And the system of which this is a part will never be reliable. There's a big difference between making an inconvenient problem disappear, and solving it.
Last edited by sundialsvcs; 01-23-2014 at 09:37 AM.
he doesn't like single quote, let's try double quote, then the only way left is using a script; as you see, he doesn't execute first arg (kill) passing the other two as argument, he treat them like 3 commands to launch
he doesn't like single quote, let's try double quote, then the only way left is using a script; as you see, he doesn't execute first arg (kill) passing the other two as argument, he treat them like 3 commands to launch
import java.util.Vector;
public class MemoryEater
{
public static void main(String[] args)
{
Vector v = new Vector();
while (true)
{
byte b[] = new byte[1048576];
v.add(b);
}
}
}
import java.util.Vector;
public class MemoryEater
{
public static void main(String[] args)
{
Vector v = new Vector();
while (true)
{
byte b[] = new byte[1048576];
v.add(b);
}
}
}
hoping you use bash (don't know if it works with other shells) just create a script "killjava.sh" or whatever you want it called:
Code:
#!/bin/bash
kill -9 $PPID
you can put it in the same script directory and call it by "./killjava.sh", or put in any directory of $PATH, like /usr/local/bin and call it directly by "killjava.sh"; remember to 'chmod 755 killjava.sh' or you'll get "Permission denied"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.