I've been trying to locate some memory leaks we've noticed in our ULS (EventID: nask, An SPRequest object was not disposed ... etc).
On my dev environment, and at least 2 other cleaner installs, the taxonomy receivers seem to be the source of these entries.
Steps to replicate without code:
- Create a custom list
- Open uls and filter for 'nask' events.
- Add an item and verify no entry in ULS
- Edit the item and verify no entry in uls.
- Add an MMS column to the list
- Add an item and verify an SPRequest is reported as not disposed
- Edit the item and verify an SPRequest is reported as not dsiposed.
To me, this looks like it's caused by SPItemEventProperties.List being called from a synchronous handler. To test, I created a new list and added ItemAdding, ItemUpdating, ItemAdded and ItemAdding handlers containing;
public override void ItemX(SPItemEventProperties properties)
{
SPList list = properties.List
}
On edit and update, one 'nask' event is logged. If i then change the asynchronous events to synchronous via powershell, I suddenly get 2 'nask' events for adds\edits to the list.
After checking reflector I'm guessing that properties.List is actually null for synchronous handlers, leading to a call to site.OpenWeb(), which is causes the message in ULS.
Is anyone else able to replicate this or am I missing something blindingly obvious?
EDIT: So after a little sleep I attached the debugger to properties.list on one of the synchoronous handlers. At this point the list is not null, although the line is definitely the culprit.