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

Fix proposal for issue #1164 #47

Closed
wants to merge 1 commit into from
Closed

Fix proposal for issue #1164 #47

wants to merge 1 commit into from

Conversation

orphaner
Copy link

Sometimes Kong can't start after stoping a docker container without invoking
the kong stop command. The error message is "[ERR] dnsmasq is already running".
Since the container has been stopped, all processes in that container has been
stopped as well.

My idea is that the BaseService:is_running() method
https://github.com/Mashape/kong/blob/0.8.3/kong/cli/services/base_service.lua#L56
may not work well. It runs 'kill -0' on the pid contained in the
/usr/local/kong/*pid files which is a good idea to check if a pid exists
as a process but it does not check that the process is the expected
process. In other words, the pid contained in the dnsmasq.pid file can match
an existing process which is a totally different process than a dnsmasq one.

Furthermore, in a docker container these pids belongs to the previous launch
of the container.
The fix I suggest is to remove all the pid files contained in
/usr/local/kong before running the kong start command.

Sometimes Kong can't start after stoping a docker container without invoking
the kong stop command. The error message is "[ERR] dnsmasq is already running".
Since the container has been stopped, all processes in that container has been
stopped as well.

My idea is that the BaseService:is_running() method
https://github.com/Mashape/kong/blob/0.8.3/kong/cli/services/base_service.lua#L56
may not work well. It runs 'kill -0' on the pid contained in the
/usr/local/kong/*pid files which is a good idea to check if a pid exists
as a process but it does not check that the process is the expected
process. In other words, the pid contained in the dnsmasq.pid file can match
an existing process which is a totally different process than a dnsmasq one.

Furthermore, in a docker container these pids belongs to the previous launch
of the container.
The fix I suggest is to remove all the pid files contained in
/usr/local/kong before running the kong start command.
@subnetmarco
Copy link
Member

Fixed in 0.11 (dnsmasq removed in 0.10.x)

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

Successfully merging this pull request may close these issues.

2 participants