cloud-functions-emulator icon indicating copy to clipboard operation
cloud-functions-emulator copied to clipboard

maxIdle and idlePruneInterval don't seem to work?

Open shaunc869 opened this issue 6 years ago • 3 comments

Environment details

  • OS: Mac OS 10.13.4 (17E199)
  • Node.js version: v8.11.2
  • npm version: 6.1.0
  • yarn version: 1.6.0
  • @google-cloud/functions-emulator version: 1.0.0-beta.4

Steps to reproduce

  1. Run functions using this commands: functions start --maxIdle=540000 --idlePruneInterval=540000
  2. Run a simple timeout functions like this:
export async function runTimeout(req, res) {
    await timeout(80000);
    res.status(200).send('Timeout complete');
    return 'tacos';
}

function timeout(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
}
  1. Watch the log and at 60 seconds you will get:

2018-06-19T13:33:07.529Z - info: Execution took 63041 ms, finished with status: 'timeout' 2018-06-19T13:33:07.539Z - info: Execution took 63051 ms, finished with status: 'crash' 2018-06-19T13:33:07.540Z - error: Something went wrong with the function! 2018-06-19T13:33:07.540Z - error: Error: Can't set headers after they are sent. at validateHeader (_http_outgoing.js:491:11) at ServerResponse.setHeader (_http_outgoing.js:498:3) at ServerResponse.header (/Users/hackintosh/.config/yarn/global/node_modules/express/lib/response.js:767:10) at ServerResponse.send (/Users/hackintosh/.config/yarn/global/node_modules/express/lib/response.js:170:12) at ServerResponse.json (/Users/hackintosh/.config/yarn/global/node_modules/express/lib/response.js:267:15) at ProxyServer.Supervisor._proxy.on (/Users/hackintosh/.config/yarn/global/node_modules/@google-cloud/functions-emulator/src/supervisor/supervisor.js:107:14) at ProxyServer.emit (/Users/hackintosh/.config/yarn/global/node_modules/eventemitter3/index.js:144:27) at ClientRequest.proxyError (/Users/hackintosh/.config/yarn/global/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:156:18) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) 2018-06-19T13:33:08.021Z - error: Function worker killed by signal: SIGTERM

Thanks for the help, hopefully I'm just doing something wrong.

shaunc869 avatar Jun 19 '18 13:06 shaunc869

@shaunc869 were you ever able to determine why this was happening? I'm seeing the same issue with setting maxIdle and idlePruneInterval

tinaliang avatar Feb 05 '19 00:02 tinaliang

This is quite annoying as I have a couple of functions which need to be long running and I can't properly debug them locally. I have searched where this 60 second timeout might be hard coded but unfortunately without luck.

Btw. I am experiencing this when running firebase functions:shell but apparently firebase-tools uses this package.

jaschaio avatar Mar 16 '19 13:03 jaschaio

I'm having the same issue as @jaschaio. In case it helps:

OS X 10.14 Node 8.15.1 npm 6.4.1 yarn 1.15.2 @google-cloud/[email protected]

Epiphero avatar Apr 30 '19 22:04 Epiphero