upstart stateful re-exec tests should include json files with sessions

Bug #1200264 reported by James Hunt on 2013-07-11
This bug affects 1 person
Affects Status Importance Assigned to Milestone
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:


         /* XXX: chroot and old user session jobs not currently supported */
        if (session) {
                nih_info ("WARNING: deserialisation of user/chroot "
                                "sessions not currently supported");
                goto error;



Related branches

Dimitri John Ledkov (xnox) wrote :

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:
grep -B 1 debug upstart-session.json

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.

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.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers