Re: Storing a copy of a DataObject in the session

From: Mike Kienenberger (mkienen..laska.net)
Date: Wed Mar 16 2005 - 13:05:23 EST

  • Next message: Joshua Pyle: "Re: User Role"

    Bryan Lewis <brya..aine.rr.com> wrote:
    > I second Fredrik's kudos to you guys. The CAY-256 patch Mike recommended
    > below did indeed fix the problem, at least in my initial tests. I checked
    > out the latest source from CVS (the patch wasn't yet in the 1.2M2
    version),
    > built it and the problem went away.
    >
    > Mike, you also said "so long as you're sure that your web app can't
    process
    > two requests for the same session simultaneously." The test for that case
    > would be: open a new window on the same session (with Ctrl-N in iE, for
    > example) and submit simultaneious requests, right? Just making sure I
    > understand the issue.

    In theory, but it's tricky to test race conditions like this in practice.

    Here's what I can tell you for sure.

    Struts does not prevent this situation natively. You'll have to modify
    RequestProcessor to do it for you (not too difficult).
    WebObjects 5.1 (and earlier) automatically serialize all requests (not just
    by session) and will not have this problem.

    I don't know enough about other web frameworks to tell you how they behave.
    If there's nothing documented, it's probably an issue.

    Probably a good way to test is to pick an application URL that updates
    something (ie, creates a new record), modify it to put a one-second delay in
    there (and output that you reached that section of code) right before you
    commit, then open the page twice. If both complete in one second, you've
    got potential problems. If it takes one second for the first page, and
    another second for the second page, you've got serialized session request
    behavior. Actually, the above can be done simply using output statements
    and leaving Cayenne out of the picture. But it'll show you what would
    happen if you leave cayenne in :) [ie, the first commit executed creates two
    records and the second none]

    -Mike



    This archive was generated by hypermail 2.0.0 : Wed Mar 16 2005 - 13:04:17 EST