Summmary

This is the second progress report on the project to identify the cause of, and suggest resolutions for, memory leaks in the Evergreen staff client associated with printing checkout receipts.

My findings to date are:

  • Two distinct bugs contributing to the memory leak have been identified.

  • Patches have been written and are available for community review that appear to resolve the leak, or at the very least significantly reduce it.

The bugs

The two distinct bugs contributing to the memory leak are:

  • The global data cache, which is used to store information about the last receipt in case the operator wishes to reprint it, was hanging on to objects and Javascript execution contexts inherited from the previous checkout session.

  • The use of xulG.set_tab() to refresh the checkout tab was also leading to references to objects and Javascript executation contexts being held onto inappropriately.

I wrote a series of patches to resolve these bugs. One patch serializes the last receipt data to a JSON string to ensure that the global data cache doesn’t contain references to the checkout tab and its objects. The other patches change how a refresh of the checkout tab is requested so that it is impossible for references to the existing checkout tab to slip through via the call to xulG.set_tab().

Methods

The method based on AutoHotKey and Windows Task Manager to trigger the leak and measure consumption described in the first report continued to be used.

Results

The following table records memory consumption for Evergreen client containing the fixes running on Windows 7. Each round represents 15 iterations of entering a patron barcode at the checkout interface and auto-printing a receipt.

The unit for memory usage is kilobytes.

Test Memory Use at Start Memory Use at End Comments

Alt-D to print and refresh checkout session

66,200

89,380

Using same Evergreen staff client session, with 15 more checkouts

89,380

94,472

And 15 more checkouts

94,472

94,988

Next steps

A patch series has been submitted for Launchpad bug 1086458 and is at available for community review.

Equinox hereby requests that GPLS also test the patches; in particular, by simulating realistic checkout activity. Attention should also be paid to verify that no bugs regarding printing and reprinting checkout receipts were introduced.

It should be noted that testing will entail building a new staff client. The patches are trivially backportable to rel_2_3, and a working branch for that version is available.