ShawnAdministrator
(KiX Supporter)
2003-11-11 07:48 PM
ReadProfileString vs WriteProfileString visavis File Contention

Sorry, ever since I saw the Architect in Matrix-reloaded, I always wanted to use the term "visavis" in a sentence - I have no idea what it means.

I want to clear-up something in my own mind, and ask anyone that is currently doing this to verify my assumptions.

Reading and writing to INI files during the login process.

We have always stated (warned) that WRITING to a common INI file during login can and may fail intermittently when two user's try to write to it at the same time, think we know this as a fact, ja ?

But - is it true that simply READING from an INI file definitely 100% does not cause this to happen. My assumption is that when Kixtart does an INI read, it opens the file read-only and does the read. If all user's are readiing it should never fail. If writing, it would quickly open the file for write, write, then close file. Thus, opportunity for collision.

Or - does it treat all IO as a potential write and open it read/write anyways. Can anyone that has much experience with just READING INI files during the login script share their experience ?

Is just reading bullet-proof ?

-Shawn


Howard Bullock
(KiX Supporter)
2003-11-11 07:54 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

If you are reading from the NETLOGON share where only READ access is granted (in NT4) and to non-Admins in W2K, then no one can lock the file for writing.

I have an old post that goes into the INI Reading/Writing issues.

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=003264#000000


Les
(KiX Master)
2003-11-11 07:55 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

Sorry for hijaaking this thread but you had it coming after that vis-a-vis thing! [Razz]

k, so I thought I'd use my trusty babelfish to translate it for you, and this is what it came up with:

"live has screw"

ROFLMAO [Big Grin] [Big Grin] [Big Grin]

[ 11. November 2003, 19:58: Message edited by: Les ]


Sealeopard
(KiX Master)
2003-11-11 07:57 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

It's actually vis-a-vis and it's French
quote:
Main Entry: 1vis-à-vis
Pronunciation: 'vEz-&-'vE, "vEs- also -ä-'vE
Function: preposition
Etymology: French, literally, face-to-face
Date: 1755
1 : face-to-face with
2 : in relation to
3 : as compared with

I'd say that READPROFILESTRING opens the file in read-only mode and does not emply file-locking mechanisms in order to prevent writes from other connections.

Anyway, I never had problems using .INI files for read-operations.


ShawnAdministrator
(KiX Supporter)
2003-11-11 08:24 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

live has screw - ROFLMAO

Ok - so I'm feeling pretty good about this then. We're going to have boat-loads (thousands) of users hitting this INI file in the morning, all at the same time (samosamo) so based on feedback thus far, should never have an issue. Thanks.


Howard Bullock
(KiX Supporter)
2003-11-11 08:32 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

How big is this file? Would you be better servers with subscripts named after the INI group headings?

ShawnAdministrator
(KiX Supporter)
2003-11-11 08:49 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

The ini file is going to be quite large and complicated. It will be replacing an application (that coincidently I wrote) quite a few years ago, before INGROUP() was in Kixtart, called GROUPIT.

GroupIt is a quasi-scripting "language" (it reads a config file really) that controls which icons the user's sees on their desktop, based on Global Group membership ... it also "caches" the user's group membership in the registry (all our internal apps look to this) - the "script" looks like this (don't laugh):

code:
 
Group IT.BccsDskIntertel

copylink "%links%\lwa\LWAnServord" "%internal%\Servord for Intertel"
copylink "%links%\lwa\LWAnMax" "%internal%\Max Prime"
copylink "%links%\lwa\LWAnSwitchView" "%internal%\Switchview"
copylink "%links%\lwa\LWAnMVIData" "%internal%\MVI Data Unit"
copylink "%links%\lwa\LWAnMVIAdmin" "%internal%\MVI Admin"

Group IT.BccsDskWfms

copylink "%links%\lwa\LWAnWFMS 613, 705" "%internal%\WFMS 613, 705"
copylink "%links%\lwa\LWAnWFMS 519" "%internal%\WFMS 519"
copylink "%links%\lwa\LWAnWFMS 416, 905" "%internal%\WFMS 416, 905"

It just parses from top to bottom saying "If the user is a member of group xxx, then copylink the shortcut from %LINKS%\... to certain desktop folders (copylink is an internal GROUPIT statment). Anyways like I said, this was written well before Kix had it's INGROUP function. I do want to retire GROUPIT and just use pure Kixtart scripting. Kixtart now has UDF support and much faster group enumeration.

Having said that, an INI file will replace this "script" ... the "group memberships" and shortcut dest/tgt pointers simply turned into INI values. But yeah Howard, it will be quite a large file.

-Shawn

[ 11. November 2003, 20:56: Message edited by: Shawn ]


Howard Bullock
(KiX Supporter)
2003-11-11 09:02 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

Do you want that much network traffic at every logon? You could use 40K CRC32.exe to validate a local copy of your large file and then use it from the local HD only coppying it to the client if it needed updated or replaced as a result of tampering.

ShawnAdministrator
(KiX Supporter)
2003-11-11 09:05 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

You know what - that's a fantastic idea.

I'm going to build that into my design ! Cache the script on the wkstn and run it locally. Check for updates (which is rarely) and re-fresh as required. Beautiful.

hmmm, security, have to think about that one. This whole desktop icon thingy was meant for cosmetics mostly, but there are some sensitive registry settings that are done through GROUPIT ...

[ 11. November 2003, 21:08: Message edited by: Shawn ]


NTDOCAdministrator
(KiX Master)
2003-11-11 09:52 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

Heck HB with AD and GPO the desktop gets hit by large files every logon every day anyways. AD should also give a local logon server with high speed access. .INI can only be up to 64K Yes maybe a little bit of a pain for dialup, but you could check that and not do on them if wanted as well.

Just my .02 cents. In the 10MB or less Network environment you might have to really consider it, but for 100MB LAN it should really not be an issue in my opinion.


ShawnAdministrator
(KiX Supporter)
2003-11-11 09:58 PM
Re: ReadProfileString vs WriteProfileString visavis File Contention

oh cripes Ron, I forgot about that 64kb limit - don't think it will be an issue but big thanks for reminding me.

MCA
(KiX Supporter)
2003-11-12 02:54 AM
Re: ReadProfileString vs WriteProfileString visavis File Contention

Dear Shawn,

The limit of 64kb for INI files is mention many times, but we are using INI's above 256kb on
our server without losing any information during the write operations. When you are loosing
information on your server it has to deal with your server configuration. With slow servers
we got damaged information in those files.

The local structure of collecting information we are also using by slow connections.
During a reconnect with a fast connection all those information will transfer to
the server.
greetings.