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

Jobber crashes if program not found #314

Open
ckotte opened this issue Sep 13, 2020 · 1 comment
Open

Jobber crashes if program not found #314

ckotte opened this issue Sep 13, 2020 · 1 comment

Comments

@ckotte
Copy link

ckotte commented Sep 13, 2020

Jobber shouldn't crash and kill the Docker container. It should print an error message similar to:

bash-5.0# jobber reload
Call to Jobber failed: yaml: line 18: found a tab character that violates indentation
bash-5.0# vi /root/.jobber 
bash-5.0# jobber reload
Call to Jobber failed: yaml: line 18: did not find expected comment or line break
bash-5.0# vi /root/.jobber 
bash-5.0# jobber reload
Call to Jobber failed: yaml: line 18: mapping values are not allowed in this context
bash-5.0# vi /root/.jobber 
bash-5.0# jobber reload
Loaded 1 jobs.

Jobfile

[...]

jobs:
  TestEcho:
    cmd: echo hello world
    time: ''
    onError: Continue
    notifyOnSuccess:
      - type: program
        path: /usr/local/bin/send_email.sh

Error in Docker logs

Failed to call /usr/local/bin/send_email.sh: Failed to fork: fork/exec /usr/local/bin/send_email.sh: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5b0396]

goroutine 7 [running]:
github.com/dshearer/jobber/common.(*ExecResult).Close.func1(...)
	/tmp/src/github.com/dshearer/jobber/common/exec.go:51
github.com/dshearer/jobber/common.(*ExecResult).Close(0x0)
	/tmp/src/github.com/dshearer/jobber/common/exec.go:58 +0x26
github.com/dshearer/jobber/jobfile.ProgramResultSink.Handle(0xc0001290e0, 0x1c, 0x0, 0x0, 0x0, 0xc000168140, 0xbfcfa53a1f684160, 0x580eb4, 0xc5c200, 0x0, ...)
	/tmp/src/github.com/dshearer/jobber/jobfile/result_sink_program.go:108 +0x1ab
main.(*JobManager).handleRunRec(0xc0000c05a0, 0xc00017e1c0)
	/tmp/src/github.com/dshearer/jobber/jobberrunner/job_manager.go:224 +0x326
main.(*JobManager).runMainThread.func1(0xc0000c05a0)
	/tmp/src/github.com/dshearer/jobber/jobberrunner/job_manager.go:259 +0x290
created by main.(*JobManager).runMainThread
	/tmp/src/github.com/dshearer/jobber/jobberrunner/job_manager.go:235 +0xe7
@ckotte
Copy link
Author

ckotte commented Sep 13, 2020

Crashes also if something else isn't right...

Failed to call /usr/local/bin/send_email.sh: Failed to fork: fork/exec /usr/local/bin/send_email.sh: exec format error
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5b0396]

goroutine 19 [running]:
github.com/dshearer/jobber/common.(*ExecResult).Close.func1(...)
	/tmp/src/github.com/dshearer/jobber/common/exec.go:51
github.com/dshearer/jobber/common.(*ExecResult).Close(0x0)
	/tmp/src/github.com/dshearer/jobber/common/exec.go:58 +0x26
github.com/dshearer/jobber/jobfile.ProgramResultSink.Handle(0xc0001fc120, 0x1c, 0x0, 0x0, 0x0, 0xc0001ea140, 0xbfcfa66891c5c9df, 0xe6022c2c1, 0xc5c200, 0x0, ...)
	/tmp/src/github.com/dshearer/jobber/jobfile/result_sink_program.go:108 +0x1ab
main.(*JobManager).handleRunRec(0xc000138090, 0xc0001e6fc0)
	/tmp/src/github.com/dshearer/jobber/jobberrunner/job_manager.go:224 +0x326
main.(*JobManager).runMainThread.func1(0xc000138090)
	/tmp/src/github.com/dshearer/jobber/jobberrunner/job_manager.go:259 +0x290
created by main.(*JobManager).runMainThread
	/tmp/src/github.com/dshearer/jobber/jobberrunner/job_manager.go:235 +0xe7

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

No branches or pull requests

1 participant