Saturday, March 9, 2019

A timeout has error occured while invoking commands in sharepoint host process

Recently I faced issue while deploying my sharepoint 2013 solution through Visual studio. During this time feature activation was keep on failing with timeout issue. Initially I thought it might be due to some long running operation in feature receiver code may be causing the issue.

Then I created the package and deployed the solution with powershell script and it went fine, its the time to activate the feature which was giving trouble. First I tried to activate the feature with PS and its worked fine, then deactivated and later tried with UI just to make sure if it breaks out. But no surprises, the feature activated with out any issue.

Now its the time to trouble shoot why its failing in VS2013. Then I started looking into MSDN links and found out there is Registry key called "ChannelOperationTimeout" which take care of time out issue in VS. If we have more feature activation code needs to be executed in during deployment from VS it will break out. Default value set to 120 sec, ideally most of the code should get activated, some times if we are running the code in VM which is allocated with less memory. R/W operation, RAM, free space all these maters while activating the feature from VS. If we have such environment its better to increase the default value of 120 sec to 300 sec(its not mandatory to give 300 sec this worked in my case :)), we can choose any suitable time interval to fix this problem.

Now will provide the steps to change the registry key value.

1) Open Registry editor with admin privilege
2) [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\SharePointTools]
3) Create New Keyword(DWORD) called  ChannelOperationTimeout
4) Set the value to 300(it will be in second)
5) If the key is already present then we need to just update the value.
6) Save the value
7) Restart the machine, since we are updating the Registry value.

Now if we deploy the solution from VS it should work without any error.

Root cause of the issue: Server memory, Disk space, R/W disk

Tuesday, January 8, 2019

Search Error: SearchService.svc is unavailalble

Recently we had an issue in our production environment after windows patching, suddenly search service application went down.
When I open the search service application from central admin I can see below error in System Status

"SearchService.svc is unavailable. This could be because the service is too busy or because no endpoint was found listening at the specified address"

This seems to be looks strange because search application topology seems to be looks good and it doesn't have any issue in there.

As sharepoint developer first thing we look is either event viewer or sharepoint logs, the error reported there was some what misleading or  not  much  relevant information.

So when I checked the Application pool of Managed metadata Service and Search service application both were down. Doing IISReset didn't helped either after manually starting the application pool of each service then all my search service, metadata service and timer jobs which were dependent on these service were back to normal.

Root Cause:

Our Admin team has done the patching of servers in wrong way, like they patched first app server, WFE and later SQL.
Some time sharepoint doesn't understand even though DB server is up and running it will assume its not available for service  application.

The ordering of windows patching should be in proper way else some times sharepoint fails to start the service automatically.

Better way to patching the servers:

1) Take WFE server down
2) All application services hosted server should be taken down
3) Apply the patch in SQL server/s, then if required do restart of servers
4) Apply the patch for APP servers then if required do restart of servers
5) Apply the patch for WFE server/s, then if required do restart of servers.

This is the proper way of doing windows patching, if any follow different approach then these kind of errors will raise.