Hi,
2016-10-11 18:29 GMT+02:00 Spike <sp...@drba.org>:
> for future reference in case it helps anybody stumbling into this thread, I
> found the problem altho I'm not sure of what a clean solution is and that
> it's worth investing into since it will only really cause a problem if your
> home is on NFS or a slow drive (this is going to be true for raspberry pis
> tho, so maybe worthwhile there).
>
> This is basically where the problem is on_update_string_set():
> https://github.com/lxde/lxsession/blob/master/lxsession/settings.vala#L960
>
> this is what happens:
> - main creates a config object LxsessionConfigKeyFile
> - in the constructor LxsessionConfigKeyFile calls read_keyfile(), which is
> reading the global and user desktop.conf to merge them and set defaults
> - for each allowed setting,which is listed in read_keyfile, this calls
> read_key_value which populates the in memory structure for the config file
> kf.
> - Populating the in memory structure is done by set_config_item_value and
> this is where on_update_generic is called.
> - in on_update_generic the specific type function is called, our culprit,
> on_update_string_set.
> - here save_keyfile is called which uses FileUtils.set_contents
> - looking at the manual, FileUtils.set_contents does "atomic" saves which
> means a temp file is created and then moved.
>
> This means that for every single setting in desktop.conf a temp file is
> created and then renamed to desktop.conf.
>
> Obviously this is not a desirable behavior and the file should be written
> only once after the in-memory structure has been populated.
>
> I don't know enough vala/lxde to understand where the right place is, but
> hopefully this can help somebody put together a patch.
>
Thanks a lot for tracking this bug. Yes, this is not really expected
... I made some tests with the patch attached, it reduces the number
of lxsession desktop occurrence in the strace to 7 (instead of 260).
So far, I didn't catch any regression, but I'll be very happy if you
can test the patch included, before I push it to git.
Thanks in advance.
Regards,
Julien Lavergne
diff --git a/lxsession/settings.vala b/lxsession/settings.vala
index 0456a43..43c053a 100644
--- a/lxsession/settings.vala
+++ b/lxsession/settings.vala
@@ -61,11 +61,6 @@ namespace Lxsession
config_item_db[item_key] = variable;
- if (variable != null)
- {
- on_update_generic(variable, categorie, key1, key2);
- }
-
update_support_keys (categorie, key1, key2);
}
@@ -126,6 +121,29 @@ namespace Lxsession
}
}
+ public void set_config_item_value_on_starting (string categorie, string key1, string? key2, string type, string dbus_arg)
+ {
+ /*
+ Update config_item_db, or create the config_item if it's not exist.
+ */
+ string item_key = categorie + ";" + key1 + ";" + key2 +";";
+
+ // DEBUG message ("key of read_value: %s", item_key);
+
+ if (config_item_db.contains(item_key) == true)
+ {
+ // message ("Enter if of read_value for %s, %s, %s, %s, %s: ", categorie, key1, key2, type, dbus_arg);
+ if (config_item_db[item_key] != dbus_arg)
+ {
+ config_item_db[item_key] = dbus_arg;
+ }
+ }
+ else
+ {
+ create_config_item(categorie, key1, key2, type, dbus_arg);
+ }
+ }
+
public HashTable<string, string> get_support_db(string categorie)
{
var support_db = new HashTable<string, string> (str_hash, str_equal);
@@ -623,25 +641,24 @@ public class LxsessionConfigKeyFile: LxsessionConfig
string item_key = categorie + ";" + key1 + ";" + key2 +";";
+ switch (type)
+ {
+ case "string":
+ final_variable = read_keyfile_string_value(kf, categorie, key1, key2, default_variable);
+ break;
+ }
+
if (config_item_db.contains(item_key) == false)
{
// message ("Create new config key: %s", item_key);
- create_config_item(categorie, key1, key2, type, null);
+ create_config_item(categorie, key1, key2, type, final_variable);
}
else
{
get_item(categorie, key1, key2, out default_variable, out type_output);
+ set_config_item_value_on_starting(categorie, key1, key2, type, final_variable);
}
- switch (type)
- {
- case "string":
- final_variable = read_keyfile_string_value(kf, categorie, key1, key2, default_variable);
- break;
- }
-
- set_config_item_value(categorie, key1, key2, type, final_variable);
-
}
public void read_keyfile()
@@ -1122,6 +1139,13 @@ public class RazorQtConfigKeyFile: LxsessionConfigKeyFile
string item_key = categorie + ";" + key1 + ";" + key2 +";";
+ switch (type)
+ {
+ case "string":
+ final_variable = read_razor_keyfile_bool_value(kf, categorie_razor, key1_razor, key2_razor, default_variable);
+ break;
+ }
+
if (config_item_db.contains(item_key))
{
message ("Create new config key: %s", item_key);
@@ -1130,16 +1154,9 @@ public class RazorQtConfigKeyFile: LxsessionConfigKeyFile
else
{
get_item(categorie, key1, key2, out default_variable, out type_output);
+ set_config_item_value(categorie, key1, key2, type, final_variable);
}
- switch (type)
- {
- case "string":
- final_variable = read_razor_keyfile_bool_value(kf, categorie_razor, key1_razor, key2_razor, default_variable);
- break;
- }
-
- set_config_item_value(categorie, key1, key2, type, final_variable);
}
public override void read_secondary_keyfile()
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list