Skip to content

Debug logging for DependencyInjectionTestExecutionListener breaks injection for parallel tests [SPR-10635] #15263

Closed

Description

@spring-projects-issues

Chris Hansen opened SPR-10635 and commented

Setup:

  • JUnit 4.11
  • Surefire 2.14.1 with <parallel>methods</parallel> or <parallel>both</parallel>
  • Spring 3.2.3.RELEASE
  • log4j 1.2.17
    • log4j.properties contains log4j.logger.org.springframework.test.context.support.DependencyInjectionTestExecutionListener=DEBUG

With the above setup, dependency injection works on one method, yet fails on another (same test class, separate test class instances). If you comment out log4j.logger.org.springframework.test.context.support.DependencyInjectionTestExecutionListener=DEBUG from log4j.properties, it works. This behavior is VERY consistent for me.

Minimal failing example project: https://github.com/hansenc/parallel-injection-bug


Affects: 3.2.3

Reference URL: https://github.com/hansenc/parallel-injection-bug

Issue Links:

Activity

  1. spring-projects-issues commented on Jun 9, 2013

    @spring-projects-issues
    CollaboratorAuthor

    Sam Brannen commented

    Thanks for creating the project on GitHub. That made it easy to try out your scenario!

    However, having experimented with your example, it turns out that logging is not the cause of the problem. Instead, concurrent execution of tests in the TestContext framework is a more general problem which will be addressed in #10532.

    FYI: turning on debug logging simply increases the chance that the test in your example fails, but if you run the test multiple times without debug logging enabled then the test will still fail sporadically depending on the current CPU load on your machine.

  2. spring-projects-issues commented on Jun 9, 2013

    @spring-projects-issues
    CollaboratorAuthor

    Sam Brannen commented

    This issue is essentially a duplicate of #10532.

  3. spring-projects-issues commented on Jun 10, 2013

    @spring-projects-issues
    CollaboratorAuthor

    Chris Hansen commented

    That makes perfect sense. Thanks for looking into it!

  4. added
    type: bug
    in: test
    status: duplicate
    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

Labels

in: teststatus: duplicate

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions