You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Emmanuel Touzery (Jira)" <ji...@apache.org> on 2020/06/19 09:20:00 UTC

[jira] [Updated] (TOMEE-2851) sometimes getting null when injecting TransactionSynchronizationRegistry / Injection data not found in JNDI context

     [ https://issues.apache.org/jira/browse/TOMEE-2851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Touzery updated TOMEE-2851:
------------------------------------
    Description: 
Hello,

    we're injecting TransactionSynchronizationRegistry in some error handling path in our application:

    @Resource
    private TransactionSynchronizationRegistry transactionSynchronizationRegistry;

    What we do is that we store some meta-data which is valid for the SQL transaction scope in that registry, so that if there is an error down the line, we can tie the error to this meta-data. And this works fine but after days of running a production workload, we get errors because this injection fails.

    We get this error concurrently on multiple threads:

17-Jun-2020 10:54:53.809 WARNING [managed-thread-18] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry17-Jun-2020 10:54:53.810 WARNING [managed-thread-8] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.810 WARNING [managed-thread-16] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.809 WARNING [managed-thread-7] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.811 WARNING [managed-thread-16] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.812 INFO [managed-thread-16] com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal em: org.apache.openejb.persistence.JtaEntityManager@619cca3f - managed-thread-16
17-Jun-2020 10:54:53.812 WARNING [managed-thread-10] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.812 WARNING [managed-thread-18] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry

And very shortly afterwards:

17-Jun-2020 10:54:53.814 SEVERE [managed-thread-16] com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal Failed publishing rabbit message
        java.lang.NullPointerException
                at com.littransit.rabbitmq.RabbitChangesPublisher.writeRabbitOutboxAccountItem(RabbitChangesPublisher.java:50)

And this is a NPE reading the transactionSynchronizationRegistry injected field.

Shortly afterwards we see this issue again in other managed threads:

17-Jun-2020 10:54:53.836 WARNING [managed-thread-12] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.843 WARNING [managed-thread-12] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.844 WARNING [managed-thread-19] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry

This is happening in managed threads that we instanciated with:

    @Resource
    private ManagedThreadFactory factory;

Then factory.newThread(...).

We do not understand how come @Resource TransactionSynchronizationRegistry works, until it doesn't. We are using TOMEE 8.0.1 on java11. It seems to us like a bug, that the injection suddenly stops working.



  was:
Hello,

{{    we're injecting TransactionSynchronizationRegistry in some error }}{{handling path in our application: }}

 

     @Resource

{{    private TransactionSynchronizationRegistry }}{{transactionSynchronizationRegistry; }}

 

{{    What we do is that we store some meta-data which is valid for the }}{{SQL transaction scope in that registry, so that if there is an error }}{{down the line, we can tie the error to this meta-data. And this works }}{{fine but after days of running a production workload, we get errors }}{{because this injection fails. }}

    We get this error concurrently on multiple threads:

{{17-Jun-2020 10:54:53.809 WARNING [managed-thread-18] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry17-Jun-2020 }}{{10:54:53.810 WARNING [managed-thread-8] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}{{17-Jun-2020 10:54:53.810 WARNING [managed-thread-16] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}{{17-Jun-2020 10:54:53.809 WARNING [managed-thread-7] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}{{17-Jun-2020 10:54:53.811 WARNING [managed-thread-16] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}{{17-Jun-2020 10:54:53.812 INFO [managed-thread-16] }}{{com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal em: }}{{org.apache.openejb.persistence.JtaEntityManager@619cca3f - managed-thread-16 }}{{17-Jun-2020 10:54:53.812 WARNING [managed-thread-10] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}{{17-Jun-2020 10:54:53.812 WARNING [managed-thread-18] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}

And very shortly afterwards:

{{17-Jun-2020 10:54:53.814 SEVERE [managed-thread-16] }}{{com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal }}{{Failed publishing rabbit message }}

        java.lang.NullPointerException

{{                at }}{{com.littransit.rabbitmq.RabbitChangesPublisher.writeRabbitOutboxAccountItem(RabbitChangesPublisher.java:50) }}

 

{{And this is a NPE reading the transactionSynchronizationRegistry }}{{injected field. }}

Shortly afterwards we see this issue again in other managed threads:

{{17-Jun-2020 10:54:53.836 WARNING [managed-thread-12] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}{{17-Jun-2020 10:54:53.843 WARNING [managed-thread-12] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}{{17-Jun-2020 10:54:53.844 WARNING [managed-thread-19] }}{{org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties }}{{Injection data not found in JNDI context: }}{{jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', }}{{target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry }}

This is happening in managed threads that we instanciated with:     @Resource     private ManagedThreadFactory factory; Then factory.newThread(...).

{{We do not understand how come @Resource }}{{TransactionSynchronizationRegistry works, until it doesn't. We are using }}{{TOMEE 8.0.1 on java11. }}

 

It looks like a bug to us, we don't see why the injection would work then suddenly start failing.


> sometimes getting null when injecting TransactionSynchronizationRegistry / Injection data not found in JNDI context
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: TOMEE-2851
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2851
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Core Server
>    Affects Versions: 8.0.1
>         Environment: linux, java11
>            Reporter: Emmanuel Touzery
>            Priority: Major
>
> Hello,
>     we're injecting TransactionSynchronizationRegistry in some error handling path in our application:
>     @Resource
>     private TransactionSynchronizationRegistry transactionSynchronizationRegistry;
>     What we do is that we store some meta-data which is valid for the SQL transaction scope in that registry, so that if there is an error down the line, we can tie the error to this meta-data. And this works fine but after days of running a production workload, we get errors because this injection fails.
>     We get this error concurrently on multiple threads:
> 17-Jun-2020 10:54:53.809 WARNING [managed-thread-18] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry17-Jun-2020 10:54:53.810 WARNING [managed-thread-8] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> 17-Jun-2020 10:54:53.810 WARNING [managed-thread-16] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> 17-Jun-2020 10:54:53.809 WARNING [managed-thread-7] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> 17-Jun-2020 10:54:53.811 WARNING [managed-thread-16] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> 17-Jun-2020 10:54:53.812 INFO [managed-thread-16] com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal em: org.apache.openejb.persistence.JtaEntityManager@619cca3f - managed-thread-16
> 17-Jun-2020 10:54:53.812 WARNING [managed-thread-10] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> 17-Jun-2020 10:54:53.812 WARNING [managed-thread-18] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> And very shortly afterwards:
> 17-Jun-2020 10:54:53.814 SEVERE [managed-thread-16] com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal Failed publishing rabbit message
>         java.lang.NullPointerException
>                 at com.littransit.rabbitmq.RabbitChangesPublisher.writeRabbitOutboxAccountItem(RabbitChangesPublisher.java:50)
> And this is a NPE reading the transactionSynchronizationRegistry injected field.
> Shortly afterwards we see this issue again in other managed threads:
> 17-Jun-2020 10:54:53.836 WARNING [managed-thread-12] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> 17-Jun-2020 10:54:53.843 WARNING [managed-thread-12] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> 17-Jun-2020 10:54:53.844 WARNING [managed-thread-19] org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties Injection data not found in JNDI context: jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry', target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
> This is happening in managed threads that we instanciated with:
>     @Resource
>     private ManagedThreadFactory factory;
> Then factory.newThread(...).
> We do not understand how come @Resource TransactionSynchronizationRegistry works, until it doesn't. We are using TOMEE 8.0.1 on java11. It seems to us like a bug, that the injection suddenly stops working.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)