Skip to content

runmqserver: fix/improve verifySingleProcess #420

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kolyshkin
Copy link

A couple of patches to improve the runmqserver check for being the only process.

1. cmd/runmqserver.verifySingleProcess: optimize

Instead of using ps, which reads three /proc files per each process
(stat, status, and cmdline), use pgrep which only reads cmdline.

Also, pgrep output is simpler -- it only lists PIDs, one per line,
so to find out the number of processes we just need to count newlines.

2. cmd/runmqserver.verifySingleProcess: improve

  1. Check command.Run error, print it out (as debug only).

  2. Simplify verifyOnlyOne() return values (bool is enough).

  3. Add more logging.

Instead of using `ps`, which reads three `/proc` files per each process
(`stat`, `status`, and `cmdline`), use `pgrep` which only reads cmdline.

Also, `pgrep` output is simpler -- it only lists PIDs, one per line,
so to find out the number of processes we just need to count newlines.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. Check command.Run error, print it out (as debug only).

2. Simplify verifyOnlyOne() return values (bool is enough).

3. Add more logging.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
Copy link
Author

@sdmarshall79 @parrobe @LPowlett PTAL

CI failure is unrelated:

Step 3/103 : FROM registry.redhat.io/ubi8/go-toolset:1.13.4-22 as builder
Get https://registry.redhat.io/v2/ubi8/go-toolset/manifests/1.13.4-22: unauthorized: Please login to the Red Hat Registry using your Customer Portal credentials. Further instructions can be found here: https://access.redhat.com/RegistryAuthentication
Makefile:267: recipe for target 'build-devserver' failed
make: *** [build-devserver] Error 1
The command "bash -e travis-build-scripts/run.sh" exited with 2.

@kolyshkin
Copy link
Author

CI failure is unrelated:

Apparently $(REGISTRY_USER) and $(REGISTRY_PASS) are not set in Travis?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant