Skip to content

Race condition in handling of @Lookup annotation [SPR-14333] #18905

Closed
@spring-projects-issues

Description

@spring-projects-issues

Piotr Findeisen opened SPR-14333 and commented

repro steps
  1. Have a prototype bean with a @Lookup method.
  2. Try to acquire it (for the first time) from 2 or more threads concurrently
  3. Call the @Lookup on acquired instance (either directly if it's pubic, or call other method that uses the @Lookup method if that one is protected
expected
  • @Lookup intercepted and served by the DI container
observed
  • Sometimes, the @Lookup method is not overridden, as if there was some kind of race condition or other concurrency issue in handling of that annotation.
workaround

Use <lookup-method/> in XML configuration. That one is handled at parse time, which is definitely single threaded, and does not suffer from concurrent lazy initialization.


Affects: 4.2.2, 4.2.6

Referenced from: commits 9131ebb, 47c62fd

Backported to: 4.2.7

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions