[wix-users] hold a mutex or file lock for the whole lifetime of an msi installation/update

Roland K rolandkieslinger at gmail.com
Fri Oct 20 00:53:49 PDT 2017


If I write a flag to the registry at the beginning of the install process,
is it possible, that the installation crashes so hard, that there's no
rollback and the flag remains in the registry? That's a reason, why we
thought a mutex would be a good idea, because it gets cleaned up
automatically.

I try to describe our problem a little bit further:

We have to lock our apps locally and most of the times over multiple
computers in the network too.

Let's say, our customer has 3 client computers (A, B, C) and a server. On
the server, there's always a data directory which is shared across all
client computers. In that directory, we store all of our data, which are
getting accessed by the client computers. The current "locking-system" in
our old setup (made with Wise Package Studio), which we are goging to
replace, works like this:


   1. Computer A starts our apps which create and lock a file in the data
   directory to symbolize, that they has been started and are in use.
   2. The user working on computer B wants to install an update, so the
   setup creates and locks a file in the data directory to symbolize, that all
   of our apps on different computers should be getting closed, because
   there's an update to be installed.
   3. Apps on computer A try to delete the file created by computer B, to
   make sure, the update is still going to be installed. The file cannot be
   deleted, because the setup on computer B still holds the lock on the file.
   Apps running on computer A notify the user to manually close them because
   of the update.
   4. User closes apps on computer A
   5. The setup on computer B can now delete the file created by computer
   A, because the file lock is gone.
   6. Computer B installs the update locally AND migrates data in the data
   directory. Last step is to copy the setup to the data directory and release
   the file lock.
   7. On computer A our apps are getting started again, which then detect
   the new update in the data directory and start the setup. Now, there's just
   a local app-lock necessary, because the data migration is already done.


I hope you understand, what I'm trying to accomplish in wix and msi and
what the problem is.

2017-10-19 17:28 GMT+02:00 Hoover, Jacob via wix-users <
wix-users at lists.wixtoolset.org>:

> An easier alternative to the mutex would be a CA at the beginning and end
> of the install process that would write a flag to the registry. You could
> also alter you application to include a sync object in the global
> namespace, and you could have a delayed CA at the beginning of the deferred
> install execute sequence verify that the object hasn't been created.
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
> Of Roland Kieslinger via wix-users
> Sent: Thursday, October 19, 2017 7:59 AM
> To: wix-users at lists.wixtoolset.org
> Cc: Roland Kieslinger <rkieslinger at rzl.at>
> Subject: [wix-users] hold a mutex or file lock for the whole lifetime of
> an msi installation/update
>
> Hello!
>
> I have a custom bootstrapper with an msi inside.
>
> If somebody installs an update (MajorUpgrade), I have to lock app starts
> in the meantime. When my custom bootstrapper is used, I have no problem. I
> have some good entry points where I create a mutex before installing, and
> release it afterwards. My apps check at startup, if the mutex exists and if
> yes they exit automatically. If my bootstrapper crashes, the mutex is
> released anyway.
>
> But when somebody uses my msi, how can I create a mutex or a file lock and
> hold it for the whole lifetime of an installation/update? If I use a custom
> action of type "check", the process gets spawned, i create my lock, the
> process gets killed and the lock is gone. So that doesn't work. I found
> out, there's a custom action type "asyncWait" which sounds really like what
> I'm looking for. But as I tried it out, I experienced a serious problem. I
> described it in an stackoverflow post, see here:
> https://stackoverflow.com/questions/44500740/wix-error-
> sfxca-failed-to-create-communication-pipe-for-new-ca-process-error
> Most of the time I got the error: SFXCA: Failed to create communication
> pipe for new CA process. Error code: 231
>
> Why do I get this error and is there probably another solution?
>
> Thank you in advance!
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>


More information about the wix-users mailing list