Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Add timeout to heroku run #1814

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

schneems
Copy link
Contributor

The library (Hatchet) that buildpacks use to integration test against Heroku shells out to heroku run where we're wanting to be able to configure a timeout that's less than 60 minutes. Instead of working around this on the library side, I think it would make more sense to add a configurable timeout to the cli.

This PR against Hatchet explains the issue heroku/hatchet#158.

This is a WIP as I'm not very familiar with the CLI or it's development workflow at all. I got as far as getting it to trigger an exception:

$ DEBUG=* ./bin/run run echo lol -a issuetriage -timeout 5
# ...
Running echo lol -timeout 5 on ⬢ issuetriage... done
  heroku:run RangeError [ERR_OUT_OF_RANGE] [ERR_OUT_OF_RANGE]: The value of "msecs" is out of range. It must be a non-negative finite number. Received NaN
  heroku:run     at new NodeError (node:internal/errors:329:5)
  heroku:run     at getTimerDuration (node:internal/timers:386:11)
  heroku:run     at TLSSocket.setStreamTimeout [as setTimeout] (node:internal/stream_base_commons:252:11)
  heroku:run     at /Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:126:15
  heroku:run     at new Promise (<anonymous>)
  heroku:run     at Dyno._rendezvous (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:117:16)
  heroku:run     at Dyno.attach (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:110:27)
  heroku:run     at Dyno._doStart (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:77:28)
  heroku:run     at processTicksAndRejections (node:internal/process/task_queues:94:5)
  heroku:run     at Dyno.start (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:54:9)
  heroku:run     at Run.run (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/commands/run/index.ts:36:13)
  heroku:run     at Run._run (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20)
  heroku:run     at Config.runCommand (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/config/lib/config.js:151:9)
  heroku:run     at Main.run (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/command/lib/main.js:21:9)
  heroku:run     at Main._run (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20) +0ms
RangeError [ERR_OUT_OF_RANGE] [ERR_OUT_OF_RANGE]: The value of "msecs" is out of range. It must be a non-negative finite number. Received NaN
    at new NodeError (node:internal/errors:329:5)
    at getTimerDuration (node:internal/timers:386:11)
    at TLSSocket.setStreamTimeout [as setTimeout] (node:internal/stream_base_commons:252:11)
    at ~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:126:15
    at new Promise (<anonymous>)
    at Dyno._rendezvous (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:117:16)
    at Dyno.attach (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:110:27)
    at Dyno._doStart (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:77:28)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Dyno.start (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:54:9)
    at Run.run (~/Documents/projects/work/cli/packages/run/src/commands/run/index.ts:36:13)
    at Run._run (~/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20)
    at Config.runCommand (~/Documents/projects/work/cli/node_modules/@oclif/config/lib/config.js:151:9)
    at Main.run (~/Documents/projects/work/cli/node_modules/@oclif/command/lib/main.js:21:9)
    at Main._run (~/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20)
⛄ 3.0.1 🚀  ~/Documents/projects/work/cli (schneems/timeout-lime-out)
$ gitx .
⛄ 3.0.1 🚀  ~/Documents/projects/work/cli (schneems/timeout-lime-out)

The library (Hatchet) that buildpacks use to integration test against Heroku shells out to `heroku run` where we're wanting to be able to configure a timeout that's less than 60 minutes. Instead of working around this on the library side, I think it would make more sense to add a configurable timeout to the cli.

This PR against Hatchet explains the issue heroku/hatchet#158. 


This is a WIP as I'm not very familiar with the CLI or it's development workflow at all. I got as far as getting it to trigger an exception:

```
$ DEBUG=* ./bin/run run echo lol -a issuetriage -timeout 5
# ...
Running echo lol -timeout 5 on ⬢ issuetriage... done
  heroku:run RangeError [ERR_OUT_OF_RANGE] [ERR_OUT_OF_RANGE]: The value of "msecs" is out of range. It must be a non-negative finite number. Received NaN
  heroku:run     at new NodeError (node:internal/errors:329:5)
  heroku:run     at getTimerDuration (node:internal/timers:386:11)
  heroku:run     at TLSSocket.setStreamTimeout [as setTimeout] (node:internal/stream_base_commons:252:11)
  heroku:run     at /Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:126:15
  heroku:run     at new Promise (<anonymous>)
  heroku:run     at Dyno._rendezvous (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:117:16)
  heroku:run     at Dyno.attach (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:110:27)
  heroku:run     at Dyno._doStart (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:77:28)
  heroku:run     at processTicksAndRejections (node:internal/process/task_queues:94:5)
  heroku:run     at Dyno.start (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:54:9)
  heroku:run     at Run.run (/Users/rschneeman/Documents/projects/work/cli/packages/run/src/commands/run/index.ts:36:13)
  heroku:run     at Run._run (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20)
  heroku:run     at Config.runCommand (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/config/lib/config.js:151:9)
  heroku:run     at Main.run (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/command/lib/main.js:21:9)
  heroku:run     at Main._run (/Users/rschneeman/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20) +0ms
RangeError [ERR_OUT_OF_RANGE] [ERR_OUT_OF_RANGE]: The value of "msecs" is out of range. It must be a non-negative finite number. Received NaN
    at new NodeError (node:internal/errors:329:5)
    at getTimerDuration (node:internal/timers:386:11)
    at TLSSocket.setStreamTimeout [as setTimeout] (node:internal/stream_base_commons:252:11)
    at ~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:126:15
    at new Promise (<anonymous>)
    at Dyno._rendezvous (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:117:16)
    at Dyno.attach (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:110:27)
    at Dyno._doStart (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:77:28)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at Dyno.start (~/Documents/projects/work/cli/packages/run/src/lib/dyno.ts:54:9)
    at Run.run (~/Documents/projects/work/cli/packages/run/src/commands/run/index.ts:36:13)
    at Run._run (~/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20)
    at Config.runCommand (~/Documents/projects/work/cli/node_modules/@oclif/config/lib/config.js:151:9)
    at Main.run (~/Documents/projects/work/cli/node_modules/@oclif/command/lib/main.js:21:9)
    at Main._run (~/Documents/projects/work/cli/node_modules/@oclif/command/lib/command.js:44:20)
⛄ 3.0.1 🚀  ~/Documents/projects/work/cli (schneems/timeout-lime-out)
$ gitx .
⛄ 3.0.1 🚀  ~/Documents/projects/work/cli (schneems/timeout-lime-out)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant