Blog of an overweight SharePoint addict

Sun 1 Aug 10

Task alerts not firing in new site from Content Migration.

Filed under: SQL, SQL2K8, SharePoint, Task Alerts, Troubleshooting — Reginald @ 8:49 pm

Whilst working with a client recently we decided to use the Content Migration system within SharePoint to allow us to create a template site that could then be used as the source for the 88 sites that needed to be created for each of the areas of interest.

Each site had identical set-up with regards to security and the groups involved, the data merely changed by geographical location, with each site representing a postal district. As the custom webparts all triggered from data such as the site title for their geo-location data, this provided us with the best mechanism for creating the structure.

During the UAT period however we did experience one problem that I didn’t expect, This related to task creation and the automatic notifications sent to users. In our template site, we created a standard out of the box task list and turned on the ‘Notify on Task Assignment’ option.

image

This worked as expected in test, but during the migration something happened to the alerts and none of the 88 sites sent alerts when tasks were created.

The first thing I do when task alerts aren’t working is to set-up an ‘Alert me’ on a list or document library. When this is done you immediately receive notification that this has been done, so this shows that the SMTP is configured correctly. Then creating a new item triggers the second alert (Be aware of the timer delay though, alerts may take up to 5 minutes to be triggered as this runs on a default 5 minute timer. (Which can be changed..))

In this instance, these tests worked ok. So, now knowing that the infrastructure was ok, I started thinking about how SharePoint handles this kind of alert. In alert parlance, these Task alerts are called immediate scheduled alerts, as opposed to the daily round up or journal alerts. When an alert such as this is created, an entry is made in the dbo.ImmedSubscriptions table.

WARNING: Doing any kind of querying into the SQL databases of SharePoint is NOT supported and this was done for investigative purposes only. I would recommend only doing this when all else fails OR, Microsoft tell you to do it!

image

In my test system, I created a new site collection and then a new tasks list. Initially for this site, task alerts were off so the ImmedSubscriptions table was empty. However after editing the properties of the tasks list and turning on E-mail notifications, the following data appeared in the content-db.

image

The key areas of information that we’re interested in are shown above, Primarily the Site and Web urls, the list name and most importantly the AlertTemplateName (SPAlertTemplateType.AssignedToNotification) and the filter that applies the alert.

In the case of the sites for my client, this data did not appear for any of the sites created from the Content Migration Package and we can therefore assume that when creating these sites, alerts do NOT get processed in the normal way.

The fix is simple, turn off the alerts and turn them on again, this creates the entry and alerts start working as expected. moving forward, we’ve now created a quick powershell script than turns Alerts off and back on again after the site is created using the SPList object and the EnableAssignToEmail property.

Paul.

Mon 5 Oct 09

Weekly Access problems to a SharePoint site

Filed under: General, IIS, Troubleshooting — Reginald @ 9:11 pm

Just recently a client of mine raised an issue regarding an access issue that seemed to raise it’s head about every 8 days or so. What struck me was the distinct lack of errors issues by the system.

Approximately every 8 days, users will go to use the site and get a failed to connect to site error. IISReset and AppPool recycles don’t resolve the problem, and only a reboot of the Web Front End resolves the issue.

IIS Logs just show connections stopping at a fixed time and the SharePoint logs show nothing other than the usual trace log messages around timer jobs and index crawls.

It wasn’t until I examined the HTTPERR log file (Located normally in C:\windows\system32\logfiles\HTTPERR) that I realised what was likely to be happening as it was showing Connection Refused.

2009-10-02 10:59:07 – - – - – - – - – 2_Connections_Refused -
2009-10-02 10:59:13 – - – - – - – - – 1_Connections_Refused -
2009-10-02 10:59:17 – - – - – - – - – 2_Connections_Refused -

Basically, all incoming connections to a web server are handled by the HTTP.SYS portion of the system before being handed out first to IIS and then to the respective handler for applications such as SharePoint. Hence the distinct lack of error logs in IIS and SharePoint.

This system process utilizes Non Paged Pool memory extensively, however it has a little known security feature that starts to refuse connections once there is only 20Mb remaining in the NPP.

