ibm-messaging / mq-container

Container images for IBM® MQ
Apache License 2.0
255 stars 189 forks source link

runmqserver: fix/improve verifySingleProcess #420

Open kolyshkin opened 4 years ago

kolyshkin commented 4 years ago

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.

kolyshkin commented 4 years ago

@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 commented 4 years ago

CI failure is unrelated:

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