views:

343

answers:

2

When adding or editing a page in a SharePoint Pages library we get the following exception:

[COMException (0x81020016): Item does not exist The page you selected contains an item that does not exist. It may have been deleted by another user. Click "Home" at the top of the page to return to your Web site.] at Microsoft.SharePoint.Library.SPrequestInternalClass.RenderColumn.

The weird thing is, when we first do "Check in" and then click the Publish button it works perfectly. But clicking "Publish" directly generates theis error, BUT NOT ALWAYS!

The Pages library has publishing and item planning on, NO workflow (seeing as the person who adds / edit pages is also the approver) and Major/ Minor versions. We use a content type derived from publishing page and a custom PageLayout.

+1  A: 

I'm sure you would have already checked this but is there any more information in the ULS logs?

Also have you tried setting the debugger to break on all exceptions and does this give you more information? Go to Debug, Exceptions and tick Common Language Runtime Exceptions. Then go to Tools, Options, Debugging and untick Enable Just My Code. Finally attach to w3wp.exe.

If you are running Windows Server 2008 you could also try taking a dump file at the point the debugger breaks above. ADPlus might help if you are running Server 2003 but I don't have experience with it. You should then be able to open the dump file with DumpChk or WinDbg.

Edit: As discussed in the comments, this is code deployed to production that can't have its service interrupted. The only way you could create a dump file is programmatically. Have a look at this question I asked that will hopefully help you if you need to go down this route.

Other things to try if you don't want to get down and dirty with debugging is to try deploying your custom bits to a clean server. See if you can still reproduce the problem or if it changes.

Alex Angas
THe problem is that this occurs when using the out of the box publishing workflow plus our own ItemEventReceiver (which sets the permissions for the item based on a column). And it only happens on production server.
Colin
Hmmm that's tough. Is there any chance of scheduling downtime and using the Visual Studio Remote Debugger to catch the exception and get a dump?
Alex Angas
To be short: No. The client does not want the server to be down in production time, EVER. THe problem I think lies in the fact that the code needed to break the permissions is run with elevated privileges. SOmehow SharePoint thinks that the item is not there anymore because another user (elevated) bascially has the file checked out.
Colin
Sounds like it's something along those lines. Only other thing I can suggest is focus on trying to get a repro in dev or test. Perhaps its due to the particular topology of production (e.g. load balancing issue). Please give an answer when you work it out!
Alex Angas
added an upvote, for the effort, thnx. Will continue to try this out. Seems I might be getting a full blown copy of the production environment to play with.
Colin
+1  A: 

I am assuming that you are using load balancing with 2 web servers.

The fact that it does not happen always points to there being a difference between the servers.

There are then a few things that you could check:

  • Are all the versions and service packs are the same on both machines
  • Have any of the servers had beta software installed
  • Is your code the same on both servers

One thing you could do to test without taking the system down: Is to remove the first web server from the cluster see if the error occurs, then add it back and do the same thing with the second web server.

Shiraz Bhaiji
it's a single server setup (small site)
Colin
Check your database for size and fragmentation. It could be that adding an item triggers some autogrow or reorganize in the database. This may explain why data is sometimes not available in a timely fashion. The not found may be a timeout.
Shiraz Bhaiji