Skip to content

Commit 4fd1f4c

Browse files
praju-aotcberg-aot
andauthored
ORV2-3450 Defunct/Zombie processes within Openshift dops pod environment after Financial Report Generation (#1811)
Co-authored-by: Chris Berg <[email protected]>
1 parent 1dfe312 commit 4fd1f4c

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

charts/onroutebc/values.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ dops:
331331
containers:
332332
- name: dops
333333
command:
334+
- "/usr/local/bin/dumb-init"
335+
- "--"
334336
- "sh"
335337
- "-c"
336338
- "source /vault/secrets/keycloak-{{.Values.global.vault.zone}} && source /vault/secrets/mssql-{{.Values.global.vault.zone}} && source /vault/secrets/ches-{{.Values.global.vault.zone}} && source /vault/secrets/cdogs-{{.Values.global.vault.zone}} && source /vault/secrets/dops-{{.Values.global.vault.zone}} && source /vault/secrets/s3-{{.Values.global.vault.zone}} && npm run start:prod"

dops/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ RUN apk add --no-cache \
123123

124124
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
125125

126+
# It's a good idea to use dumb-init to help prevent zombie chrome processes.
127+
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 /usr/local/bin/dumb-init
128+
RUN chmod +x /usr/local/bin/dumb-init
126129

127130
# Add user so we don't need --no-sandbox.
128131
RUN addgroup -S pptruser && adduser -S -G pptruser pptruser \
@@ -136,6 +139,9 @@ USER pptruser
136139
# Expose Port
137140
EXPOSE 5001
138141

142+
# It's a good idea to use dumb-init to help prevent zombie chrome processes.
143+
ENTRYPOINT ["dumb-init", "--"]
144+
139145
# Start the app
140146
CMD ["npm", "run", "start:prod"]
141147

dops/src/modules/dgen/dgen.service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class DgenService {
224224
let page: Page;
225225
try {
226226
browser = await puppeteer.launch({
227-
args: [
227+
args: [
228228
'--no-sandbox',
229229
'--disable-gpu',
230230
'--disable-software-rasterizer',
@@ -240,6 +240,7 @@ export class DgenService {
240240
'--disable-client-side-phishing-detection',
241241
'--disable-extensions',
242242
'--disable-plugins',
243+
'--disable-setuid-sandbox',
243244
],
244245
pipe: true,
245246
headless: true,
@@ -272,6 +273,8 @@ export class DgenService {
272273
await page.close();
273274
}
274275
if (browser) {
276+
const pages = await browser.pages();
277+
await Promise.allSettled(pages?.map((page) => page.close()));
275278
await browser.close();
276279
}
277280
}

dops/src/modules/notification/notification.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export class NotificationService {
8787
'Content-Type': 'application/json',
8888
Authorization: 'Bearer ' + token,
8989
'Accept-Encoding': 'gzip, deflate, br', // Add compression support
90-
'accept': 'application/json',
90+
accept: 'application/json',
9191
},
92-
responseType: 'json'
92+
responseType: 'json',
9393
};
9494

9595
// Sending the email through the HTTP service and handling the response

0 commit comments

Comments
 (0)