BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Isolation problem on ISAPI

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker
View previous topic :: View next topic  
Author Message
Hans van Leth
Guest





PostPosted: Fri Feb 23, 2007 5:12 am    Post subject: Isolation problem on ISAPI Reply with quote



Hi,

We have an ISAPI webbroker dll, developed in Delphi 7, running on IIS6
and we have the problem that *sometimes* part of one user's response
screen shows up piled on top of another user's response screen.

The structure is very straigtforward: each WebAction completely handles
a request and finishes by setting ResponseContent and calling SendContent.

For debugging, we write a line to a text file in the WebModule OnCreate
event and this way we found that the problem occurs when a second
instance of the module is created.

We use some global variables that first get initialized then manipulated
(f.i. sHTML string populated) in several procedures called in succession
from the WebAction event.

Can someone pls acknowledge the following assumptions:

1. The use of global variables is allowed, provided they are initialized
in the WebAction event.

2. We assume that Handled is True by default.

3. We assume that WebAction.PathInfo can distinguish between /page1 and
/page11 even though the first is a partial match of the 2nd.

Also for debugging we've added two global integers, don't init them
anywhere, and inc one in the OnCreate event, and inc the other in each
WebAction event, and show these variables in the response screen. So
just after reset, the two show up as 1 and 1. After some interaction,
they are say 1 and 50. At that point, the second instance of the module
is created, and the numbers 2 and 51 are shown, indicating that these
global variables are not initialized to 0 as we expected them to be.

Thanks for any remarks and help!

Hans van Leth,
Netherlands.
Back to top
danny heijl
Guest





PostPosted: Fri Feb 23, 2007 9:11 am    Post subject: Re: Isolation problem on ISAPI Reply with quote



Hans van Leth schreef:

Quote:
1. The use of global variables is allowed, provided they are initialized
in the WebAction event.

The use of global variables is not allowed, unless they are read-only or
protected against concurrent write access by a critical section (and in
this way they will limit the scalability of your application by limiting
concurrency).

Also, in IIS-6, you can run your isapi in a seperate application pool
(highly recommended) with several worker process simultaneously (higly
recommended) so that global variables are no longer really global, they
are only global for the instance of the worker process your isapi
happens to run in.

Danny
---
Back to top
Hans van Leth
Guest





PostPosted: Fri Feb 23, 2007 4:37 pm    Post subject: Re: Isolation problem on ISAPI Reply with quote



danny heijl schreef:
Quote:
The use of global variables is not allowed, unless they are read-only or
protected against concurrent write access by a critical section (and in
this way they will limit the scalability of your application by limiting
concurrency).

Thanks for that, it gives me some pointers to investigate further.

Can you pls shed some light as to how to structure variables?
The only thing I can think of now is to create all variables in the
WebAction event, and pass all these as var with every call to procedures
or functions. Maybe there's a better way?

Thanks!

Hans.
Back to top
Dan Downs
Guest





PostPosted: Fri Feb 23, 2007 9:46 pm    Post subject: Re: Isolation problem on ISAPI Reply with quote

Quote:
Can you pls shed some light as to how to structure variables?
The only thing I can think of now is to create all variables in the
WebAction event, and pass all these as var with every call to procedures
or functions. Maybe there's a better way?

I made a class that contains all the misc info, properties, db connection,
etc.. and create one at the start of an action and pass it along, then at
the end of the action free it.

DD
Back to top
Hans van Leth
Guest





PostPosted: Sat Feb 24, 2007 3:50 am    Post subject: Re: Isolation problem on ISAPI Reply with quote

Dan Downs schreef:
Quote:
I made a class that contains all the misc info, properties, db connection,
etc.. and create one at the start of an action and pass it along, then at
the end of the action free it.

Thats a great idea, thanks for sharing it!

One last question: I have a single WebModule with ADO components dropped
on it. Is this still safe? Or should these also be created in the event?

Thanks in advance!

Hans.
Back to top
Kevin Frevert
Guest





PostPosted: Sat Feb 24, 2007 5:23 pm    Post subject: Re: Isolation problem on ISAPI Reply with quote

"Hans van Leth" <Hans.v.L (AT) xs4all (DOT) nl> wrote in message
news:45df617e$1 (AT) newsgroups (DOT) borland.com...
Quote:
Dan Downs schreef:
I made a class that contains all the misc info, properties, db
connection, etc.. and create one at the start of an action and pass it
along, then at the end of the action free it.

Thats a great idea, thanks for sharing it!

One last question: I have a single WebModule with ADO components dropped
on it. Is this still safe? Or should these also be created in the event?

Perfectly safe.

Take a look at...
http://www.midwayusa.com

Nearly everything is written in Delphi 6 and ADO accessing SQL Server
2000/2005.

krf
Back to top
Dan Downs
Guest





PostPosted: Fri Mar 02, 2007 1:04 am    Post subject: Re: Isolation problem on ISAPI Reply with quote

Quote:
I made a class that contains all the misc info, properties, db
connection, etc.. and create one at the start of an action and pass it
along, then at the end of the action free it.

Thats a great idea, thanks for sharing it!

Oh one other thing, I made a "CustomConnecter" class that contains the basic
methods and properties, but left the child class to actually do some of the
work, handle database connection creatation, link to the TWebRequest and
TWebResponse, things like that so I could build test apps or reuse some of
my other classes that require a Connector object on creation. Its something
thats slowly evolved over the years, but it works pretty good for me.


Quote:
One last question: I have a single WebModule with ADO components dropped
on it. Is this still safe? Or should these also be created in the event?

I messed around with this for awhile, and in the end I just create my
ADOConnection in my connector's GetADOConnection method so it only gets
created when needed, but for anything needed for this one request I use
OnBeforeDispatch and OnAfterDispatch, it clears up any wierd issues from
threadpooling if you have it on. All of my webbroker apps are compiled as
Apache DSO modules, so they tend to work a little differently that they
would under IIS.

DD
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.