Re: Panther: AppleScript 1.9.2 Release Notes
Re: Panther: AppleScript 1.9.2 Release Notes
- Subject: Re: Panther: AppleScript 1.9.2 Release Notes
- From: christian vick <email@hidden>
- Date: Mon, 10 Nov 2003 15:19:02 +0100
>
On Nov 7, 2003, at 04:29, christian vick wrote:
>
>
>> AppleScript applets now handle incoming events in a first-in,
>
>> first-out manner. Prior to AppleScript 1.9.2, applets handled
>
>> incoming events in a last-in, first-out manner. [2553648]
>
>
>
> YES, YES, YES! This makes CGI development SO much easier, thanks to
>
> the AS team!
>
>
I don't understand. What was it doing before, and how was it not just
>
broken for everything?
I quote a reply of mine from 6/19/02 here:
*********** start quote **********
Unfortunately AS CGI's are processing request in LIFO (last in first out).
This can produce two problems.
First, if you get a huge amount of request, it can happen that none of them
ever finishes. AS CGI's are very fast, but let's assume you involve an app
which needs 5 seconds to fulfill a request and you get _continuously_ more
than 1 request per 5 seconds, then you have a problem.
The first request in in progress, the second comes in. The first is halted
and the second is executed. A third request comes in, halting request 2,
executing request 3....and so on. The user which has send request 1 becomes
impatient and hits the submit button again, producing request 4.... A
request chain which is getting larger and larger..
I don't know how many request AS can buffer, but i guess at some point you
probably get a stack overflow or something other bad.
I've never seen this problem in practice but on high traffic it might become
reality. To be clear, halted request are not dropped, they are only halted
until the newer request has finished and they continue fine if they get time
to do so.
The other thing you have to think about are global variables:
Assumed a request (which works with a global) is in progress and a second
comes in (which modifies the global), then the value of the global is not
restored when the first request continues it's execution. This will produce
surprising results...
Local variables are fine. Every halted request stores and holds the right
values for later execution. But global values retain always the last set
value, no matter which request has set that value. So, later request
override the global values of halted request.
This would be no problem if you never get a second request while the first
is in the works, but even on a site with only 10 hits a day i would not use
globals in handlers which are related to request processing, it's just not
save.
On OS 9, using Webstar, you can save an AS CGI as ".cgi" or as ".acgi".
".acgi" means it executes asynchrony with the webserver, so the server can
continue with other stuff (i.e. serving web pages) while the CGI processes a
request.
".cgi" means the webserver is halted as long the CGI processes a request.
This way you can avoid the LIFO problem since no one can send a second
request to the server until the CGI has finished the previous request.
Depending on the situation, using ".cgi" may work. But if you get a fair
amount of CGI request the entire site might become sluggish.
On OS X i haven't looked at the LIFO thing yet. I'm sure it's the same. An
interesting question is if webstar is still able to do the synchron (".cgi")
processing, since every connection is a seperate thread there.
*********** end quote ********
Greetings
Christian
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.