n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
48.32k stars 7.5k forks source link

Bad Gateway Error and Main n8n Crash if binary Data is missing in Execution View #5063

Closed prononext closed 1 year ago

prononext commented 1 year ago

I had a workflow failing because of execution data was missing. It was a workflow that downloaded images, resized them and uploaded to s3 again.

I do not know why the data was not avilable while execution, but I noticed that when I went to the execution view in UI and choose the node with the problem. I tried to view the missing binary data and at that moment it got a "Gateway Error" and the whole UI Crashed with the n8n main container in my queue setup. I tried this 4 times with the same result.

There was a log in the n8n main service.

Error: ENOENT: no such file or directory, open '/home/node/.n8n/binaryData/851a4932bf2-e66e-41f6-819a-489030c232f9.metadata'

System Details:

POSTGRESQL_VERSION_TAG=12.13
REDIS_VERSION_TAG=alpine
N8N_VERSION_TAG=0.209.2
EXECUTIONS_DATA_MAX_AGE=14
EXECUTIONS_DATA_PRUNE=true
N8N_DEFAULT_BINARY_DATA_MODE=filesystem
Joffcom commented 1 year ago

Hey @prononext,

I think the binary data only exists on disk for a limited amount of time, Maybe 24 hours with the default settings so if you are rerunning a workflow that failed that could be why. The Gateway error could be something else as well it is hard to say without seeing the full error.

janober commented 1 year ago

That is very strange. Binary data of saved executions should stay around indefinitely. Only for manual executions, where saving execution data is disabled will it be auto-deleted after a certain time.

But obviously should also never crash!

netroy commented 1 year ago

This was fixed in https://github.com/n8n-io/n8n/pull/4964. But unfortunately, all executions (with nodes that don't use streaming) between 0.206.1 and 0.208.1 are missing the metadata file, and are prone to this crash. I'll create a PR to handle this without crashing the service.

janober commented 1 year ago

Fix got released with n8n@0.213.0