At this point it’s important to remember that HTTP.SYS is not the cause of your problem, merely a symptom of a system with potentially a few things wrong with it. So how do we trouble shoot this little problem on a SharePoint WFE.

So the first place to check is how much NPP memory you have available to you. A Windows 2003 32 Bit server should have 256Mb of NPP available at boot. However if for some reason you have the /3GB switch specified in your boot.ini, this NPP allocation is halved to 128Mb. In addition, the /3Gb option is NOT SUPPORTED for SharePoint and must be removed. (KB933560)

So at this point we’ve doubled the NPP available to us, but this may not have solved the problem as something else is in process taking that memory and possibly leaking it away by not returning it properly to the pool. In these instances you need an application called PoolMon.exe from the Windows Server 2003 resource kit.

Using this tool it is possible to identify the driver or system file that is not returning memory properly to the NPP, which in my case was down to an old Broadcom Ethernet driver for the Dell PowerEdge server this system was running on.

I won’t re-create the posts on how to use the Poolmon tool as there are some good ones out there, but the MS articles that show you how to use the PoolMon.exe program are below.

KB177415 – How to use Memory Pool Monitor to troubleshoot Kernal mode memory leaks.

On a side note, if you have Windows 2003 SP2, then you may need to think about disabling the TCP Chimney as per KB945977

Hope this helps you some way to resolving a similar issue.

Paul.

Wed 22 Apr 09

Overriding Core.JS functions

Filed under: Javascript, Programming, SharePoint, Troubleshooting — Reginald @ 2:30 pm

A client of mine recently required adding an additional E-Mail link adding to the Item Drop Down menu that drops off of the ECB menu within Document Libraries and Lists.

Now this functionality is provided by the function AddSendSubMenu(m,ctx) within Core.JS. Editing this file is NOT SUPPORTED (You all know this by now I’m sure!). So what to do? Well the answer is make use of Javascript’s natural override.. I.e. If you declare a function twice, the last declaration is the one that gets used.

So, Seems simple huh? We copy the function we want out of Core.JS and stick it into our own NewSendToMenu.js file in /TEMPLATE/LAYOUTS/1033

We then place a standard little script tag into the Head of the Master Page and bobs your uncle, the code gets loaded quite happily on each page.

Or does it? Well yes it does always get loaded.. I proved this by putting a document.write(”Hello World”) in front of the function and this got displayed every time without fail, And yet my customisations weren’t there.

I remembered reading somewhere that Core.JS has a habit of hanging around and getting executed last, My original method using the SharePoint:ScriptLink tag seemed to support this, so I dropped back to using the standard Script tags.. same problem though..

I then stumbled across a small article on the MSDN forums that pointed out the use of the Defer tag in the Core.JS script block. (You can see this if you view the page source in IE..) This means that the execution of Core.JS is deferred until the rest of the page is loaded, thus overriding my own override..

So the solution appears, Declare my script lower down the page than the Core.JS, and tag my Script block with the Defer option also.. This appears to execute my code AFTER core.js has completed.

Now, I’m not 100% how often this will be the case.. looks like this may need some load testing, but I think it’s fair to say that if one script is deferred higher up the page, than another lower down, they should be deferred into the same execution order that they met during page load?

Or am I being too simplistic? Never mind.. for now this works and resolves the client issue!

Paul

Tue 25 Sep 07

Handy logging info..

Filed under: SharePoint, Troubleshooting — Reginald @ 11:46 am

I have an issue when it comes to debugging if a problem hits on the live environment. For some reason I cannot get the debugger to attach..

As a temporary solution, I made use of a technique pointed out by Clin Byrne on the SUGUK forums that makes use of the MICROSOFT.OFFICE.SERVER.DIAGNOSTICS namespace, and more importantly, the PortalLog object.

This method is VERY simple to use, all you need is a reference in your project to the Microsoft Office Server.dll.

Once thats in place, you can use the following at any point in your code to dump an entry into the latest log in the 12 Hive.

PortalLog.LogString("Any freeform text your like here")

Reg.

Powered by WordPress