[jboss-jira] [JBoss JIRA] (WFLY-6678) StackoverflowError ejbclientinvocationcontext

jaikiran pai (JIRA) issues at jboss.org
Mon Jun 13 09:03:00 EDT 2016


    [ https://issues.jboss.org/browse/WFLY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251496#comment-13251496 ] 

jaikiran pai commented on WFLY-6678:
------------------------------------

Looking at the code I don't see how it would end up in this situation, unless of course the interceptor chain itself has got (extremely) long. So I see this in the code you pasted in the reproducer:
{code}
  /**
   * Get service needed authentication
   * 
   * @param userContext
   * @return
   */
  public T getService(final String fullUserId, final String applicationName) {
    try {
      final Properties ejbClientContextProps = new Properties();
      ejbClientContextProps.put("org.jboss.ejb.client.scoped.context", "true");
      final Context initialContext = new InitialContext(ejbClientContextProps);
      EJBClientContext.requireCurrent().registerInterceptor(0x99999, new ProxyInterceptor(fullUserId, applicationName));
      return (T) initialContext.lookup(jndiName);
    }
    catch (NamingException e) {
      LOGGER.warn("Service non disponible : " + jndiName + ", " + e);
    }
    return null;

  }
{code}

I don't know, how/where that method of your application gets called from. But this specific statement in there:

{code}
      EJBClientContext.requireCurrent().registerInterceptor(0x99999, new ProxyInterceptor(fullUserId, applicationName));
{code}

looks really suspicious. So you could be enrolling a new instance of the interceptor to the same EJBClientContext repeatedly, every single time (invocation?). Within the EJBClient library we _don't_ have a check to error out in cases where more than one interceptor instance is added to the same priority. So essentially this can lead to multiple instances of that interceptor to end up being put in the interceptor chain of that invocation and lead to an extremely long chain. This theory also fits in with what you say in your description:

{quote}
Sometimes after few days i get an exception
{quote}

So I would suggest, you change that code above to register that interceptor only once per EJBClientContext. Without knowing/seeing more context for that code of your application, I can't suggest where/how to do that such that it registers it only one per context.



> StackoverflowError ejbclientinvocationcontext
> ---------------------------------------------
>
>                 Key: WFLY-6678
>                 URL: https://issues.jboss.org/browse/WFLY-6678
>             Project: WildFly
>          Issue Type: Bug
>          Components: EJB
>         Environment: wildfly 9.0.1, jdk 1.8
>            Reporter: Jimmy Pannier
>         Attachments: server.log
>
>
> Sometimes after few days i get an exception
> Here is a stacktrace.
> 2016-06-07 07:38:10,441 ERROR [org.jboss.as.ejb3.invocation] (default task-76) WFLYEJB0034: EJB Invocation failed on component StorageServiceImpl for method public abstract java.util.List com.inovelan.cloud.api.storage.service.dataset.IStorageEjbService.loadData(com.inovelan.cloud.api.storage.model.dto.dataset.LoadDataConfig): javax.ejb.EJBTransactionRolledbackException: WFLYEJB0457: Unexpected Error
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:153)
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:256)
> 	at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:329)
> .....
> Caused by: java.lang.StackOverflowError
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> 	at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> 	at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list