Re: Instance ID wrong?
Re: Instance ID wrong?
- Subject: Re: Instance ID wrong?
- From: Chuck Hill <email@hidden>
- Date: Tue, 2 Dec 2008 10:59:37 -0800
Hi Anjo,
On Dec 2, 2008, at 1:45 AM, Anjo Krank wrote:
Hi,
I have a problem with the Adaptor. In transaction.c, it says:
/*
* Prepare appreq to use the given instance. The instance must be
locked.
*/
static void tr_prepareToUseInstance(WOAppReq *appreq,
WOInstanceHandle instHandle)
{
_WOInstance *instance;
instance = ac_lockedInstance(instHandle);
if (instance)
{
/* this will prevent the instance from being freed */
/* note that we are holding a write lock on the app */
instance->pendingResponses++;
/* This number is used in req_reformatRequest when updating the
request URL */
memcpy(appreq->instance, instance->instanceNumber,
WA_MAX_INSTANCE_NUMBER_LENGTH);
appreq->port = instance->port;
}
}
which downs the line leads to the "wrong" instance ID given to the
app. I.e. say you request
/cgi-bin/WebObjects/Foo.woa/20/...
then, if instance 20 does not exist or fails to reply quickly
enough, the adaptor changes this to free instance 10 and rewrites
the request to
/cgi-bin/WebObjects/Foo.woa/10/...
before proceeding. Now, the problem is that there may several
reasons for 20 not to reply, but now instance 10 has no way of
knowing that the session that doesn't exist in it's own session
store didn't really expire but comes from a temporarily unavailable
instance 20. Does anyone have enough inside into the adaptors to say
why the request is rewritten?
No insight, but I will guess. It does not know if there is a session
or if it is required. If the request can be handled by a session-less
(or optional session) direct action, then this behavior is useful. I
have in fact found it useful in the past. For session based component
actions, it is fully useless with WO out of the box. If session
failover was available, this would be useful.
It looks pretty dumb to me, but maybe there is a good reason... I
think if should store the old request add at least a header to
indicate that this is not the intended instance.
I agree. At least with a header and the original URL you could show a
useful message to the user and redirect to the original instance after
some seconds.
At least the adaptor should keep a log of the occurences of a dead
instance, otherwise such a thing is a bitch to track down...
If you turn on WO Adaptor logging you can see this happen, but it
slows things down and is less than convenient to go through.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden