Updating a Running System: Shadow Copy
FlexNet Manager Suite is designed to be a high-availability system. One aspect of that is to allow updates to parts of the system without having to interrupt normal operations.
- Whenever an assembly (a part of the product code) is to be executed, it is first copied to a secondary location.
- The assembly copy is then executed from the secondary location. As a normal part of code operation, that running copy of the assembly is locked and cannot be updated.
- However, the original assembly is not in use, remains unlocked, and may be updated if necessary (even while the locked copy is executing).
- Before each invocation of the copied assembly, a check is made to see whether the original source assembly has been updated since the copy was made; and if so a new (replacement) copy is made, and used for subsequent execution.
- The shadow copy does not change anything about the operation of the assembly. For example, the same values are read from the Windows registry when appropriate; log files are written to the same locations; and so on.
- As more space for copying assemblies is required, the underlying Microsoft .NET runtime automatically cleans up copied assemblies that are no longer in use, restricting the size of the disk cache used for copied assemblies.
- The file date and time of each assembly in the application directory
- The file date and time of the matching assembly in the shadow copy directory.
Where shadow copying is used
- The FlexNet batch scheduler
- The FlexNet batch processor
- Those batch server scheduled tasks and program shortcuts that invoke either of the above
- All child processes invoked by the FlexNet batch processor.
The cache location where assemblies are copied before invocation is fixed for a given
account running the process, and is
C:\Users\useraccount\AppData\Local\assembly. (The
placeholder useraccount stands for the account used
to invoke the process. For normal operations of the batch server, this is the
service account running FlexNet Manager Suite, for which the name suggested in the
installation process was svc-flexnet
.)
Using shadow copy
Whenever you want to invoke a target executable using the shadow copy mode, you do so by first invoking a host executable that takes care of the required copying and then executes the target process in its own application domain. This host executable has the capability either to run a .NET executable or to host a .NET Windows service.
- ShadowHost.exe – used to execute console-based assemblies including the FlexNet batch scheduler and FlexNet batch processor. The batch processor service also uses ShadowHost.exe (and ShadowHost32.exe, described below) to invoke other processes that it runs.
- ShadowHostWin.exe – used to execute Windows Forms-based assemblies. You can also use this variation in the command line for Windows Scheduled Tasks where you do not want the executing process to display a console window.
- ShadowHost32.exe – used to execute assemblies that can only be run in 32-bit mode, such as the FlexNet Business Importer (MGSBI.exe).
Syntax
ShadowHost[Win|32].exe executable_name
executable_arguments
When executing a process through the console, or programmatically through a scheduled task, the variant of the ShadowHost executable that should be used is determined by how that process is to interact with the rest of the system. Consult the list above to determine which executable variant is appropriate.
Examples
- Execute the compliance reader to transfer data from staging tables to production and
calculate license
consumption:
ShadowHost.exe ComplianceReader.exe -it Writers
- Run the Business Importer (a 32-bit executable) to import data through a
custom adapter:
ShadowHost32.exe MGSBI.exe /config adapter.xml
- Specify a Microsoft scheduled task to run all inventory imports and perform license
consumption
calculations:
Executable: ShadowHostWin.exe Arguments: BatchProcessTask.exe run InventoryImport
Troubleshooting shadow copy
- Once enabled, ShadowHost[Win|32] logging writes diagnostic information to ComplianceLoggingPath\ShadowHost.
- The default value for the placeholder ComplianceLoggingPath is %ProgramData%\Flexera Software\Compliance\Logging.
- You can modify the value for ComplianceLoggingPath by creating a REG_SZ registry key at SOFTWARE\WoW6432Node\ManageSoft Corp\ManageSoft\Compliance\CurrentVersion\LoggingBaseDirectory, and setting it to your preferred path. (Removing this key again restores the default value.)
- Pause the batch scheduler to stop it sending new tasks to the batch
processor:
ShadowHost.exe BatchProcessTaskConsole process-dispatch -p
- Monitor the running tasks, repeating until no tasks are listed as
executing:
ShadowHost.exe BatchProcessTaskConsole.exe list-tasks
Tip: You can also reviewBatchProcessExecution/BatchProcessExecutionInfo
in the database. - Stop the services FlexNet Manager Batch Process Scheduler and FlexNet Manager Batch Processor.
- Create the following DWORD key on your batch server,
setting it to a non-zero
value:
SOFTWARE\WoW6432Node\ManageSoft Corp\ManageSoft\Compliance\CurrentVersion\ShadowHostTracingEnabled = 1
Tip: To disable logging again, set this key value to zero, or remove it from the registry. - Restart the services FlexNet Manager Batch Process Scheduler and FlexNet Manager Batch Processor.
FlexNet Manager Suite (On-Premises)
2023 R1