louislam / dockge

A fancy, easy-to-use and reactive self-hosted docker compose.yaml stack-oriented manager
https://dockge.kuma.pet
MIT License
12.19k stars 351 forks source link

[agents] Error from the socket server after agent removed #356

Open tippfehlr opened 8 months ago

tippfehlr commented 8 months ago

⚠️ Please verify that this bug has NOT been reported before.

πŸ›‘οΈ Security Policy

Description

I removed an agent, now every ~3 seconds this error is logged:

dockge-dockge-1  | 2024-01-10T11:15:28Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001

the agent management is great, I removed it for other reasons

πŸ‘Ÿ Reproduction steps

πŸ‘€ Expected behavior

The dockge host does not try to connect to the agent anymore.

πŸ˜“ Actual Behavior

The dockge host (probably) tries to connect to the agent, fails (because it is no longer online) and throws/reports an error.

Dockge Version

1.4.1

πŸ’» Operating System and Arch

Debian/Armbian

🌐 Browser

Firefox 121.0.1

πŸ‹ Docker Version

Docker version 24.0.7, build afdd53b

🟩 NodeJS Version

No response

πŸ“ Relevant log output

…
dockge-dockge-1  | 2024-01-10T11:13:46Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:13:54Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:02Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:05Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:09Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:17Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:25Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:28Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:31Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:34Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:37Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:45Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:48Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:14:56Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:04Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:08Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:11Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:17Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:20Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:28Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:36Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:44Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
dockge-dockge-1  | 2024-01-10T11:15:52Z [AGENT-MANAGER] ERROR: Error from the socket server: raspberrypi:5001
…
DomiiBunn commented 4 days ago

It actually keeps on attempting to connect to deleted agents.

I'm looking at the code now and might find a fix

DomiiBunn commented 4 days ago

Replication

Add a new agent, Bring the agent offline Delete the agent

Agent is removed from the db however it is kept as a connection state in socket.io

Solution. Call socket.disconnect before deleting the agent.

A temporary solution. Restart the dockge docker container by hand. It will no longer have the connection in memory