n8n-nodes-python icon indicating copy to clipboard operation
n8n-nodes-python copied to clipboard

Getting OOM error while running python node

Open keajer opened this issue 2 years ago • 3 comments

getting the following error: n8n may have run out of memory while executing it while executing an HTML parsing job.

n8n was assigned 20g ram, so there is no way the execution on this node would run oom. I wonder if there is a memory limit on the node itself. How can I config this limit?

keajer avatar Mar 11 '23 09:03 keajer

Hello @keajer The error you are experiencing does not seem to be related to this library. For further information, please check out this section "Memory-related errors"

naskio avatar Mar 11 '23 15:03 naskio

It unlikely its related to the overall ram from n8n. it's likely the node crashed with a wrong error message. btw, I also got an error with Cannot read properties of undefined (reading 'main') in the main n8n stdout when the python node crashes.

keajer avatar Mar 13 '23 03:03 keajer

Paste the code below for visibility

from bs4 import BeautifulSoup

for item in items:
  if 'body' in item:
    body = item['body']
  if 'headers' in item:
    headers = item['headers']

soup = BeautifulSoup(body)
tb = soup.find('tbody')
del soup
res = [i.find('span', {'class': 'titleline'}).text for i in tb.find_all('tr', {"class": "athing"})]
del tb
return [{'date': headers['date']}, {'res': res}]

keajer avatar Mar 13 '23 07:03 keajer