ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | shark List | June 2006 Index

<--  Date Index  --> <--  Thread Index  -->

Possible Deadlock avoided


Hi
 
we are currently using Shark 1.1-2 and are trying to do some load test for the productive system. During heavy load with multiple cuncurrent invokations of process instances we get a connection problem (Connections are currently unavailable) at different situations of the process invokation. Please have a look at the Deadlock.zip which contains the critical log.
 
I do not understand exactly how this possible "deadlock" is detected in Shark neither how this situation may be influenced by our development. We use a more or less straightforward process definition (see workflow.xpdl) that invokes a GeneralToolAgent for its external service handling. We do not use explicit transations in this tool agent, which might be a point that leads to the mentioned situation. However, it could also be that it hasn't to do anything with our tool agent implementation.
 
According to other threads, it may has to do with the database. We are using HSQLDB. Does anybody has some experiences having this problem before and resolving the problem by switching to another database?
 
HSQL is a highly lightweight database, so if we could continue using it, it would be great. Is there a chance to resolve the problem upgrading to 1.8 of HSQLDB? Any experiences are highly appreciated.
 
Thank you in advance.
Daniel Frey
package com.xxx.om.core;

import com.xxx.om.ServiceException;
import com.xxx.om.ServiceInternalException;
import com.xxx.om.activity.OMActivity;
import com.xxx.om.activity.OMActivityException;
import com.xxx.om.activity.OMActivityRegistry;
import com.xxx.om.activity.OMActivityRegistryLocator;
import com.xxx.om.activity.ScriptUtils;
import com.xxx.om.utils.OMConstants;
import com.xxx.om.utils.OMUtils;
import java.io.File;
import java.io.IOException;
import org.apache.log4j.Category;
import org.enhydra.shark.api.internal.toolagent.AppParameter;

/**
 * Tool agent that dispatches the call to a registered activity. If the activity is not registered, an {@link
 * OMActivityException} is thrown. The activity may optionally be configured by passing a serialized object to the
 * {@link #execute(AppParameter, AppParameter, AppParameter, AppParameter, AppParameter) execute} method. The serialized
 * configuration has to be in the classpath. If the output file parameter doesn't contain a file but an empty string, a
 * new stage file is created. Otherwise the given file is used for the output.
 *
 * @author <a href="daniel.frey@xxxxxxxxxx">Daniel Frey</a>
 * @version $Revision: 1.5 $ $Date: 2006/05/07 16:00:44 $
 */
public class SharkGeneralToolAgent {

    private static final Category LOG = Category.getInstance(SharkGeneralToolAgent.class);
    private static final boolean DEBUG = LOG.isDebugEnabled();

    public static void execute(final AppParameter activityName, final AppParameter activityConfig,
                               final AppParameter inputFile, final AppParameter outputFile,
                               final AppParameter exception) throws PackageException {

        String method = null;
        try {
            // Find method in registry or throw an exception if not registered.
            final byte[] request = ScriptUtils.getBytes(inputFile);
            final OMActivityRegistry registry = OMActivityRegistryLocator.getRegistry();
            method = (String) activityName.the_value;
            final OMActivity activity = registry.get(method);
            if (activity == null) {
                throw new OMActivityException("service method \"" + activityName.the_value + "\" not registered.");
            }

            if (DEBUG) {
                LOG.debug("activity \"" + method + "\" found");
            }

            // Configure activity.
            final String config = (String) activityConfig.the_value;
            Object configuration = null;
            if (!"".equals(config) && config != null) {
                configuration = OMUtils.readResourceAsObject(config);
                if (DEBUG) {
                    LOG.debug("configuring activity \"" + method + "\" successful");
                }
            }

            // Call activity.
            final byte[] result = activity.invoke(request, configuration);
            ScriptUtils.getResultInNewFile(inputFile, outputFile, result);
            LOG.info("service method \"" + method + "\" " +
                    "with input \"" + new File((String) inputFile.the_value).getName() + "\" " +
                    "to output \"" + new File((String) outputFile.the_value).getName() + "\" successful");
        }
        catch (ServiceInternalException e) {
            // Attention: Don't throw exception here. Exception will be handled by following tool, as otherwise this
            // tool parameters won't be committed.
            final String message = "warnings or exceptions calling service method \"" + method + "\". " + e.getMessage();
            exception.the_value = e.getMessage();
            LOG.error(message, e);
        }
        catch (ServiceException e) {
            // Attention: Don't throw exception here. Exception will be handled by following tool, as otherwise this
            // tool parameters won't be committed.
            final String info = OMConstants.ERROR_SERVICE_UNAVAILABLE;
            final String message = "problems calling service for method \"" + method + "\". " + info;
            exception.the_value = info;
            LOG.error(message, e);
        }
        catch (OMActivityException e) {
            final String message = "problems with invokation of service method \"" + method + "\"";
            LOG.fatal(message, e);
            throw new PackageException(message, e);
        }
        catch (IOException e) {
            final String message = "problems de-/serializing data or configuration from \"" + inputFile.the_value +
                    "\" into \"" + outputFile.the_value + "\" for method \"" + method + "\"";
            LOG.fatal(message, e);
            throw new PackageException(message, e);
        }
    }
}

Attachment: Deadlock.zip
Description: Binary data

Attachment: workflow-aurora.xpdl
Description: Binary data



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.