In the movie Star Wars Chancellor Palpatine outwardly appears to be a well-intentioned and loyal public servant and supporter of democracy, yet underneath his affable public persona lurks his true identity. His Sith name was Darth Sidious and accurately describes his true hidden nature. In a CRM project of any size you may end up with a decent amount of JavaScript to implement client side form customizations. Most likely there will be a need to make web service calls to get certain pieces of information about things such as the user, his/her roles, etc. You have to make sure your web service calls are being made correctly or else you could run into some "insidious" problems on your server.

The nature of how we have to write JavaScript today leaves the door open to inadvertently make small mistakes that may not be obviously apparent. I ran across one such issue that appeared to be a minor issue with a JavaScript call to get a user's business units using the OData service. For a project I'm working on we have been dealing with issues when deploying to our UAT server environment. We share the box with another team and they have complained that our solution is bringing down the server somehow. The problem was not obvious but I had talked with someone on that team the other day and they mentioned they suspected it had something to do with web service calls. I shrugged my shoulders not really knowing how that would cause the CRM service to go down and went about my business. The problem was something other people were working on so I was focused on the tasks I had on my plate when I made an interesting discovery.

Last night I was working on a custom web application and had left Fiddler open to watch what kind of calls Internet Explorer was making to the server. I was working on the opportunity form when I happened to look over and see red log entries passing by on the Fiddler display window. As it turns out, every time I opened the opportunity form it was making bad OData calls to get the business unit of the logged in user. What was happening is the method that was making the call to get the user's business was passing a null parameter to the method which was attempting to pass an invalid guid in the OData call.

As it turns out this bad OData call apparently has been crashing our UAT server environment. We haven't confirmed this as yet but right now we believe that while yes we were making a bad OData call, the server should just return an error like it does in our development environment. What seems to be happening in our UAT environment is the bad OData call crashes the CRM service so there is potentially something on the Microsoft side going on too. This issue is under investigation but the evidence seems pretty compelling at the moment. The Microsoft guys are working to figure out how this is happening but in the meantime we are going to fix our bad OData calls and see if that corrects the issue.

The bottom line is that it appears that if you end up making bad OData calls it could potentially cause server problems on the back end. If you find yourself in the situation use your Jedi powers and make sure to check your web service calls with a tool like Fiddler to make sure everything is as it should be...

Latest Update:

It appears that the problem may stem from the service account user being used not being properly setup with the correct permissions. When an error occurs in the system CRM may be attepting to write trace files and such that it can't access which cause the service to hang. This investigation is ongoing but this is the path being followed at the moment.