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

PUT /agent/force-leave endpoint returns status code 500 instead of 404 on missing node #21878

Open
AHGIJMKLKKZNPJKQR opened this issue Oct 28, 2024 · 0 comments

Comments

@AHGIJMKLKKZNPJKQR
Copy link

Overview of the Issue

The PUT /agent/force-leave/:node_name HTTP endpoint responds with a 500 Internal Server Error instead of 404 Not Found when there is no node with the specified name.


Reproduction Steps

  1. Start a consul server with version 1.19.1
  2. Run curl --verbose --request PUT <server-url>/v1/agent/force-leave/nonexistent-node
  3. See that response code is 500

Consul info for both Client and Server

Client info N/A
Server info
# consul info
agent:
	check_monitors = 0
	check_ttls = 0
	checks = 0
	services = 0
build:
	prerelease =
	revision = bf0166d8
	version = 1.19.0
	version_metadata =
consul:
	acl = disabled
	bootstrap = true
	known_datacenters = 1
	leader = true
	leader_addr = 172.17.0.2:8300
	server = true
raft:
	applied_index = 14
	commit_index = 14
	fsm_pending = 0
	last_contact = 0
	last_log_index = 14
	last_log_term = 2
	last_snapshot_index = 0
	last_snapshot_term = 0
	latest_configuration = [{Suffrage:Voter ID:a245377a-5061-3dc6-e7bf-10cf775b2027 Address:172.17.0.2:8300}]
	latest_configuration_index = 0
	num_peers = 0
	protocol_version = 3
	protocol_version_max = 3
	protocol_version_min = 0
	snapshot_version_max = 1
	snapshot_version_min = 0
	state = Leader
	term = 2
runtime:
	arch = amd64
	cpu_count = 12
	goroutines = 185
	max_procs = 12
	os = linux
	version = go1.22.4
serf_lan:
	coordinate_resets = 0
	encrypted = false
	event_queue = 1
	event_time = 2
	failed = 0
	health_score = 0
	intent_queue = 0
	left = 0
	member_time = 1
	members = 1
	query_queue = 0
	query_time = 1
serf_wan:
	coordinate_resets = 0
	encrypted = false
	event_queue = 0
	event_time = 1
	failed = 0
	health_score = 0
	intent_queue = 0
	left = 0
	member_time = 1
	members = 1
	query_queue = 0
	query_time = 1

HCL:

data_dir = "/consul/data"
server = true
bootstrap = true

Operating system and Environment details

OS: Arch linux (kernel version 6.10.12-hardened1-1-hardened)
This happens for Consul 1.19.1 when run both in docker and on bare-metal

Log Fragments

2024-10-28T12:36:59.145Z [INFO]  agent: Force leaving node: node=this-node-does-not-exist
2024-10-28T12:36:59.145Z [WARN]  agent: Failed to remove node: node=this-node-does-not-exist error="agent: No node found with name 'this-node-does-not-exist'"
2024-10-28T12:36:59.145Z [ERROR] agent.http: Request error: method=PUT url=/v1/agent/force-leave/this-node-does-not-exist from=172.17.0.1:36870 error="agent: No node found with name 'this-node-does-not-exist'"
2024-10-28T12:36:59.145Z [DEBUG] agent.http: Request finished: method=PUT url=/v1/agent/force-leave/this-node-does-not-exist from=172.17.0.1:36870 latency="94.995µs"
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

1 participant