GDI Resource Problem when RDPed into a system

  • Hello we have a customer that is having a problem when printing.
    They are using HP printers Models () with the Advance Printing Functions (APF) turned on. They are telling us that when they print the GDI object count reaches 10,000 and their print spooler hangs and stops printing until the spoolers are stopped and restarted.
    They say it does not happen when the APF is turned off. However they say they need the APF turned on so that the print job collate properly. If APF is not turned on, proper collation does not work, and multiple copies of print output from their other applications do not print in the right sequence.

    Their environment
    64-bit, Windows 2003 Terminal Server
    32 bit Windows 2003 Terminal server
    Using the standard 2003 printer drivers for HP printers
    They have also tried the HP universal printer driver.
    In this scenario (Universal Print Driver), the print jobs do NOT leak GDI objects, even when APF is enable on the printer.

    HOWEVER, when the UPD is used, we cannot print at all unless the logged-in user is an administrator of the machine


    Thank you
    Bern

    Einmal editiert, zuletzt von bernr (7. Oktober 2009 um 22:27)

  • I don't think using the UDP for them is really an option.

    I am sort of confused by your answer, are you saying that there is a GDI problem and you are going to fix or that you will just start researching it?


    Bern

  • I have posted a zip file on our website at http://www.exitcare.com/downloads/temp/WPTools_Problem.zip
    This zip file contains both the RTF we are testing with and an AVI video showing the problem

    Ok we have found out that it is not just related to HP Print drivers.
    It seems to really only be happening when RDPed into a system.

    We are able to reproduce this on multiple print drivers.
    Basically what we have found is that WPTools is leaking 1 GDI reasouce in the print spooler for each graphic that is in a document.

    We have been doing our testing with the WPTools Multi Demo using the TBX Demo.

    Steps to reproduce
    1) RDP into a computer (Make sure you are connected to the console)
    2) First bring up Task Manager
    3) Click view | select columns and add GDI objects
    4) Find Spoolsv.exe in the list so you can watch the GDI objects
    5) Now run the your TBX Demo
    6) Load an RTF file with images in it
    7) Print the file (I will also email you the RTF we are using)
    8) Notice the GDI objects go up, then come but down but are more then what they were when started. After doing testing we noticed for each graphics in the document 1 GDI object is leaked in the spooler.

    We have tested this using V5 and V6
    Thanks Bern

  • No special setting that we know of, happens whenever we are rdped into our xp system, also happens on terminal server. it is happening on a brother printer,multiple up printer and using docuprinter to produce pdfs. Only happens when we print from wptools, does not happen from word, adobe or gnostice pdf from Delphi.

    Did you test while expedition into the console of a system?

  • Some more info. This only appears to be happening if the "Enable advanced printing features" option is checked on the Advanced tab of the printers properties while logged in via RDP.

    • Offizieller Beitrag

    Hi,

    I guess it happens because of some code in file WPObj_Image.pas because the leak comes up in the spooler, not in the application. So it is probably an API call which is not supported or causes the defect.

    So please open that unit and disable one of the extra code. Change

    else if (Graphic.Width <> 0) and (Graphic.Height <> 0)
    // Only reduce LARGE graphics
    and ((Graphic.Width>1200) or (Graphic.Height>1200))
    then

    into

    else if (Graphic.Width <> 0) and (Graphic.Height <> 0)
    // Only reduce LARGE graphics
    and false
    and ((Graphic.Width>1200) or (Graphic.Height>1200))
    then

    to remove the downscaling.

    Furthermore it is possible to define the compiler symbol DONT_USE_DIBS. This also simplifies the process a lot and makes it possible to limit the error possibilities.

    Regards,
    Julian

  • Thank you, changing the code fixed the problem.
    Will this something that will be fixed in future versions, or will I need to remember to change your source code on new versions?

    Also I am being asked what the issues was and why this fixes it.
    And can you explain the DONT_USE_DIBS compiler symbol a little more for me.

    And THANKS for getting back to me so quickly!!!!!!!!!!!!!!

    • Offizieller Beitrag
    Zitat von bernr

    Thank you, changing the code fixed the problem.
    Will this something that will be fixed in future versions, or will I need to remember to change your source code on new versions?

    Also I am being asked what the issues was and why this fixes it.
    And can you explain the DONT_USE_DIBS compiler symbol a little more for me.

    And THANKS for getting back to me so quickly!!!!!!!!!!!!!!

    Youre welcome. Do you know what of the two fixed it?

    The DONT_USE_DIBS compiler flag or the switched off resizing?

    The resizing does not look optimal right now in code, but something like this is necessary to improve printing speed. Esspecially on networks. I will integrate a switch for it though.

    But of course it should not do something which breaks the spooler.

    Julian

  • Switching off the resize fixed it. thank you for adding an option. Will you post it here once you add it?

    As for the hot fix, the customer said they tried it, but I am sure you know how that goes.

  • Ok now we seem to be having another problem from this. We have made the code changes in the WPTools code as you suggested and that did fix the GDI leak problem. But now we are having customers complain that graphics that use to print are now no longer printing. Basically we append a graphic header to the top and a graphic footer to the bottom of certain documents. Now at certain sites these graphics are not printing after the WPTools code change. At one site changing the top and bottom margins to 0 fixed the problem and the images started printing again, but at another site it did not.

    Any Ideas?