Hi all, I have a scheduled process which runs at 12AM everyday.In that proc

Hi all,
I have a scheduled process which runs at 12AM everyday.In that process I am getting following error.Also I have attached stack trace if that helps.

Problem: An invalid expression has been encountered in a task.

Details: ERROR:An error occurred while evaluating expression: myfunc() (Expression evaluation error in rule 'myfunc()' at function 'queryruleexec': Error evaluating function 'queryruleexec' : Cannot open connection) (Data Outputs)

Recommended Action: Check the expression including any function requirements and resume.

stack trace.txt

OriginalPostID-148555

OriginalPostID-148555

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Have you tried just testing the query rule that is causing this issue to see if it's something wrong with the data source?

    Has this issue always happened or had the process worked before and is now not working?
  • @sanketh Hi, if you haven't made a search already in the forum, this link might help you: /search?q=OriginalPostID-138449.

    As far as my knowledge is considered, I would like to suggest to do following in order to resolve the issue:
    1. As said by conorc, test the query rule and check if it's working. If you are sure that there is a problem with datasource, contact the Server administrators team. Also ensure that there aren't any connectivity issues.
    2. If step - 1 looks good, ensure that your design won't permit the multiple queries made at the same time. For instance, the scheduled process creating hundreds of asynchronous instances and each instance in-turn trying to query the database.
  • @sanketh- that looks like an exhausted connection pool issue. As suggested in the earlier comment it could be caused by the process spawning a plethora of database calls. If that is the case you may have to revisit the design or make subsequent changes to the connection pool size
  • Actually if you dig deeper into the stack trace the relevant two "Caused by" clauses are:

    Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection

    and

    Caused by: javax.resource.ResourceException: No matching credentials in Subject!

    Note how the first one states the connection cannot be opened but it doesn't tell you why, it's at this point where you need to go down lower into the stack trace to the next "Caused by" to find out the root cause which in this case is not the pool being exhausted but an issue with the credentials probably an expired password.
  • Hi all thank you for your responces,
    When I Manually test that query it is returning me data.
    @Eduardo - when I debug my process model it is running correctly(no problem in credentials )
  • @sanketh May I know answer to this - Are you doing a spawning and triggering bunch of process instances (where each instance in-turn makes a query at some point in process) asynchronously?
  • I wonder if you ever found what the problem was, we have the same exception. It doesn't always appear but it does appear often enough to consider it a serious issue. We get this sometimes from db related smart services and sometimes when running query rules in SAIL. We also have multiple datasources configured and it appears in all datasources. I am attaching also a stack trace that contains the error for two datasources.

    NoMatchingCredentialsOnSubject.txt

  • @nikolasm To the best of my knowledge, I believe that it is due to exhausted connection pooling which is being suggested by Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection. If it is so, then some design considerations should be made when Appian is talking to database, either it could be a read/ write/ delete operation. For example, batching technique (by making use of pagination) in processes/ expressions/ interfaces, querying the data and holding them in PVs and passing the data as argument to SAIL form (when you want to query huge data sets), making use of load() effectively as much as possible etc are some of the ways to deal with this issue.
  • We are using datasources with a max-pool-size of 100. This is actually what Appian recommends e.g. here
    forum.appian.com/.../Configuring_Relational_Databases.html
    The default pool size of jboss datasources is 20. So it is actually already larger. If the code Appian is using to get a connection to the datasource is not buggy the connection should be returned to the pool after the task is done, and since we are noticing this in the test and dev environment I highly doubt it has something to do with the design of the application. I mean how can a SAIL form open up so many connections and keep them open. I think it is far more likely that there is a configuration problem. Has sanketh been able to resolve it?
  • The following error

    Caused by: javax.resource.ResourceException: No matching credentials in Subject!

    This is a documented behavior for JBoss wherein the above error may occur if two or more datasources have the same security domain.
    bugzilla.redhat.com/show_bug.cgi

    In your case, you have might have the same security domain (ds-name-security) for more than on 1 datasource. What I would suggest is to replicate the existing security domain in standalone.xml for each of your datasources with a different name. You may use the same credentials, but under a different security domain name for each datasource.