I'm ocassionally getting this error when using Penthouse with Cloud Run:
[1031/055417.851741:ERROR:address_tracker_linux.cc(201)] Could not bind NETLINK socket: Permission denied (13)
[1031/055417.854819:ERROR:file_path_watcher_linux.cc(71)] Failed to read /proc/sys/fs/inotify/max_user_watches
Inconsistency detected by ld.so: ../elf/dl-tls.c: 481: _dl_allocate_tls_init: Assertion `listp->slotinfo[cnt].gen <= GL(dl_tls_generation)' failed!
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
Unfortunately, this happens randomly after some time. When I redeploy it works, but again after some time, it will show the same error for all subsequent requests.
Since it's happening randomly, I can't figure a way to reproduce the issue.
Here is the code:
module.exports = async (req, res) => {
const browserPromise = puppeteer.launch({
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--window-size=1920,1200',
],
defaultViewport: {
width: 1920,
height: 1200,
},
});
const critical_css = await penthouse({
url: req.body.url,
cssString: req.body.css,
pageLoadSkipTimeout: 1000,
timeout: 30000,
puppeteer: {
getBrowser: () => browserPromise,
},
});
res.send(critical_css);
};
Here is the Dockerfile:
# https://hub.docker.com/_/node
FROM node:12-slim
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Create and change to the app directory.
WORKDIR /usr/src/app
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY package*.json ./
# Install production dependencies.
RUN npm ci --only=production
# Copy local code to the container image.
COPY . ./
# Run the web service on container startup.
CMD [ "npm", "start" ]
I tried increasing resources to 2 vCPUs and 4GB memory. That didn't help.
Similar issues: