[Interest] QSettings problem.

Jason H jhihn at gmx.com
Tue Apr 17 20:19:41 CEST 2018


The way I solve slow-disk oriented issues is with atomic operations. They dirty little hack I use is to write to a file then remove & rename, which is about as atomic as you can get. Watch out that your temp location and your running location are on the same partition, else it downgrades to a copy operation. This would only help if you're reading partially written files.

It would not surprise me if the issue is too many files open on your file server. Perhaps the reason fopen() fails but stat() works is because one uses a file descriptor and the other doesn't?

> Sent: Tuesday, April 17, 2018 at 10:08 AM
> From: "Bill Crocker" <william.crocker at analog.com>
> To: "interest at qt-project.org" <interest at qt-project.org>
> Subject: [Interest] QSettings problem.
>
> Hello:
> 
> I have several users which are experiencing a problem
> using my app, which uses QSettings.
> 
> It appears that sometimes the underlying settings configuration
> file is does not appear to exist and the QSettings system resets
> back to the beginning of time, loosing all settings.
> 
> All of my users run on virtual machines and have home directories
> across NFS on Netapp based file servers.
> 
> We experienced this problem many years ago with non-Qt apps.
> 
>      You call the 'C' library open function
>      and it behaves as if the file does not exists.
>      Investigation showed that in many cases, the file really did exist
>      and was completely readable.
> 
> The solution (as stupid as it sounds) was to stat() (sys/stat.h) a file
> which did not appear to exist and then try to open it again.
> In all cases, if the file really does exist, it will then open.
> 
>      FILE *fd = fopen(file_name);
>      if( ! fd ) {
>          /* int sz = */ file_size(file_name);  // file_size uses stat()
>          fd = fopen(file_name);
>      }
> 
>      Problem solved in my other apps.
> 
> Rhetorical: Is this a Netapp issue, Is this an NFS issue. Is this an
> issue with how we are using Netapp, NFS, Virtual machines...
> There are too many people to blame and too many opportunities for finger pointing.
> It was not practical to pursue any of that.
> 
> Dear Qt: It is not a perfect world.
> 
> So, how do I fix my QSettings problem.
> 
> Thanks.
> 
> Bill
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 



More information about the Interest mailing list