StressPrinters Version 1.3.2
Created date: 03/30/2006
Modified date: 6/19/2013
Many printer driver problems in Terminal Services/Remote Desktop Services environments revolve around poor multi-threaded performance, which in turn can cause print spooler instability. Problematic multi-threaded performance is usually exposed when multiple users connect to a Terminal Server simultaneously using the same printer driver. Symptoms include the failure to autocreate client printers, increased thread count of the printer spooler and/or Citrix Print Manager services, and possibly the unresponsiveness and/or unexpected termination of these services (stop responding).
This tool can be used to simulate multiple sessions auto-creating printers using the same printer driver.
It can also be used to compare the following among various drivers:
- CPU load incurred while creating a printer using a particular driver
- Time required to successfully create a printer using a particular driver
Note: The current version of the tool does not test concurrent printer capabilities, settings, or actual printing calls, which are also possible causes of failing to print. Therefore, good/passing stress results do not always mean that printers are actually working or certified.
The printer driver you want to test must be installed on the system. You can check for installed drivers by performing the following procedure:
- Open the Printers and Faxes folder of the server.
- Open File > Server Properties.
- Click the Drivers tab.
There must be a valid port to connect the printer to (for example, LPT1:). It is acceptable to connect multiple printers to the same port for testing purposes. You can check for available ports by performing the following procedure:
- Open the Printers and Faxes folder of the server.
- Click File > Server Properties.
- Click the Ports tab.
Copy and extract the StressPrinters.zip file to a directory on a test system. The program does not require any Citrix software installed and should never be run on a production server during production hours.
Note: Extract the StressPrinters.exe, addprinter.exe and/or StressPrinters64.exe, and addprinter64.exe to the same directory (for example, the desktop of the server). StressPrinters.exe is the GUI that calls AddPrinter.exe.
How to Use StressPrinters
Citrix TV - How To: Use the Stress Printers Tool
- On 32-bit Windows platforms, use StressPrinters.exe. On 64-bit Windows platforms, use StressPrinters64.exe.
- In addition, watching a Performance Monitor counter set to cpu%load can assist in providing a visual representation on CPU load incurred when these drivers/printers are added.
- When you run StressPrinters.exe or StressPrinters64.exe, the dialog box shown in the following screen shot appears. It allows you to specify various parameters for each printer driver installed:
The parameters are defined as:
- Base printer name: specifies the base name of the printers to create (defaults to printer driver name).
- Printer port name: (default is to LPT1:) specifies the port to connect the printers to.
- Print processor: (default is Winprint) specifies the name of the print processor you want to use for the printer.
- The number of concurrent add events: (default is 1) the number of concurrent add and delete (if Keep printers created during last iteration option is not specified) events to run during an iteration.
- Maximum delay between add and delete: (default is 0) specifies the maximum delay (in milliseconds) between printer additions and deletions for a particular thread. This delay is randomized (up to the maximum delay specified) to expose problems across a wider range of timing variations.
- The number of times to repeat the test: (default is 1) the number of times to repeat the test with the parameters specified.
- Keep printers created during last iteration: (default is not keep) does not delete the printers created during the last iteration of the test.
- Verbose mode: print verbose messages (default is not to print verbose status, but only error/warning conditions).
- Apply these settings to all printers: make the settings default for all other printer drivers and overwrites what you have specified for them.
- You can save your choices of parameters and selected printer drivers to a text file (Save), and load them later or on another server (Load).
- You can specify the timeout in minutes (Options) to mark potential problem printer drivers that take too much time to autocreate or stuck in a spooler. By default, the timeout is 10 minutes. Post processing command is any command line that will be executed once the stress test is completed.
- When the parameters are set, select the appropriate printer drivers to test and click Run to start testing. The following dialog box (which includes a progress bar) appears:
- If printer auto-creation takes a long time (the Print Spooler service might become unresponsive), you can abort the current test by clicking Close. The log file can be saved at any time by clicking Save log.
- If you choose to abort the current test, click Yes when prompted to close instances of addprinter.exe, as shown in the following screen shot:
- When the timeout expires, you have the choice to continue the stress test for the same amount of time or abort it:
- If you choose not to continue, the following message appears:
- If all tests finish before the specified timeout, the following message appears:
“Stress test has finished!”
- The tool also detects when the Print Spooler stops responding because of a bad printer driver and displays a warning. If this occurs, save the log and check the crash dump saved by your default postmortem debugger (for example, Dr. Watson or NT Symbolic Debugger (NTSD)).
- Refer to CTX105888 – How to Set the NT Symbolic Debugger as a Default Windows Postmortem Debugger for information on how to set NTSD as a default postmortem debugger.
- Refer to CTX118614 – How to Use Windows Error Reporting (WER) to capture Application Crash Dumps (User Dumps) on Windows Server 2008, Windows Vista, and Windows 7 for information on How to Use Windows Error Reporting (WER) to capture Application Crash Dumps (User Dumps) on Windows Server 2008 and Windows 7
- If all tests have finished (indicated by a full progress bar), you can examine the log file. Save it (click Save log) and click Close to close the dialog box.
- Test a good print driver first to get a benchmark time for the test to finish.
- Test each print driver separately to get a true and specific result for each.
- Citrix Support has found the best test is to select (5) for both The number of concurrent add events and The number of times to repeat the test
- In this instance, the magic number for the test to finish is around 60 seconds (This is an approximation based on Step 1, 2 and 3).
Annotated Log File
Following is the annotated log file example corresponded to the stress test depicted above (comments are in bold):
Launching cmd.exe /C addprinter.exe -name "HP LaserJet 4000 Series PCL" -port "LPT1:" -driver "HP LaserJet 4000 Series PCL" -proc "Winprint" -conc 1 -iter 1 -delay 0
CMD process has been created. PID: 118c (4492)
Launching cmd.exe /C addprinter.exe -name "HP LaserJet 4050 Series PCL" -port "LPT1:" -driver "HP LaserJet 4050 Series PCL" -proc "Winprint" -conc 1 -iter 1 -delay 0
CMD process has been created. PID: 1184 (4484)
--- Begin Log for "HP LaserJet 4000 Series PCL" ---
AddPrinter Ver 2.01 (c) Citrix 2006-2007 (pid: 4108)
WARNING: thread id 0x468 may be stuck on AddPrinter for printer HP LaserJet 4000 Series PCL1!
Time elapsed: 6 seconds. Done with 0 errors.
>>> The warning can be ignored because the log for HP LaserJet 4000 Series PCL stress test reports elapsed time less than 1 minute timeout and 0 errors.
--- End Log for "HP LaserJet 4000 Series PCL" ---
--- Begin Log for "HP LaserJet 4050 Series PCL" ---
Logging is in progress...
>>> This is an indication of the ongoing stress test for HP LaserJet 4050 Series PCL driver. Had not been finished by the time the log was saved.
--- End Log for "HP LaserJet 4050 Series PCL" ---
Stress tests have not finished for the following drivers after 1 minutes(s):
HP LaserJet 4050 Series PCL
>>> The list of printer drivers whose tests had not been finished when the timeout of 1 minute expired.
The package contains command-line versions addprinter.exe and addprinter64.exe that you can use to test individual printer drivers manually.
- The following is the syntax for the program:
addprinter.exe –name “PrinterName” –port “PortName” –driver “DriverName” –proc “Processor” –conc NumConThreads –iter numIter –delay msecDelay –keep –verbose
- The values are defined as:
- “PrinterName” specifies the base name of the printers to create.
- “PortName” (optional, defaults to LPT1:) specifies the port to connect the printers to.
- “DriverName” specifies the driver to test.
- “Processor” (optional, defaults to Winprint) specifies the name of the print processor you want to use for the printer.
- NumConThreads (optional, defaults to 1) is the number of concurrent add and delete (if –keep is not specified) events to run during an iteration.
- numIter (optional, defaults to 1) is the number of times to repeat the test with the parameters specified.
- msecDelay (optional, defaults to 0) specifies the maximum delay (in milliseconds) between printer additions and deletions for a particular thread. This delay is randomized (up to the maximum delay specified) to expose problems across a wider range of timing variations.
- -keep (optional, defaults to not keep) does not delete the printers created during the last iteration of the test.
- -quiet (optional) does not print verbose status, but only error/warning conditions and the program banner.
For example, the following command adds three printers with the base name test (test1,test2,test3) using the HP LaserJet 4 print driver with a delay of 500 milliseconds between the printer being added and deleted for a particular thread. It also only prints status if any of the AddPrinter() or DeletePrinter() calls fail and keeps the three printers that are created during the final (third) iteration of the test.
addprinter.exe -name "test" -driver "HP LaserJet 4" -conc 3 -iter 3 -delay 500 -keep –quiet
- If there is an error adding the driver, an error message is returned. For example:
“AddPrinter (test1) failed with error 1797: The printer driver is unknown.”
Where test1 specifies the unique AddPrinter() call that failed. If multiple iterations have been specified with the –iter argument and there is a failure during a particular iteration of a test, subsequent iterations are not run.
- If no error occurs, a confirmation message similar to the following is printed:
“Time elapsed: 17 seconds. Done with 0 errors.”
To uninstall StressPrinters, delete StressPrinters.exe, addprinter.exe, StressPrinters64.exe, and addprinter64.exe.
By default, if an AddPrinter() call fails while auto-creating printers on a system, the following event is created in the Event Log:
Category: Printer Management
Event ID: 1116
Description: Printer auto creation failure. Reason: AddPrinter() failed with status 0x709. Client name: ClientName Printer name: PrinterName Port name: PortName Driver name: DriverName Print processor: (WINPRINT)"
??鷉G Reason is the ntstatus code of failure.
You can leverage the NET HELPMSG facility as shown above to translate the code into a readable error message.
??鷉G Client name is the client name of the client that attempted to autocreate the printer.
??鷉G Printer name is the name used when attempting to autocreate.
??鷉G Port name is the name of the port used when attempting to autocreate.
??鷉G Driver name is the name of the driver used when attempting to autocreate.
??鷉G Print processor is the name of the print processor used when attempting to autocreate.
Note: Auto-created printers always use the WINPRINT print processor.
Questions? Concerns? Send any feedback for this tool to email@example.com.
This software application is provided to you "as is" with no representations, warranties or conditions of any kind. You may use and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software application may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software application fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software application. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE APPLICATION, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.