Re: [PHP4BETA] session locking?
| From: | Boris Erdmann | Date: | Fri, 03 Dec 1999 09:10:42 +0000 |
| Subject: | Re: [PHP4BETA] session locking? | ||
| References: | 1 2 3 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-7306@lists.php.net to get a copy of this message | ||
Sascha Schumann wrote:
>
> On Thu, Dec 02, 1999 at 11:09:35PM +0100, Boris Erdmann wrote:
> > Hartmut Holzgraefe wrote:
> > >
> > > Is there any way to sync session usage between different script
> > > instances ?
> > >
> > > What i am trying to do is to display a mail i fetched from a pop3
> > > server.
> > > Lets imagine a mail containing HTML text with two inlined images.
> > >
> > > script 1 fetches the entire message from the pop3 server and extracts
> > > the different mime parts. theese are stored in session variables
> > >
> > > the IMG references in the HTML code get patched so that they now refer
> > > to
> > > script 2 and 3 which will generate the images from the data stored in
> > > the
> > > session
> > >
> > > but when the output of script 1 is transfered to the browser, the
> > > browser
> > > will send a request for the images as soon as the image tag is closed
> > > so script 2 might get started even before script 1 has actually finished
> > > and written back its session data ( see timeline below )
> > >
> > Yes,
> >
> > i second that. This is an issue when building sites with frameset pages, too.
>
> I've thought about that as well, but did not consider the
> asynchronous nature of generating web pages. Generally, you
> can avoid this by calling
>
> ob_start();
Hmm, where do i find documentation on that?
> at the beginning of the page which starts the session (i.e.
> the frameset-generating page).
>
> We might add a session_sync() call which would save the
> current state of the session without closing the session.
This would not bring a solution in any way: Still two scripts
could write a completly different set of session variables with
a short delay. Thus the first computation being lost.
A real help is to open a page with reading the session variables only.
This is why phplib has to page_open and page_close each page. This
way a frameset document can can have a main frame which does real computing
on the session variables and the results get written back, while the other
frames open the session pool only for reading and displaying contents of
those variables.
Maybe this can be done with the current session implementation. i dont know.
But the real solution would be blocking locking controlled
explicitly by the php-script. Well, i dont know if this is possible.
Boris