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

questdb.sh stop and status options fail to find pid on FreeBSD using ps -ef #1264

Closed
hraftery opened this issue Aug 19, 2021 · 4 comments
Closed

Comments

@hraftery
Copy link
Contributor

Describe the bug

Running questdb.sh status -d path/to/root/dir or questdb.sh stop -d path/to/root/dir returns "Not running", even when QuestDB has been started with questdb.sh start -d path/to/root/dir and is running, as evidenced by a listing in the process table and a functional web console.

Closer inspection reveals that both commands call "export_pid" which uses ps -ef to find the process. On FreeBSD this command returns truncated output that does not necessarily contain the process label. The equivalent on FreeBSD to the Linux ps -ef is ps auwwx. Modifying "export_pid" to use that command instead results in expected behaviour (see Additional context below).

To Reproduce

  • Fresh instance of FreeBSD 12.2-RELEASE-p1
  • Fresh download of questdb-6.0.4-rt-freebsd-amd64
  • Install bash with pkg install bash since it is (unexpectedly) required by questdb.sh
  • Run questdb-6.0.4-rt-freebsd-amd64/bin/questdb.sh start
  • Run questdb-6.0.4-rt-freebsd-amd64/bin/questdb.sh status
  • Run questdb-6.0.4-rt-freebsd-amd64/bin/questdb.sh stop

Expected behavior
What happens when I fix the export_pid function. That is status reports the PID, and stop ends the process.

Screenshots
N/A

Environment (please complete the following information):

  • OS: FreeBSD 12.2-RELEASE-p1
  • Browser: N/A
  • Version: questdb-6.0.4

Additional context

A potential diff that fixes this issue is:

41a42,50
> case `uname` in
>    FreeBSD)
>        export PS_CMD="ps auwwx"
>        ;;
>    *)
>        export PS_CMD="ps -ef"
>        ;;
> esac
> 
66c75
<     export QDB_PID=`ps -ef | grep ${QDB_PROCESS_LABEL} | grep -v grep | tr -s " " | cut -d " " -f ${PID_FIELD}`
---
>     export QDB_PID=`${PS_CMD} | grep ${QDB_PROCESS_LABEL} | grep -v grep | tr -s " " | cut -d " " -f ${PID_FIELD}`
@hraftery
Copy link
Contributor Author

By the way, I should say that the "potential diff" I've provided is probably not a great solution. Given that "Darwin" is a BSD, the two cases should probably be merged.

@ideoma
Copy link
Collaborator

ideoma commented Sep 2, 2021

Thanks for the issue and fix suggestion @hraftery,
If you don't mind a pull request with the fix would be really appreciated. FreeBSD is on the exotic side for the team at the moment.

hraftery pushed a commit to hraftery/questdb that referenced this issue Sep 2, 2021
@hraftery
Copy link
Contributor Author

hraftery commented Sep 2, 2021

Okay, willing to give it a go, but note it's difficult for me to test well across OS's. PR submitted. Tested in my personal Darwin environment as a mitigation against silly regressions, but not much beyond that.

ideoma pushed a commit that referenced this issue Sep 2, 2021
@bsmth
Copy link
Contributor

bsmth commented Sep 7, 2021

This should be fixed as of #1282 - thanks @hraftery !

@bsmth bsmth closed this as completed Sep 7, 2021
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

3 participants