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

Incorrect number of processes #14

Closed
davidhq opened this issue Jan 1, 2015 · 12 comments
Closed

Incorrect number of processes #14

davidhq opened this issue Jan 1, 2015 · 12 comments

Comments

@davidhq
Copy link

davidhq commented Jan 1, 2015

Hi, I get this:

1.9 GiB +  16.0 MiB =   1.9 GiB ruby (40)

for my ruby processes but when I run ps aux | grep ruby | wc -l, I get 24, not 40... also it looks like this (a lot of defunct processes)

$ ps aux | grep ruby
david     3084  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david     5114  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    10469  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    10484  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    11420  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    13612  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    15320  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    17353  0.0  1.1 242052 47500 pts/18   Sl+   2014  52:41 ruby /home/david/.rbenv/versions/2.1.2/bin/rackup faye.ru -E production
david    17801  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    17859  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    22542  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    22876  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    23697  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    24419  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    24507  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    26512  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    26653  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    27051  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    27057  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    27655  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    28428  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    28987  0.0  1.9 256912 77896 ?        Sl    2014   0:03 ruby update_db.rb
david    29409  0.0  0.0      0     0 ?        Zs    2014   0:00 [ruby] <defunct>
david    30525  0.0  0.0   7836   836 pts/4    S+   15:10   0:00 grep ruby

what gives?

@pixelb
Copy link
Owner

pixelb commented Jan 1, 2015

ps aux gives a truncated command name.
Perhaps this gives a better count?

ps -e -o args | grep ruby

@davidhq
Copy link
Author

davidhq commented Jan 1, 2015

It gives the same number (24)

On Thu, Jan 1, 2015 at 5:33 PM, Pádraig Brady notifications@github.com
wrote:

ps aux gives a truncated command name.
Perhaps this gives a better count?

ps -e -o args | grep ruby


Reply to this email directly or view it on GitHub
#14 (comment).

@pixelb
Copy link
Owner

pixelb commented Jan 1, 2015

Do you get the same number when running as root?
sudo ps -e -o args | grep ruby

Also does splitting command line arguments give a better indication of where the ruby processes are comming from?
sudo ps_mem -s | grep ruby

@davidhq
Copy link
Author

davidhq commented Jan 2, 2015

screen shot 2015-01-02 at 11 28 57

@pixelb
Copy link
Owner

pixelb commented Jan 6, 2015

All I can suggest is to add some instrumentation to getCmdName(). Something like:

if cmd == 'ruby':
    print pid, cmd, " ".join(cmdline)

That will show the pids at least and you can see details in /proc/$pid

@davidhq
Copy link
Author

davidhq commented Jan 6, 2015

Thank you, it's getting clearer now...

Still not sure what is happening but I guess there really are that many
processes (I have some fail it looks like but I'll deal with it separatelly)

http://pastebin.com/W6dDY22S

Still not sure still why ps reports less (35 now) ?

Can you see something from that inspection?

thank you

On Tue, Jan 6, 2015 at 11:51 AM, Pádraig Brady notifications@github.com
wrote:

All I can suggest is to add some instrumentation to getCmdName().
Something like:

if cmd == 'ruby':
print cmd, " ".join(cmdline)


Reply to this email directly or view it on GitHub
#14 (comment).

@davidhq
Copy link
Author

davidhq commented Jan 6, 2015

Hmm do you think the difference is here:

david    28184  0.0  0.4 161780 16844 ?        Sl    2014   8:49 puma

2.9.2 (unix:///var/www/voter/shared/tmp/sockets/puma.sock,tcp://0.0.0.0:3009
)

vs

ruby puma 2.9.2

(unix:///var/www/voter/shared/tmp/sockets/puma.sock,tcp://0.0.0.0:3009)

plus this:

david@theta:/var/www/makersqr$ ps aux | grep spring
david 3156 0.0 0.5 160744 21356 ? Sl Jan02 0:00 spring
server | 32 | started 90 hours ago
david 3216 0.0 0.0 91048 2456 ? Sl 2014 0:00 spring
server | 108 | started 1395 hours ago
david 3272 0.0 0.6 156632 24744 ? Sl Jan02 0:00 spring
server | 38 | started 89 hours ago
david 3536 0.0 0.0 162692 2536 ? Sl 2014 0:01 spring
server | 125 | started 1203 hours ago
david 3655 0.0 0.6 156816 26128 ? Sl 17:00 0:00 spring
server | 45 | started 1 hour ago
david 3660 0.3 3.7 375956 151624 ? Ssl 17:00 0:21 spring app
| 45 | started 1 hour ago | production mode

david 3956 0.3 1.6 256372 68696 ? Ssl 2014 28:19 spring app
| 125 | started 152 hours ago | development mode

david 3959 0.3 1.6 256296 67176 ? Ssl 2014 28:30 spring app
| 125 | started 152 hours ago | production mode

david 5416 0.0 0.0 155932 2520 ? Sl 2014 0:00 spring
server | 55 | started 1749 hours ago
david 6489 0.0 0.0 91028 3108 ? Sl 2014 0:00 spring
server | 101 | started 1441 hours ago
david 6765 0.0 0.0 155844 2596 ? Sl 2014 0:01 spring
server | 23 | started 1842 hours ago

so you get more info (the whole command line?) versus just part in ps......

That's it!

On Tue, Jan 6, 2015 at 7:42 PM, David Krmpotic david.krmpotic@gmail.com
wrote:

Thank you, it's getting clearer now...

Still not sure what is happening but I guess there really are that many
processes (I have some fail it looks like but I'll deal with it separatelly)

http://pastebin.com/W6dDY22S

Still not sure still why ps reports less (35 now) ?

Can you see something from that inspection?

thank you

On Tue, Jan 6, 2015 at 11:51 AM, Pádraig Brady notifications@github.com
wrote:

All I can suggest is to add some instrumentation to getCmdName().
Something like:

if cmd == 'ruby':
print cmd, " ".join(cmdline)


Reply to this email directly or view it on GitHub
#14 (comment).

@pixelb
Copy link
Owner

pixelb commented Jan 6, 2015

I thought the -s option to ps_mem might have split those out sufficiently. It would be bad if ps_mem was lumping all ruby apps together for example

@davidhq
Copy link
Author

davidhq commented Jan 7, 2015

Looks like your -s option could be improved because it doesn't operate on the same command line strings as your grouping function... that's why it didn't return ruby spring and ruby puma stuff when I tried it... your debug code did.

@cybernet
Copy link

nothing new ?

@allanlaal
Copy link

allanlaal commented Oct 19, 2022

@davidhq @cybernet please check if #75 fixed it :)

@davidhq
Copy link
Author

davidhq commented Oct 20, 2022

@davidhq @cybernet please check if #75 fixed it :)

👍 👍

@davidhq davidhq closed this as completed Oct 20, 2022
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

4 participants