This project is read-only.


Duplicating sites when unable to access a sub-site


I just came across a bug when running against my production server's MySites. If the account running the script doesn't have access to a site, it fails when trying to read the sub-sites. I'm catching this error, but something isn't right, because it is readding the top site to the list, and building non-existent addresses then adding them to the list as well.
Obviously, I need to revisit my catch statement.
Not a show stopper of a bug. The duplicate sites are just woken more than once. The non-existent addresses are just skipped over when the address fails. Still, if you're looking to get an accurate site count, this will cause problems.


akennel wrote Oct 7, 2008 at 8:46 PM

Tracked this down finally.
SPWakeup works by building a list of web applications on a server, then checks each web app for all its Site Collections, then checks each Site Collection for all its Sub Webs. This bug arose from the code that checked Web Apps for Site Collections.
I pull a list of Site Collections by first building a new web app instance using the URL of the current listed Web App: SPWebApplication webApp = new SPSite(pullcurrentsite).WebApplication;

The problem here is my initial web app list also includes some Site Collections. So my list looks like this:
http://webapp http://webapp/sitecollection1 http://webapp/sitecollection2 etc When I create my new WebApp instance in the code above, I pull the current URL from my list. Since I'm building a Web App, it ignores the Site Collection portion of the URL, and just uses the webapp. That means that I end up processing the same web app multiple times.

I got around this by just doing a list.Contains check before building the webapp. That prevents the webapp from being scanned more than once. Which speeds things up considerably, and prevents those non-existent URLs from being created.

I also cleaned up some of the logging code, and eliminated an if/else statement that was never being called.

wrote Oct 7, 2008 at 8:47 PM

pieterw wrote Nov 12, 2008 at 10:05 AM

Hi akennel,
Have you any idea when you are going to release a version with this bug fixed? I think this fix will solve my problem (spwakeup tries to wakeup all mysites at all sitecollections so it tries a huge amount of sites).
One other thing, can you include a version number in the properties of the executable (now you can't check the version through windows explorer).

wrote Feb 21, 2013 at 11:56 PM

wrote May 16, 2013 at 11:36 AM

wrote May 16, 2013 at 11:36 AM

wrote Jun 14, 2013 at 8:23 AM