Closed Bug 884985 Opened 13 years ago Closed 13 years ago

Fix race condition in deleting the TMPDIR during boot

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:koi+, firefox26 fixed, b2g18 affected)

RESOLVED FIXED
blocking-b2g koi+
Tracking Status
firefox26 --- fixed
b2g18 --- affected

People

(Reporter: ikumar, Assigned: ikumar)

References

Details

Attachments

(1 file, 1 obsolete file)

TMPDIR /data/local/tmp directory is getting removed after being created during boot! It turns out that this command in boot event: https://github.com/mozilla-b2g/gonk-misc/blob/master/init.b2g.rc#L20 is occurring after the tmp directory is created here: https://github.com/mozilla-b2g/gonk-misc/blob/master/b2g.sh#L4 so, we end up having no tmp dir after a clean boot. We need to serialize the deletion and creation.
Attachment #764952 - Flags: review?(mwu)
Assignee: nobody → ikumar
blocking-b2g: --- → koi?
tracking-b2g18: --- → ?
blocking-b2g: koi? → koi+
Attachment #764952 - Attachment is patch: true
Attachment #764952 - Attachment mime type: text/x-patch → text/plain
Comment on attachment 764952 [details] [diff] [review] Fix race condition in TMPDIR creation Review of attachment 764952 [details] [diff] [review]: ----------------------------------------------------------------- ::: init.b2g.rc @@ -16,5 @@ > user root > group radio > > on boot > - exec /system/bin/rm -r /data/local/tmp Does doing /data/local/tmp/* instead work? IIRC, we wanted to clear tmp only once on boot rather than every time b2g.sh is called.
Looks like the globbing wouldn't work as exec is just a wrapper around fork+execl, but this might work: on boot exec /system/bin/sh -c '/system/bin/rm -r /data/local/tmp/*' Do you recall the use case for why clearing tmp on every b2g.sh invocation is a problem?Developer nuisance?
I think it was just done out of paranoia. Another option might be to move all of the /data/local/tmp deletion/regeneration/cleanup to init.b2g.rc, and then make sure that stuff executes before we switch to booting services in the main class.
Depends on: 835606
Based to m1's suggestion I tried this: on boot exec /system/bin/sh -c '/system/bin/rm -r /data/local/tmp' And, this seems to work fine. I don't see any indexedDB errors and tmp dir gets created properly. I didn't want to do globbing as it may mask the issue. In case of race condition it may wipe temp files when other programs were in middle of creating/using it. If we delete the directory then at least there are more chances of the error getting reported. If we are okay with doing this then I will update the PR.
Attached patch updated patchSplinter Review
Discussed with m1 offline and realized why he added the shell there! Based on mwu's suggestion in comment 3 updating the patch to move the creation of tmp also in init.b2g.rc. I have also updated the PR: https://github.com/mozilla-b2g/gonk-misc/pull/100
Attachment #764952 - Attachment is obsolete: true
Attachment #764952 - Flags: review?(mwu)
Attachment #765541 - Flags: review?(mwu)
Attachment #765541 - Flags: review?(mwu) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: