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

Merged
merged 1 commit into from Feb 13, 2019
Merged

Prevents crash when there is no job entry #51622

merged 1 commit into from Feb 13, 2019

Conversation

brejoc
Copy link
Contributor

@brejoc brejoc 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/mixins.py", line 387, in _low
    data['return'] = self.functions[fun](*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/salt/runners/jobs.py", line 306, in list_jobs
    ret = mminion.returners['{0}.get_jids'.format(returner)]()
  File "/usr/lib/python2.7/site-packages/salt/returners/local_cache.py", line 376, in get_jids
    for jid, job, _, _ in _walk_through(_job_dir()):
  File "/usr/lib/python2.7/site-packages/salt/returners/local_cache.py", 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?

No

Commits signed with GPG?

Yes

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

dwoz commented Feb 13, 2019

Looks like this may fix #51585

@garethgreenaway garethgreenaway merged commit 00a6246 into saltstack:2018.3 Feb 13, 2019
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

3 participants