Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2650

Intermittent failure in DispatchingTest caused by a race condition

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 3.1.6.Final, 4.0.0.Final
    • 3.1.5.Final
    • None
    • None

    Description

      There is a race condition in AbstractDispatchingTestCase which is causing the DispatchingTest to fail intermittently in QE lab.

      Looking e.g. into testCrossContextForward() test

      @Test
      public void testCrossContextForward(@ArquillianResource(MainServlet.class) URL contextPath) throws IOException {
         assertEquals("second:second", getResponseAsString("main/dispatch/forward?crossContext=true"));
         assertEquals("true", getResponseAsString("main/validate"));
      }
      
      

      The first request on main servlet causes FirstBean lifecycle to increase TestBean constructions and destructions count. The second request should validate that constructions and destructions counts are equals. It could happen that validate request is run before @PreDestroy manage to finish, thus validation fails with expected:<[true]> but was:<[constructions: 3, destructions: 1]> like message.

      Link for failed runs https://master-jenkins-csb-eap-qe.cloud.paas.psi.redhat.com/job/eap-7.x-weld-tests-incontainer-rhel/589/

      I manage to reproduce locally by running some heavy load on my laptop to slow down the WildFly server (not really a good reproducer). One way to reproduce this (artificially) is to add some sleep (a few millis will do the job) into TestBean#destroyed() and help the race condition to occur.

      Attachments

        Activity

          Public project attachment banner

            context keys: [headless, issue, helper, isAsynchronousRequest, project, action, user]
            current Project key: WELD

            People

              manovotn Matěj Novotný
              pkremens@redhat.com Petr Kremensky (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: