Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I ssh into a server in my office, its running Lucid Lynx 10.04. I dont know why its running so many instances of java.

Thanks

This is the the console barf of $ top

Tasks: 134 total,   2 running, 132 sleeping,   0 stopped,   0 zombie
Cpu(s): 98.2%us,  1.8%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1926032k total,  1895432k used,    30600k free,    19500k buffers
Swap:  5644280k total,   192576k used,  5451704k free,   268796k cached

  PID USER      NI  VIRT  RES  SHR S %CPU %MEM    TIME+   PPID GROUP    COMMAND                                                                                                                                
27132 padmin     0 1149m 405m  10m S   58 21.6 429:33.50     1 padmin   java                                                                                                                                   
 7169 padmin     0 1134m 380m  10m S   57 20.2  37:02.32     1 padmin   java                                                                                                                                   
 1893 padmin     0 1142m 381m  10m S   51 20.3 170:03.34     1 padmin   java                                                                                                                                   
 3515 padmin     0 1105m 241m  916 S   20 12.8   4932:54     1 padmin   java                                                                                                                                   
16946 root       0 41784 7768 1084 S    1  0.4   0:00.13  6935 root     munin-node                                                                                                                             
17301 nobody     0 17368 2744 1696 R    1  0.1   0:00.03 16946 munin    memory                                                                                                                                 
16930 root       0 41784 7768 1084 S    1  0.4   0:00.13  6935 root     munin-node                                                                                                                             
   54 root       0     0    0    0 S    0  0.0  22:38.89     2 root     kondemand/0                                                                                                                            
  926 mysql      0  237m 2484  664 S    0  0.1  14:30.06     1 mysql    mysqld                                                                                                                                 
 1692 root       0 1017m  51m  27m S    0  2.7  60:31.46     1 root     mongod                                                                                                                                 
 3284 padmin     0 76400 1032  232 S    0  0.1   0:30.69     1 padmin   memcached                                                                                                                              
16012 padmin     0 19224 1424 1064 R    0  0.1   0:00.82 12115 padmin   top                                                                                                                                    
    1 root       0 23904 1316  644 S    0  0.1   0:00.74     0 root     init                                                                                                                                   
    2 root       0     0    0    0 S    0  0.0   0:00.01     0 root     kthreadd                                                                                                                               
    3 root       0     0    0    0 S    0  0.0   0:00.03     2 root     migration/0                                                                                                                            
    4 root       0     0    0    0 S    0  0.0   0:00.27     2 root     ksoftirqd/0                                                                                                                            
    5 root       0     0    0    0 S    0  0.0   0:00.21     2 root     watchdog/0                                                                                                                             
    6 root       0     0    0    0 S    0  0.0   0:00.03     2 root     migration/1                                                                                                                            
    7 root       0     0    0    0 S    0  0.0   0:00.95     2 root     ksoftirqd/1                                                                                                                            
    8 root       0     0    0    0 S    0  0.0   0:00.15     2 root     watchdog/1                                                                                                                             
    9 root       0     0    0    0 S    0  0.0   1:09.30     2 root     events/0

As you can see, all the java instances of java have the same ppid. This is a mild case. At many rabid instances, there can be upto 7-10 instances of java. Let me know if there are any-other outputs you need.

As an aside, every time i log into the server, i get a

*** System restart required ***

Are so many instances of java the reason?

EDIT: $ pstree

init─┬─apache2───5*[apache2]
     ├─atd
     ├─avahi-daemon───avahi-daemon
     ├─console-kit-dae───63*[{console-kit-da}]
     ├─cron
     ├─cupsd
     ├─dbus-daemon
     ├─dnsmasq
     ├─dovecot─┬─2*[dovecot-auth]
     │         ├─3*[imap-login]
     │         └─3*[pop3-login]
     ├─6*[getty]
     ├─java───56*[{java}]
     ├─java───67*[{java}]
     ├─libvirtd───6*[{libvirtd}]
     ├─master─┬─pickup
     │        └─qmgr
     ├─2*[memcached───5*[{memcached}]]
     ├─mongod───76*[{mongod}]
     ├─munin-node
     ├─mysqld───9*[{mysqld}]
     ├─named───4*[{named}]
     ├─nmbd
     ├─postgres───4*[postgres]
     ├─rsyslogd───3*[{rsyslogd}]
     ├─smbd───smbd
     ├─sshd───sshd───sshd───bash───pstree
     ├─udevd───2*[udevd]
     ├─upstart-udev-br
     ├─vsftpd
     └─winbindd───3*[winbindd]
