<div dir="ltr">Thanks for the good analysis James!<div><br></div><div>I don't think that deleting on startup is an optimal idea. It is counter-intuitive that the user must open every activity on their computer when they want to reclaim space. It is also bad in the case of infrequently used activities.</div><div><br></div><div>I think that a multi-pronged approach would be better. As you noted, the activity clearing their tmp and instance folders themselves is optimal (option 3). I agree with this, as it takes load out of the shell process and means that the filesystem space is reclaimed a quick as possible.</div><div><br></div><div>However, to deal with the issue of crashing or non-sugar3 activities, we could also delete ALL tmp and instance folders during the shutdown process (after stopping all activities is successful). In the best case, this should be as quick as running ls on all of the folders (which is quick right?). It also helps users who are upgrading their system and preserving their .sugar directory. The shell does also not need to be responsive during shutdown.</div><div><br></div><div>Thanks,</div><div>Sam</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 20, 2016 at 1:50 PM, James Cameron <span dir="ltr"><<a href="mailto:quozl@laptop.org" target="_blank">quozl@laptop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The API documentation was wrong, and has been edited.<br>
<br>
<a href="https://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API" rel="noreferrer" target="_blank">https://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API</a><br>
<br>
Rainbow did delete instance and tmp. Sugar did not.<br>
<br>
Rainbow has not been in OLPC OS for some time. (/etc/olpc-security<br>
must exist, /usr/bin/rainbow-run must be executable).<br>
<br>
Rainbow is not in other builds that use Sugar.<br>
<br>
Sugar activities that were coded for Rainbow, and against this<br>
documentation, will leave an instance and tmp directory on the<br>
system. Every activity.<br>
<br>
Sugar must delete both directories.<br>
<br>
The next question is when?<br>
<br>
<br>
0. on reinstall of OLPC OS, or reboot of SoaS,<br>
<br>
This is what we do at the moment.<br>
<br>
<br>
1. on Sugar start,<br>
<br>
cleanup_temporary_files in sugar:src/jarabe/main.py might be extended,<br>
so that Sugar starts up and deletes the directories.<br>
<br>
Disadvantage is a small delay during Sugar start, the need to iterate<br>
over the bundle ids, and which list of bundles to use.<br>
<br>
<br>
2. on activity start,<br>
<br>
The activity factory module function get_environment() in<br>
sugar-toolkit-gtk3:src/sugar3/activity/activityfactory.py<br>
might be extended to delete first, before making the directories.<br>
<br>
Disadvantage is a small delay during activity start.<br>
<br>
<br>
3. on activity close<br>
<br>
In the Activity class method _complete_close() in<br>
src/sugar3/activity/activity.py we might delete the directories as the<br>
activity is closing.<br>
<br>
Disadvantage is that an activity that crashes won't delete the<br>
directories.<br>
<br>
Advantage is that any waste will be cleaned as soon as possible.<br>
<br>
<br>
4. on activity close in shell<br>
<br>
Disadvantage is that Sugar may be momentarily unresponsive when an<br>
activity closes or crashes.<br>
<br>
<br>
Can we work toward a consensus?<br>
<br>
My preference is on activity start, since that is the last time it<br>
must be done to be consistent with the design intent. Are you<br>
registered on github?<br>
<span class="im HOEnZb"><br>
On Tue, Jan 19, 2016 at 01:47:23AM +0200, Tony Anderson wrote:<br>
> At a workshop I am giving in Rwanda, an XO got 'Journal Full'. It<br>
> turns out that the Browse instance folder was using 1.2GB of store.<br>
><br>
> The low-level API says:<br>
><br>
> $SUGAR_ACTIVITY_ROOT/instance/<br>
> This directory is used similar to a /var/tmp directory, being<br>
> backed by flash rather than by RAM. It is unique per instance. It is<br>
> used for transfer to and from the datastore (see keeping and<br>
> resuming). This directory is deleted when the activity exits<br>
> (specifically, as soon as all children of the activity's first<br>
> process die)<br>
><br>
> However, apparently in 0.106 this directory is not being deleted.<br>
><br>
> Tony<br>
<br>
</span><span class="HOEnZb"><font color="#888888">--<br>
James Cameron<br>
<a href="http://quozl.netrek.org/" rel="noreferrer" target="_blank">http://quozl.netrek.org/</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" rel="noreferrer" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</div></div></blockquote></div><br></div>