{"id":2754,"date":"2018-04-15T13:38:02","date_gmt":"2018-04-15T17:38:02","guid":{"rendered":"https:\/\/www.tmurgent.com\/TmBlog\/?p=2754"},"modified":"2018-04-15T13:38:02","modified_gmt":"2018-04-15T17:38:02","slug":"the-case-of-the-missing-app-v-files","status":"publish","type":"post","link":"https:\/\/www.tmurgent.com\/TmBlog\/?p=2754","title":{"rendered":"The case of the missing App-V files"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"Image courtesy of ddpavumba at FreeDigitalPhotos.net\" src=\"https:\/\/www.tmurgent.com\/TmBlog\/wp-content\/uploads\/2018\/04\/magnify_att_ddpavumba.jpg\" alt=\"Image courtesy of ddpavumba at FreeDigitalPhotos.net\" width=\"314\" height=\"209\" align=\"right\" \/>File this one under &#8220;<strong>Things to consider when your app doesn&#8217;t work&#8221;<\/strong>.<\/p>\n<p><strong>What the customer wanted:<\/strong><\/p>\n<p>I was working with a large customer that is in the Health Care business.\u00a0 They had an application, well maybe we should call it an integrated suite of applications, that is used to tune hearing aids.\u00a0 One major app and a ton of independently built side apps for each and every model of hearing aids under the sun.\u00a0 These devices generally connect via USB, and a few use a device driver (probably Twain) as part of the install. The side apps seem to generally be built by hardware people that understand just enough software development to talk to their hardware.\u00a0 Installer technology is not their expertise.<\/p>\n<p>The difficulty that caused the customer to consider App-V was that these side app installers many times (especially the smaller ones) did not have any kind of silent install capability, these installers were a form of home-grown exes and the vendor expected a human to click through the options.\u00a0 They had previously spent a huge amount of time trying to repackage into MSIs, but that proved unsustainable.\u00a0 This was a big ongoing problem for the customer because the devices needing this software were spread over a multi-state area with one device per location. Without remote installation capabilities somebody had to be sent to all of the machines for updates. Which could happen every month or so.\u00a0 The customer had determined that they wanted to App-V as much of the mess as they could &#8212; install once and deliver it virtually. The belief is that the side apps that did have drivers came with separate, real, installers with silent options; that part could be dealt with via SCCM and we could App-V the rest.<\/p>\n<p><strong>What went wrong with App-V:<\/strong><\/p>\n<p>When we sequenced the main application and deployed it to a test client, we had a problem that it didn&#8217;t talk to the main database.\u00a0 During the installation, I noticed that the software used Sql Compact Edition, but while there is an option to install the database locally we were using a regular SQL server on a centralized machine for the database so we assumed that Sql CE was only adding client side pieces in our install .<\/p>\n<p>The vendor error information led us to a KB that provided a command we could run at the client to repair itself. After a bit a troubleshooting at the client, we determined that two of the files in the package, both ending in the sdf file type extension, were missing from the package.\u00a0 These sdf files are associated with Windows CE, and it seems that while patient data is stored on the Sql server, these files are used to register the side apps with the main app and tell the main app how to talk to the remote database.<\/p>\n<p><strong>Troubleshooting the problem:<\/strong><\/p>\n<p>Now if you are thinking that a SQL database inside of an App-V package is a no-go, you would be half right.\u00a0 You are correct that you can&#8217;t virtualize a Sql Server instance inside an App-V package; this is due to the boot time services involved.\u00a0 The same goes for Sql Express (which replaced Sql CE many years ago). But you should think of Sql CE as more of an Access Database with a SQL syntax interface.\u00a0 It is OK to virtualize.\u00a0 I&#8217;ve done it many times and it is fine.<\/p>\n<p>But that darned SQL CE database is still giving us an issue for this app and we need to troubleshoot it.<\/p>\n<p>It is unusual for the App-V sequencer to miss any files.\u00a0 Back in the days of SoftGrid, it happened a bit but improvements in the sequencer have pretty much eliminated this as an issue. \u00a0 I considered whether it was possible that a pre-existing windows process might be responsible for writing the files. In theory this might happen with an out-of-process COM object or a Windows Service. I probably haven&#8217;t seen this happen for at least 10 years, but I do know that it is possible.<\/p>\n<p>To troubleshoot this, we would have to run a ProcMon trace of the install and look for who created the missing files. Indeed, the trace showed that it was a service that was added by the installer which created the missing files.\u00a0 Because the msi based installer added the service, we properly capture the service and all of the files associated with it laid down by the installer.\u00a0 But the installer didn&#8217;t create those files, it is the running service that created the two sdf files once the service was started.<\/p>\n<p>So why is that a problem for this app and not others with services?\u00a0 Because unlike most services added by applications, the service was not a stand-alone process that lived inside its own exe.\u00a0 This was an &#8220;old school&#8221; dll-based service that loaded itself as a thread inside of a LocalHost process.\u00a0 Because the LocalHost process was not a new process, the sequencer (properly) ignored the files created by the service.<\/p>\n<p>Feeling uncomfortable that maybe there would be\u00a0 more than just the two files we noticed, we filtered the ProcMon capture to verify.\u00a0 We filtered on just the windows service, we added a filter on SUCCESS for the Result, we added a filter on CreateFile operation, and a filter on the Details column including the word &#8220;Write&#8221;.\u00a0 The extra check on the Details column is because CreateFile really means &#8220;create a file handle&#8221; which could mean I want to read a file or open a directory to look at what is inside.\u00a0 This filtering turned 30,000 lines of trace down to about 7 lines to be verified and indeed only those two sdf files were missing.<\/p>\n<p><strong>The solution:<\/strong><\/p>\n<p>So what could we do about that?\u00a0 We can&#8217;t stop the LocalHost process for &#8220;Local System&#8221; context threads prior to sequencing because the system will crash. We identified three possible solutions:<\/p>\n<ul>\n<li>After installation, but while in monitoring mode we could run a script.\u00a0 In the early days of sequencing (SoftGrid 2.0 and 3.x) we sometimes had these kind of issues and I have a standalone exe called &#8220;touch&#8221;, a free tool <a href=\"https:\/\/www.tmurgent.com\/AppV\/en\/resources\/tools-downloads\/tools-downloads-appv4\/88-tools\/app-v-4-tools\/151-touch\">available here<\/a>.\u00a0 You run touch against each of these files while in monitoring mode and it re-writes the files.\u00a0 Since touch is a new process writing to these files, they now get captured.<\/li>\n<li>After installation, in the sequence editor we can right click on the folder and add the files one at a time.<\/li>\n<li>Every device gets every side app so we could be thinking of one monolithic App-V package, but the customer wants to limit the size of what gets sent each time something updates; so they are planning to add these side apps as separate packages via connection group. This opens up the possibility of having a package in the group that contains the latest most complete sdf files.\u00a0 So their process for adding or updating a side app would consist of just creating a package for the side app, updating the sdf package, and adding the new side app package into the connection group (&#8220;virtual environment&#8221; since they use SCCM).<\/li>\n<\/ul>\n<p>We tested by using the sequence editor and it indeed solved the problem.\u00a0 For production they&#8217;ll probably go with the third option, possibly using the script using touch as the installer for the sdf package.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>File this one under &#8220;Things to consider when your app doesn&#8217;t work&#8221;. What the customer wanted: I was working with a large customer that is in the Health Care business.\u00a0 They had an application, well maybe we should call it an integrated suite of applications, that is used to tune hearing aids.\u00a0 One major app&hellip; <a class=\"more-link\" href=\"https:\/\/www.tmurgent.com\/TmBlog\/?p=2754\">Continue reading <span class=\"screen-reader-text\">The case of the missing App-V files<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[47,48,50],"tags":[],"class_list":["post-2754","post","type-post","status-publish","format-standard","hentry","category-appv5","category-sequencing","category-tools","entry"],"_links":{"self":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts\/2754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2754"}],"version-history":[{"count":19,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts\/2754\/revisions"}],"predecessor-version":[{"id":2773,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts\/2754\/revisions\/2773"}],"wp:attachment":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}