upstart stateful re-exec tests should include json files with sessions
Bug #1200264 reported by
James Hunt
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
upstart |
Fix Released
|
Undecided
|
James Hunt |
Bug Description
As suggested by xnox and as a follow-on to bug 1199778, we need atleast 1 new test that ensures upstart is able to deserialise state data containing atleast session.
Note: although (chroot) sessions are fully serialised, they are *not* deserialised; a warning is emitted and the JobClass is ignored:
job_class_
{
:
:
/* XXX: chroot and old user session jobs not currently supported */
if (session) {
}
:
:
}
Related branches
lp:~xnox/upstart/bug-1199778
- James Hunt: Needs Fixing
-
Diff: 33253 lines (+33148/-19)5 files modifiedChangeLog (+16/-0)
init/conf.c (+9/-1)
init/state.c (+31/-17)
init/tests/data/upstart-session.json (+32985/-0)
init/tests/test_state.c (+107/-1)
Changed in upstart: | |
status: | New → In Progress |
assignee: | nobody → Dmitrijs Ledkovs (xnox) |
Changed in upstart: | |
status: | In Progress → Fix Committed |
assignee: | Dmitrijs Ledkovs (xnox) → James Hunt (jamesodhunt) |
Changed in upstart: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Above code is related to the bug in question.
Above results in len(job_classes) << len(json_ job_classes)
Looking at init/tests/ data/upstart- session. json: session. json
grep -B 1 debug upstart-
We see that job_classes are not sorted by session id and instead come in a mixed order.
Thus unconditionally calling "state_ index_to_ job_class (i)" will return bogus index for the session job_class, and eventually run out of job_classes and start returning NULL for legit system session job_classes.
My fix is to move checking the json_object for session earlier, skip and keep count of json_job_classes with session defined, and changing the call to state_index_ to_job_ class to correctly account for "gaps", ie. (i - skipped_classes).
Merge proposal on the way.