Grails
  1. Grails
  2. GRAILS-3406 Top level task: Controller Improvements
  3. GRAILS-1139

Flash scope is unsafe as it does not know which request / flow the flash relates to

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Won't Fix
    • Affects Version/s: 0.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      As flash is not bound to any kind of flow ID currently, the next request might be for another resource not part of the current flow, and hence wipe out the flash scope before the next (intended) page is retrieved.

      This should be easy to fix once flows are implemented

        Activity

        Marc Palmer created issue -
        Hide
        David Smiley added a comment -

        I'm not sure if this bug report is for what I'm seeing... but basically, I'm seeing the flash scope having values from the previous request even though it wasn't a redirect. AFAIK, flash should only retain its values from one request to the next if it is redirected. By keeping the values around, my code is confused and thinks it needs to re-display a message to the user.

        Show
        David Smiley added a comment - I'm not sure if this bug report is for what I'm seeing... but basically, I'm seeing the flash scope having values from the previous request even though it wasn't a redirect. AFAIK, flash should only retain its values from one request to the next if it is redirected. By keeping the values around, my code is confused and thinks it needs to re-display a message to the user.
        Hide
        Marc Palmer added a comment -

        David - in Grails flash scope is always available, it doesn't matter how you go there.

        However the above issue with flows exists I believe.

        Show
        Marc Palmer added a comment - David - in Grails flash scope is always available, it doesn't matter how you go there. However the above issue with flows exists I believe.
        Graeme Rocher made changes -
        Field Original Value New Value
        Fix Version/s 1.1 [ 13674 ]
        Fix Version/s 1.0-RC1 [ 13341 ]
        Graeme Rocher made changes -
        Parent GRAILS-3406 [ 73800 ]
        Issue Type Bug [ 1 ] Sub-task [ 7 ]
        Graeme Rocher made changes -
        Fix Version/s 1.1-beta1 [ 13674 ]
        Fix Version/s 1.1-beta2 [ 14752 ]
        Graeme Rocher made changes -
        Fix Version/s 1.1-beta2 [ 14752 ]
        Fix Version/s 1.1-beta3 [ 14824 ]
        Graeme Rocher made changes -
        Fix Version/s 1.1-RC1 [ 14929 ]
        Fix Version/s 1.1-beta3 [ 14824 ]
        Hide
        Graeme Rocher added a comment -

        Moving non-critical issues that aren't going to make it into 1.1 to 1.2

        Show
        Graeme Rocher added a comment - Moving non-critical issues that aren't going to make it into 1.1 to 1.2
        Graeme Rocher made changes -
        Fix Version/s 1.1-RC1 [ 14929 ]
        Fix Version/s 1.2 [ 14155 ]
        Hide
        Ryan Zezeski added a comment -

        I believe I'm encountering the same problem. I have two actions 1) show and 2) update. The 'show' action places a JSON structure in the Flash that the 'update' action relies on. Users were reporting intermittent NPE's when invoking the 'update' action. It turns out the problem is that there are multiple ExtJS tables on the same page that do asynchronous requests back to the same web-app. If the user clicks refresh on one of the tables, then that request wipes the JSON structure that was in the Flash, and then when the user invokes the update action a NPE occurs.

        I plan to fix this by just putting the structure in the session, but I thought I'd confirm this issue.

        Show
        Ryan Zezeski added a comment - I believe I'm encountering the same problem. I have two actions 1) show and 2) update. The 'show' action places a JSON structure in the Flash that the 'update' action relies on. Users were reporting intermittent NPE's when invoking the 'update' action. It turns out the problem is that there are multiple ExtJS tables on the same page that do asynchronous requests back to the same web-app. If the user clicks refresh on one of the tables, then that request wipes the JSON structure that was in the Flash, and then when the user invokes the update action a NPE occurs. I plan to fix this by just putting the structure in the session, but I thought I'd confirm this issue.
        Graeme Rocher made changes -
        Fix Version/s 1.2-M1 [ 14155 ]
        Fix Version/s 1.2-M2 [ 15425 ]
        Hide
        Ueli Kistler added a comment -

        Same problem using asynchronous calls as well, using just a single action.

        Reproducing the problem:
        1. A asynchronous call is triggered from the browser
        2. flash scope is used and a message list is inserted (flash.messages)
        3. Message is shown correctly
        4. Another asynchronous call is triggered, same action
        5. The list is still in the flash scope, containing the previous message as well!
        6. Both messages are show (previous and current)
        6. 3rd asynchronous call, same action
        7. flash scope is empty again, then filled with a new message
        8. .. and so on, it (somehow) consitently shows the current message then last & current and current message again

        Tested in Firefox and Chrome, same behaviour.

        Workaround:
        Reset your flash scope variables at each request

        Show
        Ueli Kistler added a comment - Same problem using asynchronous calls as well, using just a single action. Reproducing the problem: 1. A asynchronous call is triggered from the browser 2. flash scope is used and a message list is inserted (flash.messages) 3. Message is shown correctly 4. Another asynchronous call is triggered, same action 5. The list is still in the flash scope, containing the previous message as well! 6. Both messages are show (previous and current) 6. 3rd asynchronous call, same action 7. flash scope is empty again, then filled with a new message 8. .. and so on, it (somehow) consitently shows the current message then last & current and current message again Tested in Firefox and Chrome, same behaviour. Workaround: Reset your flash scope variables at each request
        Hide
        Ueli Kistler added a comment -

        This is actually expected when using flash scope ..
        http://grails.org/doc/1.1.x/ref/Controllers/flash.html

        Show
        Ueli Kistler added a comment - This is actually expected when using flash scope .. http://grails.org/doc/1.1.x/ref/Controllers/flash.html
        Hide
        Marc Palmer added a comment -

        Ueli I think you are misunderstanding the problem.

        Flash scope is not bound to the current flow, so you can get pollution of flash between concurrent flows. This is a bug.

        Show
        Marc Palmer added a comment - Ueli I think you are misunderstanding the problem. Flash scope is not bound to the current flow, so you can get pollution of flash between concurrent flows. This is a bug.
        Graeme Rocher made changes -
        Fix Version/s 1.2-M3 [ 15547 ]
        Fix Version/s 1.2-M2 [ 15425 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2-RC1 [ 15774 ]
        Fix Version/s 1.2-M3 [ 15547 ]
        Graeme Rocher made changes -
        Fix Version/s 1.2-M4 [ 15774 ]
        Fix Version/s 1.2-RC1 [ 15959 ]
        Hide
        Graeme Rocher added a comment -

        There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3

        for 1.2 final only issues considered blocking will now be fixed

        Show
        Graeme Rocher added a comment - There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3 for 1.2 final only issues considered blocking will now be fixed
        Graeme Rocher made changes -
        Fix Version/s 1.2-RC1 [ 15959 ]
        Fix Version/s 1.3 [ 15400 ]
        Graeme Rocher made changes -
        Fix Version/s 1.3-M1 [ 15400 ]
        Fix Version/s 1.3-RC1 [ 16274 ]
        Graeme Rocher made changes -
        Fix Version/s 1.3-RC1 [ 16274 ]
        Graeme Rocher made changes -
        Assignee Graeme Rocher [ graemerocher ]
        Hide
        Matthias Hryniszak added a comment -

        Ueli, can you produce an example showing this problem and attach it to this bug?

        Show
        Matthias Hryniszak added a comment - Ueli, can you produce an example showing this problem and attach it to this bug?
        Contegix Support made changes -
        Project Import Thu Mar 24 21:22:24 CDT 2011 [ 1301019744151 ]
        Burt Beckwith made changes -
        Workflow jira [ 35180 ] Grails [ 41233 ]
        Burt Beckwith made changes -
        Workflow Grails [ 41233 ] Copy of Grails [ 48662 ]
        Burt Beckwith made changes -
        Workflow Copy of Grails [ 48662 ] Grails [ 56072 ]
        Burt Beckwith made changes -
        Workflow Grails [ 56072 ] Grails2 [ 63615 ]
        Burt Beckwith made changes -
        Workflow Grails2 [ 63615 ] jira [ 77879 ]
        Burt Beckwith made changes -
        Workflow jira [ 77879 ] Grails2 [ 86180 ]
        Peter Ledbrook made changes -
        Last Reviewed 01/Jan/10
        Peter Ledbrook made changes -
        Workflow Grails2 [ 86180 ] jira [ 94562 ]
        Peter Ledbrook made changes -
        Workflow jira [ 94562 ] Grails2 [ 102706 ]
        Hide
        cdeszaq added a comment -

        Given that this also has a rather large impact on REST-oriented applications that use REST JSON and/or XML responses to AJAX calls, it would make sense to address this for v2.2 with the proposed server-side REST improvements.

        Show
        cdeszaq added a comment - Given that this also has a rather large impact on REST-oriented applications that use REST JSON and/or XML responses to AJAX calls, it would make sense to address this for v2.2 with the proposed server-side REST improvements.
        Hide
        Jeff Scott Brown added a comment -

        For the scenario where a webflow is putting something in flash scope that is relevant to that flow, that information should instead be put in flow scope, correct?

        Show
        Jeff Scott Brown added a comment - For the scenario where a webflow is putting something in flash scope that is relevant to that flow, that information should instead be put in flow scope, correct?
        Hide
        Jeff Scott Brown added a comment -

        The problem described here may be a misuse of flash. The definition of flash is data put there will be removed after processing the next request. If the next request is part of some other flow, that definition still holds true.

        I think that this should probably be closed as "Won't Fix" and if there is interest in having the webflow plugin support some kind of flow specific flash (separate from flow scope) then the plugin could provide something like that.

        Show
        Jeff Scott Brown added a comment - The problem described here may be a misuse of flash. The definition of flash is data put there will be removed after processing the next request. If the next request is part of some other flow, that definition still holds true. I think that this should probably be closed as "Won't Fix" and if there is interest in having the webflow plugin support some kind of flow specific flash (separate from flow scope) then the plugin could provide something like that.
        Jeff Scott Brown made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Marc Palmer
          • Votes:
            8 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development