Spring Framework
  1. Spring Framework
  2. SPR-9256

Concurrent retrieval of prototype-scoped beans may result in null @Autowired fields

    Details

    • Type: Bug Bug
    • Status: Waiting for Feedback
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1 GA
    • Fix Version/s: Waiting for Triage
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      I am hesitant to put it here because it is so hard to believe. But basically we have a prototype bean (marked through @Scope annotation) with a

      {{
      private transient SomeService service;

      @Autowired
      public void setSomeService()

      { ... } }}

      Several of such beans are concurrently retrieved from the application context. And sporadically, but reproducibly , for one of them service would be null. I have removed transient modifier and I cannot reproduce it anymore...

      It would be interesting to hear Juergen's comment on this. Is this even in the realm of possibility that a transient modifier could matter???

        Issue Links

          Activity

          Hide
          Kyrill Alyoshin added a comment -

          Hmm... I was able to reproduce it without the transient modifier. So, the modifier is not the issue. But it looks like prototype bean retrieval is not fully thread safe...

          Show
          Kyrill Alyoshin added a comment - Hmm... I was able to reproduce it without the transient modifier. So, the modifier is not the issue. But it looks like prototype bean retrieval is not fully thread safe...
          Hide
          Chris Beams added a comment -

          Hi Kyrill,

          We'll need a simple reproduction project to diagnose this one. It's understood that the failure to inject is intermittent, but something that reproduces it at least some of the time would really help. See https://github.com/SpringSource/spring-framework-issues#readme. Thanks.

          Show
          Chris Beams added a comment - Hi Kyrill, We'll need a simple reproduction project to diagnose this one. It's understood that the failure to inject is intermittent, but something that reproduces it at least some of the time would really help. See https://github.com/SpringSource/spring-framework-issues#readme . Thanks.

            People

            • Assignee:
              Unassigned
              Reporter:
              Kyrill Alyoshin
              Last updater:
              Chris Beams
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                2 years, 4 weeks, 3 days ago