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

Change NDT init script to use $PATH variable when counting numer of running processes #57

Closed
aaronmbr opened this issue Mar 31, 2015 · 1 comment

Comments

@aaronmbr
Copy link
Contributor

Original issue 57 created by aaronmbr on 2011-05-17T11:16:35.000Z:

A User writes:


Hi,

Problem that had me scratching my head for a while, with fix:

web100srv wouldn't start:

[root@ndt init.d]# ./ndt restart
Stopping web100srv: [FAILED]
Stopping fakewww: [ OK ]

Starting fakewww: [ OK ]

Nothing in logs etc etc

Digging deeper

[root@ndt init.d]# sh -x ./ndt start
...

  • start_web100srv
    ++ ps auxw
    ++ grep web100srv
    ++ grep -v grep
    ++ wc -l
  • cnt=1
  • '[' 1 = 0 ']'
  • start_fakewww
  • '[' '!' 1 = 0 ']'
    ++ ps auxw
    ++ grep fakewww
    ++ grep -v grep
    ++ wc -l
  • cnt=0
  • '[' 0 = 0 ']'
  • echo -n 'Starting fakewww:'
    Starting fakewww:+ /usr/sbin/fakewww -f /index.html -s -l /var/log/ndt/fakewww_access.log -e /var/log/ndt/fakewww_error.log
  • RETVAL=0
    ...

    It doesn't even try to start web100srv

[root@ndt init.d]# ps auxw | grep web100srv
root 6930 0.0 0.0 3824 536 ? S Apr12 0:00 tail -f /var/log/ndt/web100srv.log

root 20412 0.0 0.0 4020 712 pts/1 R+ 16:15 0:00 grep web100srv

Because I was doing a tail on web100srv.log, the web100srv program itself couldn't be restarted!
Heisenberg strikes again !!

Change the greps in /etc/init.d/ndt to include the bin path

cnt=ps auxw | grep $path/web100srv | grep -v grep | wc -l

cnt=ps auxw | grep $path/fakewww | grep -v grep | wc -l

and you can now tail the log file and restart the server

[root@ndt init.d]# tail -f /var/log/ndt/web100srv.log &
[1] 20829
[root@ndt init.d]# Web100srv (ver 3.4.4a) process (20438) started May 17 16:17:12
May 17 16:18:11 150.101.154.1 port 34448
spds[0] = ' 0 0 653 773 0 8 0 0 0 0 8 0 1.61 0 0 0 1 0' max=773 [53.91%]
spds[1] = ' 0 0 305 335 2 5 0 0 0 0 218 0 1.28 6 7 852 0 218' max=335 [51.78%]
spds[2] = ' 0 0 14 4371 1719 8 10 36 290 5862 2 0 7.24 0 0 0 1 0' max=5862 [47.62%]
spds[3] = ' 0 0 12 613 5412 26 4 0 2 0 237 0 14.46 161 16 6129 0 237' max=5412 [89.17%]
May 17 16:18:11,150.101.154.1,481,12859,1487,0,430023,6070,16,2,12313,0,1408,237,6306,467456,33554432,235136,209562,10649314,67794,17730720,10,11,1,116864,297,467456,0,0,0,0,1,3,3,9,4,2,12313,45,13,22,5750,0,126,0,-1208958976,3,0,248,0,6951008,2816,235136,2
Web100srv (ver 3.4.4a) process (20816) started May 17 16:36:25

[root@ndt init.d]# ./ndt restart
Stopping web100srv: [ OK ]
Stopping fakewww: [ OK ]
Starting web100srv: [ OK ]
Starting fakewww: [ OK ]

[root@ndt init.d]# Web100srv (ver 3.4.4a) process (20845) started May 17 16:36:49

@aaronmbr
Copy link
Contributor Author

Comment #1 originally posted by aaronmbr on 2011-05-17T11:24:24.000Z:

Fix committed in r394.

@aaronmbr aaronmbr self-assigned this Mar 31, 2015
pboothe added a commit that referenced this issue Jul 20, 2016
* Three small bugfixes, one of which was causing real issues for MLab servers in developing nations.
A one-line compiler warning fix for test_c2s.
Fixing watchdog timer issues in web100srv.  (The server bug)
Making end-to-end unit tests less flaky by no longer just assuming that every port in the range [1024, 31024) is fine for the server to take as its own.

* Moved helper functions to testutils, so that they can be used by both c2s
and s2c. Used those new helper functions to fix a freezing error in s2c,
where the s2c test pauses until it hears back from the packet trace
engine, and so if the packet trace engine fails to start, then the s2c
test just freezes forever.

* Updated in response to comments by Josh to eliminate `strlen()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant