Exception: Invalid number value

Oct 4, 2011 at 2:17 PM

Hi.
Thank you for this project that looks prmissing.

Actually the timer hob is failing after the first successful execution that creates the SharePoint list and populates it with the Farm info.
In the second execution and others, it generates an exception:

Invalid number value.  A number field contains invalid data. Please check the value and try again

I hope you can help me to bypass this issue

Detailed exception info from the ULS logs:

10/04/2011 15:55:16.77 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation Monitoring nasq Medium Entering monitored scope (Timer Job SPFarmInfoTimerJob) 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:17.05 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation General avjg Medium No webtemp*.xml files found for language 1033 and product version 3. 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:17.05 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation General avjg Medium No webtemp*.xml files found for language 1033 and product version 2. 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:17.05 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation General 72kc Medium Failed to find generic XML file at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\SiteTemplates\STS\xml\stdview.xml", falling back to global site definition. 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:17.39 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (EnsureListItemsData). Execution Time=169.849799346006 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:38.48 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation General 8kh7 High Invalid number value.  A number field contains invalid data. Please check the value and try again.<nativehr>0x8102001a</nativehr><nativestack></nativestack> 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:38.48 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation Timer 6398 Critical The Execute method of job definition SharePointFarmInfoTimerJob.SharePointFarmInfoTimerJob (ID af980493-4c1b-4177-a144-09161fdee9ea) threw an exception. More information is included below.  Invalid number value.  A number field contains invalid data. Please check the value and try again. 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:38.48 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation Timer 72ae Unexpected Exception stack trace:    at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)     at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)     at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename)     at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename)     at Microsoft.SharePoint.SPListItem.Update()     at SharePointFarmInfoTimerJob.SPFarmTopology.AddServerDetails(SPList spFarmTopologyList, String& serverName, Int32& index, SPServer server)     at SharePointFarmInfoTimerJob.SPFarmTopology.FetchSPFarmInfo(SPList spFarmTopologyList)     at SharePointFarmInfoTimerJob.SPFarmTopology..ctor(String siteWebUrl, String spListName)     at SharePointFarmInfoTimerJob.SharePointFarmInfoTimerJob.Execute(Guid targetInstanceId)     at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result) 61073ff9-1c4f-445e-afb7-f0c7ed312a4f
10/04/2011 15:55:38.50 OWSTIMER.EXE (0x11D0) 0x04B8 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (Timer Job SPFarmInfoTimerJob). Execution Time=21720.3365232173 61073ff9-1c4f-445e-afb7-f0c7ed312a4f

Oct 4, 2011 at 2:53 PM

Hi,

Just wanted to add that I'm getting the same error. In the AddServerDetails() method.

/Björn

Exception stack trace:   
 at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)    
 at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)    
 at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename)    
 at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename)    
 at Microsoft.SharePoint.SPListItem.Update()    
 at SharePointFarmInfoTimerJob.SPFarmTopology.AddServerDetails(SPList spFarmTopologyList, String& serverName, Int32& index, SPServer server)    
 at SharePointFarmInfoTimerJob.SPFarmTopology.FetchSPFarmInfo(SPList spFarmTopologyList)    
 at SharePointFarmInfoTimerJob.SPFarmTopology..ctor(String siteWebUrl, String spListName)    
 at SharePointFarmInfoTimerJob.SharePointFarmInfoTimerJob.Execute(Guid targetInstanceId)    
 at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result)

Oct 5, 2011 at 5:27 AM
Edited Oct 5, 2011 at 6:03 AM

Check your permissions to the other servers in the farm.  Some of the number fields in thelist are returning text eg "Unknown error occured".  Once I corrected my permissions the timer worked well.

Travis

Oct 5, 2011 at 7:38 AM

Hi Travis.

I don't know if there are specific permission requirements but I am doubtful.
The job runs under the SharePoint Timer Service account which is the Farm Admin in my case.
Also the farm admin is member of the local admin group, so I can't think of additional security permissions :S

Oct 5, 2011 at 10:25 AM

Hi ndarwish,

I tried to debug the timer job and it seems the problem is the following line in AddServerDetails():

WindowsTaskInfo taskMgrInfo = new WindowsTaskInfo(serverName);

I get an UnauthorizedAccessException when trying to connect to the ManagementScope resulting in trying to assign strings to int columns.

/Björn

Oct 5, 2011 at 10:39 AM

I added the following method in SPFarmTopology.cs:

public static T FromString<T>(string text)
{
	try
	{
		return (T)Convert.ChangeType(text, typeof(T), CultureInfo.InvariantCulture);
	}
	catch
	{
		return default(T);
	}
}

and changed some lines in AddServerDetails() to:

spFarmTopologyListItem[Global.cpuUsageColumnName] = FromString<int>(taskMgrInfo.CPUUsage);
spFarmTopologyListItem[Global.freeSpaceDetailsColumnName] = FromString<int>(taskMgrInfo.SystemDirectorySpaceUsage);
spFarmTopologyListItem[Global.freeSpacePercentColumnName] = FromString<int>(taskMgrInfo.SystemDirectoryFreeSpaceInPercentage);
spFarmTopologyListItem[Global.memoryUsageDetailsColumnName] = FromString<int>(taskMgrInfo.MemoryUsage);
spFarmTopologyListItem[Global.memoryUsagePercentColumnName] = FromString<int>(taskMgrInfo.MemoryUsageInPercentage);

thus avoiding an exception. I still don't know the root cause of the problem though. Why does the ManagementScope.Connect() call throw an exception?

Oct 5, 2011 at 11:25 AM

Thanks dear Björn.
I really appreciate your help.
I will try your code changes and communicate my feedback.

Regards.

Oct 5, 2011 at 11:57 AM

No worries. It is an excellent tool which is sorely needed. I appreciate the work.

/Björn

Coordinator
Oct 13, 2011 at 9:04 PM
bstenberg64 wrote:

No worries. It is an excellent tool which is sorely needed. I appreciate the work.

/Björn


Thanks for providing the workaround. I havent suppressed any exception wantedly because I wanted to know what all errors are thrown in the real time environment. I will make use of your code for nect version release.

Coordinator
Oct 13, 2011 at 9:12 PM
ndarwish wrote:

Hi Travis.

I don't know if there are specific permission requirements but I am doubtful.
The job runs under the SharePoint Timer Service account which is the Farm Admin in my case.
Also the farm admin is member of the local admin group, so I can't think of additional security permissions :S


NDarwish - Many have reported that the timer job is facing problem in fetching machine info of SMTP server.

Can you check that whether your Farm Admin has sufficient permission to make WMI calls to that machine from which error is thrown? Can you try running the Timer Job with Domain Admin credentails?

Chances are there for Farm Admin credentials to have insufficient permission in retrieving the info from Exchnage(Mail) servers. Domain Admin credentials is the having the elevated privilages of all.

When it comes to security, its fully safe and secured. Reason being is the Sharepoint Timer Job is a secured windows service which runs in your farm. There is no chance to tamper it.

Feb 9, 2012 at 11:51 PM

First, the permission requirements for this tool listed above are in complete contradiction to the best practices laid out for SharePoint 2010 and general security best practices. A customer should never have to leave the farm account in the local admins group. This quote is absolutely ridiculous:

"When it comes to security, its fully safe and secured. Reason being is the SharePoint Timer Job is a secured windows service which runs in your farm. There is no chance to tamper it."

Second, I have yet to come across an enterprise organization that will allow the SharePoint farm account to be local admin on an SMTP server.  The logic in the enumeration of the servers in the FetchSPFarmInfo method needs to be updated to skip the SMTP server. A try/catch would also be nice here so we don't fail the entire enumeration if one server query fails.

For those seeing the timerjob fail with the following ULS error:

Exception stack trace:   
at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)    
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)    
at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename)    
at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename)    
at Microsoft.SharePoint.SPListItem.Update()    
at SharePointFarmInfoTimerJob.SPFarmTopology.AddServerDetails(SPList spFarmTopologyList, String& serverName, Int32& index, SPServer server)    
at SharePointFarmInfoTimerJob.SPFarmTopology.FetchSPFarmInfo(SPList spFarmTopologyList)    
at SharePointFarmInfoTimerJob.SPFarmTopology..ctor(String siteWebUrl, String spListName)    
at SharePointFarmInfoTimerJob.SharePointFarmInfoTimerJob.Execute(Guid targetInstanceId)    
at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result)

The reason for the error is becuase the farm account doesn't have the necessary permisisons to remotely query one or more servers in the farm and that scenario is not handled well in the timerjob code.

To make the timer job work without adding the farm account to the local admins group, you need to grant your farm account the following permissions on each server in listed on the "servers in farm" page in Central Admin:

  1. Navigate to WMI Control Properties and on the security tab grant the "Remote Enable" permission on the Root WMI namespace and all subnamespaces.
  2. Launch DCOMCNFG and a grant the farm account "Remote Activation" permissions under Component Services > Computers > My Computer

 

Dec 4, 2014 at 3:37 AM
Hi rodgerjt,

I did your suggestion to add the permission, but only at the problematic server (AppServer02), not WFE or AppServer01. But the job still failed with same message : Invalid number value any suggestion ?