share|improve this question
add comment

5 Answers

up vote 1 down vote accepted

The fact that it's a Java process doesn't tell you much about the actual application; you want to see the whole command-line. ps -fp $(pgrep -d, -x java) should give you the full commandline of each current java process (if they are short-lived processes then looking for the process first may fail as it may have finished by the time you try and find its commandline, hence doing it in a single line is a good idea)

share|improve this answer
    
using that command only shows me 3 commands. so does that mean, that the rest of what we see in the OP are zombies? –  theTuxRacer Nov 29 '10 at 11:04
    
I only see 4 java processes in your top output - they do indeed seem to be long-running processes. But what is the commandline that you see? That will tell you what the programs are and that's the first step to debugging what's going on. For example, a tomcat process shows up on my machine as: /usr/lib/jvm/java-6-openjdk/bin/java -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties -Djava.awt.headless=true -Xmx128M -XX:+UseConcMarkSweepGC -Djava.util.logging.m –  David Fraser Nov 29 '10 at 11:44
    
the total tasks shoot up to 300, and only 4 running. but when a PC connects to that server, the tasks shootup like crazy. –  theTuxRacer Nov 30 '10 at 13:53
    
Ah, but until you say what the commandline you find using the ps command above is, we're still in the dark about what the application is :) –  David Fraser Nov 30 '10 at 15:38
add comment

I don't think these represent Java threads, since each of them has a different PID.

You might have the padmin user (or a root user, or one who can use sudo for this purpose, etc.) check the command lines of these respective Java processes, using any of these methods (replacing pid with the respective number from the top output - 27132, 7169, etc.):

ps -ef | grep pid

or

cat /proc/pid/cmdline

This way, at least you can start figuring out where each of them was called from, and what it's doing.

share|improve this answer
    
The threads have different PID. Use top -H to see the threads. But they are different processes, because the allocated memory are different. The threads in a process share the same memory space. –  Mircea Vutcovici Nov 29 '10 at 2:58
    
i added the pstree OP. –  theTuxRacer Nov 29 '10 at 7:49
add comment

1) It's hard to tell without seeing your process list, but most likely you are just observing many Java threads, not many instances/processes. Java by nature very heavily uses threads and it's normal to see many of them.

2) You have updated your server and one of the updates has been a kernel upgrade. That requires a reboot for a new kernel to be used, so that's why Ubuntu asks you to restart your server.

share|improve this answer
    
1. how do I check if they are threads of processes? 2. I havent updated my server since install, and the reason I get a restart required, is because the server load is higher than 1. –  theTuxRacer Oct 27 '10 at 7:16
1  
Install htop and configure it to group threads belonging to the same process, you will then be able to visually distinguish them. –  sebastianopilla Nov 23 '10 at 15:41
    
i added the pstree OP. –  theTuxRacer Nov 29 '10 at 7:50
add comment

The System restart required is likely a result of a kernel patch being applied. A restart to use the new kernel is required. This is unrelated to the java process problem, but will likely resolve the problem temporarily.

As the PPID (parent PID) is 1 for the Java process, they are not threads. It is possible you have a command in your profile to start this application, although as it runs a user padmin, this may not be likely. A search for linux padmin java, gives a number of different possible application which may be running. The lsof command can be used to try to find out where these were started from. Then you can try to configure out what application is running.

share|improve this answer
    
the system restart message is because of system load being higher than 1. Ill edit the OP when i get it again. –  theTuxRacer Nov 24 '10 at 7:00
add comment

“ps aux | grep java” output would give much better data about the problem.

But with given data, there is single point of interest: group of those Java programs: padmin. This user is your user, right? Since you are running ”top” with that user.

You are also running memcached with your user. So I suspect you have complete server instance running with that user. Maybe Tomcat? It atleast uses Java.

With that TIME, those processes have been running for long time, so I guess they are some kind of backend threads of the program.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.