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

Prevents crash when there is no job entry #51622



Copy link

commented Feb 13, 2019

What does this PR do?

Seems like in rare race conditions it might happen that there is no job entry. This prevents Salt from crashing at that point.

In rare cases we could see this while bootstrapping a minion:

Exception occurred in runner jobs.list_jobs: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/client/", line 387, in _low
    data['return'] = self.functions[fun](*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/salt/runners/", line 306, in list_jobs
    ret = mminion.returners['{0}.get_jids'.format(returner)]()
  File "/usr/lib/python2.7/site-packages/salt/returners/", line 376, in get_jids
    for jid, job, _, _ in _walk_through(_job_dir()):
  File "/usr/lib/python2.7/site-packages/salt/returners/", line 80, in _walk_through
    jid = job['jid']
TypeError: 'NoneType' object has no attribute '__getitem__'

I'm sure that the cause of this can be found somewhere else. But in the meantime it would be nice if Salt wouldn't crash at that point of time.

Previous Behavior

Salt threw a TypeError like above.

New Behavior

Salt logs an error instead.

Tests written?


Commits signed with GPG?


Seems like in rare race conditions it might happen that there is no job
entry. This prevents Salt from crashing at that point.

This comment has been minimized.

Copy link

commented Feb 13, 2019

Looks like this may fix #51585

dwoz approved these changes Feb 13, 2019
@dwoz dwoz requested a review from garethgreenaway Feb 13, 2019
@garethgreenaway garethgreenaway merged commit 00a6246 into saltstack:2018.3 Feb 13, 2019
10 checks passed
10 checks passed
WIP Ready for review
continuous-integration/jenkins/pr-merge This commit looks good
jenkins/pr/docs The docs job has passed
jenkins/pr/lint Python lint test has passed
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
jenkins/pr/py2-windows-2016 The py2-windows-2016 job has passed
jenkins/pr/py3-centos-7 The py3-centos-7 job has passed
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
jenkins/pr/py3-windows-2016 The py3-windows-2016 job has passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.