So here's a strange new problem in my XPages forum app

  • Dec 29, 2011

The other day, I set out to put some work into my guild's forum site. Immediately, though, I noticed that the main forum page was taking significantly longer to load on my development server than on my production server. Specifically, it was taking about five minutes to load, as opposed to about a second. That seemed... problematic. Looking at the profiler, I saw that the page was somehow making 38 million calls to Document.UniversalID, which was slightly out of proportion to the two forums listed on the page.

After a lot of trial and error to find out what the problem was, I narrowed down the culprit to the list of recently-updated topics. Each of my model elements is represented by a class implementing the List interface, which is really like a wrapper around the view. Thanks to some debugging output on the console (with apologies to my bloating log), I found that the list, which is only supposed to get the first 15 entries in the view, was repeatedly processing EVERY entry. Spitting out a stack trace revealed that the XSP list processor was converting the entire List object to a string via its own method of using the List's iterator. Huh.

I investigated a bit, looking at the resultant Java code from my custom control, renaming the property that passes in the List, and looking at the name.xsp-config file that accompanies it, all to no avail. Next, I tried re-creating the custom control, but that has the same behavior. For the time being, I've found that copying the code from the control in place of where I use it in the XPage works for some reason.

I have no idea why doing that worked, since in theory it should be performing the same thing, and I have no idea why all my other uses of similar controls--such as the one for recent posts--aren't freaking out. This will certainly bear some investigation, since until I figure it out I'll have to live in fear of the runtime stringify-ing my giant Lists at will.