Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2037

ValidationTracker/Flash persistence race condition with AJAX

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.1.0.5
    • 5.4
    • tapestry-core
    • None

    Description

      I have a form with a field validated using an AJAX request on blur, both form and AJAX requests go to the same page. Sometimes when I submit an invalid form with the AJAX-validated field filled as last, the form will return with no values and no errors shown (should return with last values and validation errors above).

      I tracked the issue down to the form's ValidatorTracker in form re-display request being a different object than the one that I store validation errors in. I have no conclusive proof but I believe what happens is that a race condition occurs between the submit - redirect back to form logic and the AJAX field validation (the AJAX validation is fired the same instance as form submit since it's the last field of the form). The form's validation tracker is by default taken from the defaultValidationTracker property which has PersistenceConstants.FLASH (i.e. stored until next request). I think that the cause of ValidationTracker not being the same in re-display and in submit request might be the AJAX validation request (or its critical part) getting in between the two requests used for form submission and re-display, like this:

      • form submit (creates a ValidationTracker and stores errors in it)
      • AJAX validation request ("eats up" the ValidationTracker's lifetime of "until next request")
      • form re-display request (creates a new ValidationTracker with no errors in it)

      Attachments

        Issue Links

          Activity

            People

              hlship Howard Lewis Ship
              wgg Jiri Tousek
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: