Using SharePoint JSOM api i have encountered very strange exception. Call to
threw sometimes exception System.ServiceModel.ServiceActivationException and responded with status 500. In our case it was problem with available RAM on development server. Actually it was thrown when available memory was under 5%. Simple increase on memory resolved this problem (no iisreset needed).