Strange Postgres Log entries Caused by Duplicate n8n container stuck in restart loop

Hi there.
I selfhost n8n with the latest version. It runs in docker in ubuntu 20.04. Aside from docker and n8n, there is nothing else on that instance except what came stock.

My n8n database is a remote postgres 14 instance.

Recently I noticed my postgres log is filled with strange entries that I an unable to determine the source of.

In the log below, line 1 and 2 are an example of a normal update query from n8n. Notice the client.
Line 3/4 are the anomolies. Whatever is triggering those is neither specifying a database or user (hence the error). But it is coming from the same client ip.

To diagnose, I sudo docker-compose stop to stop n8n.

But still, every 1m7s the anomoly hits the logs.

Any clues would be much appreciated.

time=2021-11-22 08:03:41 PST, pid=17253  db=n8n, usr=n8n, client=10.10.10.41, line=26 DETAIL:  parameters: $1 = '{"node:AWS-SNS-Trigger":{},"node:AWS-SNS-Trigger1":{},"node:AWS-SNS-Trigger2":{},"node:AWS-SNS-Trigger-COMPLAINTS":{"webhookId":"arn:aws:sns:us-west-2:xxxxxxx:complaints:xxxxxxx"},"node:AWS-SNS-emaileventdata":{"webhookId":"arn:aws:sns:us-west-2:xxxxxxx:email_event_data:xxxxxxx"},"node:AWS-SNS-bounces":{"webhookId":"arn:aws:sns:us-west-2:xxxxxxx:bounces:xxxxxxx"}}', $2 = '7'
time=2021-11-22 08:03:41 PST, pid=17253  db=n8n, usr=n8n, client=10.10.10.41, line=27 LOCATION:  exec_execute_message, postgres.c:2154
time=2021-11-22 08:03:48 PST, pid=17266  db=[unknown], usr=[unknown], client=10.10.10.41, line=1 FATAL:  28000: no PostgreSQL user name specified in startup packet
time=2021-11-22 08:03:48 PST, pid=17266  db=[unknown], usr=[unknown], client=10.10.10.41, line=2 LOCATION:  ProcessStartupPacket, postmaster.c:2261

After I do this:

sudo systemctl stop docker.socket 
sudo systemctl stop docker.service 

The anomoly log entries stop. So it is coming from somewhere in docker.
It makes me thing it must be some sort of keep-alive? But it should really be using pg_isready for that.

Ok, I think I found the issue. Yesterday I updated n8n, and it looks like there are two containers running, except that one of them is stuck in a restart loop. When I stopped that container, the anomoly in postgres logs stopped.

I’m still curious though how this happened, did I install two instances of n8n by accident?

Once I’m sure that instance isn’t needed/used, I’ll delete it.

david@n8n:~/n8n$ sudo docker container ls
CONTAINER ID   IMAGE          COMMAND                  CREATED        STATUS                         PORTS                        NAMES
xxxxxx   n8nio/n8n      "tini -- /docker-ent…"   18 hours ago   Up 4 minutes                   10.10.10.41:5678->5678/tcp   n8n_n8n_1
yyyyyy   zzzzzzzzzz   "tini -- /docker-ent…"   6 weeks ago    Restarting (1) 2 seconds ago                                david_n8n_1