Skip to content

Concurrent retrieval of prototype-scoped beans may result in null @Autowired fields [SPR-9256] #13894

Closed

Description

@spring-projects-issues

Kyrill Alyoshin opened SPR-9256 and commented

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???


Affects: 3.1 GA

Issue Links:

Activity

  1. spring-projects-issues commented on Mar 21, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Kyrill Alyoshin commented

    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...

  2. spring-projects-issues commented on Mar 26, 2012

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    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.

  3. spring-projects-issues commented on Dec 28, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Sébastien Deleuze commented

    Closing groups of outdated issues. Please reopen if still relevant.

  4. added
    type: bug
    status: declined
    in: core
    and removed
    type: bug
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: corestatus: declined

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions