5

I am making a GUI Extensions that needs to get all Components and their schemas that are being used on the pages that the user selects.

To do this, I just get all PageData's (CoreServce) for the pages the User selected in the list. Then for each PageData I get the ComponentData and its SchemaFieldsData.

Now after exactly 164 calls on one of our environments and 27 on a local vagrant box, the process gets stuck on the call I make to the core service. It will stay stuck until the 10 min timeout has passed, and will then continue doing it's thing. The operation that hung the process also seems to be successful as the data is printed out in my logging (data only the componentData has).

When I debugged the TcmServiceHost it is stuck on a TryRead action to our MySQL database. But as this is a Read action, this makes it only stranger to me ..

Does anybody have any ideas as to what could cause this?

As for now, it is working, but the 10 min delay now and then slows the pages/min rate down drastically.

Thanks!

Thomas


Edit - Rick Pannekoek's question

Example of how I call the core service:

private static ComponentData GetComponent(string id, string requestingUser)
{
    ComponentData componentData;
    using (var client = TridionCoreServiceFactory.GetSessionAwareCoreServiceClient(requestingUser))
    {
        componentData = client.Read(id, DefaultReadOptions) as ComponentData;
    }
    return componentData;
}

The TridionCoreServiceFactory.GetSessionAwareCoreServiceClient function

public static IDisposableSessionAwareCoreServiceClient GetSessionAwareCoreServiceClient(string user = null)
{
    var client = new DisposableSessionAwareCoreServiceClient(EndPoint);
    if (user != null)
    {
        client.Impersonate(user);
        Log.Debug("Impersonated Core Service session as {0}", user);
    }
    return client;
}

The implementation of the DisposableSessionAwareCoreServiceClient class:

public class DisposableSessionAwareCoreServiceClient : SessionAwareCoreServiceClient, IDisposableSessionAwareCoreServiceClient 
{
...
    protected virtual void Dispose(bool disposing)
    {
        if (_isDisposed || !disposing)
            return;
        _isDisposed = true;
        try
        {
            if (State != CommunicationState.Closed)
                base.Close();
        }
        catch (CommunicationException)
        {
            Abort();
        }
        catch (TimeoutException)
        {
            Abort();
        }
        catch (Exception)
        {
            Abort();
        }
    }
....
}

The IDisposableSessionAwareCoreServiceClient interface extends ISessionAwareCoreService and IDisposable

  • 1
    Are you properly closing/disposing your CoreServiceClient objects? – Rick Pannekoek Oct 12 '15 at 17:19
  • I created an extensions on the SessionAwareCoreServiceClient of Tridion which also implements IDisposable. When an instance is disposed, it automaticly closes the connection + I only call the client within a 'using' statement. (code added in my question for clarity). – Thomas Hendrickx Oct 13 '15 at 8:32
  • Ok, that looks fine. Can you elaborate what you mean with "a TryRead action on our MySQL database" (CM doesn't support MySQL). Did you analyze a Core Service WCF trace? – Rick Pannekoek Oct 13 '15 at 17:06
  • My bad it was MS SQL. But as i put in my answer below, I found the problem. – Thomas Hendrickx Oct 19 '15 at 10:55
  • I'd consider upgrading it to use the Alchemy framework when possible. There is a way within Alchemy to call the Core Service directly, and lots of helpers and other goodness. It also makes installing GUI extensions a pleasure. github.com/Alchemy4Tridion/Alchemy4Tridion – robrtc Oct 19 '15 at 14:21
0

I found the issue: There was one call to the core service in my code which was not encapsulated with a 'using' statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.