Skip to content

Commit

Permalink
fix!: remove child process option
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Aug 18, 2022
1 parent 410d1dd commit 0dacf7a
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 246 deletions.
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ All CLI options are optional:
--printOutput Turns on logging of your lambda outputs in the terminal.
--reloadHandler Reloads handler with each request.
--resourceRoutes Turns on loading of your HTTP proxy settings from serverless.yml
--useChildProcesses [This option is deprecated] Run handlers in a child process.
--useDocker Run handlers in a docker container.
--useInProcess Run handlers in the same process as 'serverless-offline'.
--webSocketHardTimeout Set WebSocket hard timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 7200 (2 hours)
Expand Down Expand Up @@ -188,15 +187,6 @@ Lambda handlers for the `node.js` runtime can run in different execution modes w
- global state is being shared across lambda handlers as well as with `serverless` and `serverless-offline`
- easy debugging

#### child-processes

- handlers run in a separate node.js instance
- memory is not being shared between handlers, memory consumption is therefore higher
- memory is being released when handlers reload or after usage
- environment (process.env) is not being shared across handlers
- global state is not being shared across handlers
- debugging more complicated

#### docker

- handlers run in a docker container
Expand Down
5 changes: 0 additions & 5 deletions src/config/commandOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ export default {
type: 'boolean',
usage: 'Turns on loading of your HTTP proxy settings from serverless.yml.',
},
useChildProcesses: {
type: 'boolean',
usage:
'[This option is deprecated] Use separate node process to run handlers.',
},
useDocker: {
type: 'boolean',
usage: 'Uses docker for node/python/ruby/provided',
Expand Down
1 change: 0 additions & 1 deletion src/config/defaultOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default {
printOutput: false,
reloadHandler: false,
resourceRoutes: false,
useChildProcesses: false,
useDocker: false,
useInProcess: false,
webSocketHardTimeout: 7200,
Expand Down
15 changes: 1 addition & 14 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,21 +580,8 @@ export default class HttpServer {

// Failure handling
let errorStatusCode = '502'
if (err) {
// Since the --useChildProcesses option loads the handler in
// a separate process and serverless-offline communicates with it
// over IPC, we are unable to catch JavaScript unhandledException errors
// when the handler code contains bad JavaScript. Instead, we "catch"
// it here and reply in the same way that we would have above when
// we lazy-load the non-IPC handler function.
if (this.#options.useChildProcesses && err.ipcException) {
return this.#reply502(
response,
`Error while loading ${functionKey}`,
err,
)
}

if (err) {
const errorMessage = (err.message || err).toString()

const found = errorMessage.match(/\[(\d{3})]/)
Expand Down
10 changes: 1 addition & 9 deletions src/lambda/handler-runner/HandlerRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class HandlerRunner {
}

async #loadRunner() {
const { useChildProcesses, useDocker, useInProcess } = this.#options
const { useDocker, useInProcess } = this.#options
const { handler, runtime } = this.#funOptions

log.debug(`Loading handler... (${handler})`)
Expand Down Expand Up @@ -56,14 +56,6 @@ export default class HandlerRunner {
}

if (supportedNodejs.has(runtime)) {
if (useChildProcesses) {
const { default: ChildProcessRunner } = await import(
'./child-process-runner/index.js'
)

return new ChildProcessRunner(this.#funOptions, this.#env)
}

if (useInProcess) {
const { default: InProcessRunner } = await import(
'./in-process-runner/index.js'
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/lambda/handler-runner/child-process-runner/index.js

This file was deleted.

This file was deleted.

26 changes: 0 additions & 26 deletions tests/lambda-run-mode/child-processes/instances/serverless.yml

This file was deleted.

20 changes: 0 additions & 20 deletions tests/lambda-run-mode/child-processes/instances/src/handler.js

This file was deleted.

This file was deleted.

0 comments on commit 0dacf7a

Please sign in to comment.