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 

Action taking you to previous action requested by user after

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





PostPosted: Thu Sep 04, 2003 12:12 am    Post subject: Action taking you to previous action requested by user after Reply with quote




Ok, folks this is a wierd one. I have an ISAPI application thats worked fine for 2 years, but im moving it to a different db (mysql vs oracle) and have hit issues. (see other posts) <g>

Basically, under a load a user will encounter an error that will return under IE as:

EAccessViolation at address at address 00000000. Read of address 00000000.

After they recieve the error, they can continue working with the ISAPI application but each link they click on will take them to the last link they hit previously. In other words...

Hit Link 1, get error message.
Hit back and Hit Link 2, but are taken to Link 1s destination.
Hit Link 3 and are now taken to Link 2s destination, a form.
Hit the submit button and are taken back to the form.
Hit it again and are taken to where it should have sent you the first time, etc. etc.

Restarting the browser corrects the problem in some instances.

Help!?!



Back to top
Shiv Kumar
Guest





PostPosted: Thu Sep 04, 2003 3:13 am    Post subject: Re: Action taking you to previous action requested by user a Reply with quote



Dan,

You have some issues with your code, if you're getting an AV. It looks to me
like you're referencing an object variable that has not been initialized.

Now once you have this issues, your application will seem to behave funny
because there is one cached thread (or possibly more) that is in an
"unstable" state. Since you have no control over which cached thread
services which request, this shows up as "strange" things happening. I hope
I'm making sense :)

Now, if you set IIS up such that it doesn't cache threads, your problem will
disappear. Your app will be slower however. But this is only a "test".

Are you using global variables? Are you using some sort of home grown
serialization for some of your objects?

By the way, have you moved from NT to W2K while in the process MySQL?
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com



Back to top
Dan Ridenhour
Guest





PostPosted: Thu Sep 04, 2003 3:07 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote




Shiv,

Thanks for your comments. And your explanation about an unstable thread makes perfect sense, as Ive been there before... this product has went thru multiple backends starting with BDE+Paradox way back when, making a stop at MSSQL server, and finally to Oracle 8i. Basically IT is fickle. <g> It seems that each DB architecture has its own pitfalls and problems in an ISAPI.

As for platform, its always been on NT, and NT4 since its been available. Unfortunately due to cost concerns its likely to stay there indefinitely.

Im not using global variables, everything is tracked using the MDWeb session object. I assign a sessionID in the first action and its usually the only parm passed from page to page.

The one gotcha I uncovered last night was the whole MaxStmtsPerConnection and AutoClone properties of dbexpress. Basically each connection component can only handle one active statement/query and additional queries cause additional connections to be spawned, and are cloned from the original connection. My project has 1 connection component, and a typical action may require 2-5 active tables, so each request spawns 1-4 additional connections and i havent been able to determine what happens to them after the action completes. What I think may be happening is that all these connections are eventually corrupting memory. Your thoughts?

If thats the case, I can create a set of connection components, turn off autoclone and assign each query to a connection prior to execution... but theres about 100-150 actions in the project so that will take a bit of time, so im trying to make sure before i go further on that route.

Ill look forward to your comments.

Thanks,

Dan Ridennhour
[email]dridenhour (AT) stltoday (DOT) com[/email]



"Shiv Kumar" <shivk (AT) erols (DOT) com> wrote:
Quote:
Dan,

You have some issues with your code, if you're getting an AV. It looks to me
like you're referencing an object variable that has not been initialized.

Now once you have this issues, your application will seem to behave funny
because there is one cached thread (or possibly more) that is in an
"unstable" state. Since you have no control over which cached thread
services which request, this shows up as "strange" things happening. I hope
I'm making sense :)

Now, if you set IIS up such that it doesn't cache threads, your problem will
disappear. Your app will be slower however. But this is only a "test".

Are you using global variables? Are you using some sort of home grown
serialization for some of your objects?

By the way, have you moved from NT to W2K while in the process MySQL?
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 05, 2003 11:23 am    Post subject: Re: Action taking you to previous action requested by user a Reply with quote

Quote:
It seems that each DB architecture has its own pitfalls and problems in an
ISAPI.


I've not had issues with IBX, IBO, ADO, dbExpress Smile Like you I've been
developing ISAPI Applications since D3 for production purposes. BDE was the
only pain in the butt.

Quote:

The one gotcha I uncovered last night was the whole MaxStmtsPerConnection

and AutoClone properties of dbexpress. Basically each connection component
can only handle one active statement/query and additional queries cause
additional connections to be spawned, and are cloned from the original
connection. My project has 1 connection component, and a typical action may
require 2-5 active tables, so each request spawns 1-4 additional connections
and i havent been able to determine what happens to them after the action
completes. What I think may be happening is that all these connections are
eventually corrupting memory. Your thoughts?
Quote:


Dan, I'm not sure why you think there will be more than one active statement
at any given time per connection. Are you using threads to fire queries
simultaneously?

if your 2-5 active tables is the issue (I don't this case in my apps since I
move data straight into in memory datasets), then you can employ a similar
technique.

How are you simulating a load/stress to your system in order to perform
these tests?
Another question I have is how many CPUs does your production server have.

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 05, 2003 11:52 am    Post subject: Re: Action taking you to previous action requested by user a Reply with quote

Dan,

Do your tests include "selects" only or do you also do
insert/update/deletes?

If you're doing the latter as well, then do you use SQL statements to do
these or some dataset's post method. Knowing that this is legacy code,
you're probably do that latter in this case as well.

If so, you really need to move to using SQL statements for
select/insert/update/delete. This is probably where you'll get the most
gains.

Are you able to do your stress testing such that it involves only selects?

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com



Back to top
Dan Ridenhour
Guest





PostPosted: Fri Sep 05, 2003 5:28 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote


"Shiv Kumar" <shivk (AT) erols (DOT) com> wrote:
Quote:
It seems that each DB architecture has its own pitfalls and problems in an
ISAPI.

I've not had issues with IBX, IBO, ADO, dbExpress Smile Like you I've been
developing ISAPI Applications since D3 for production purposes. BDE was the
only pain in the butt.

Your right about the BDE, its got alot of problems under ISAPI. I never worked with IBX/IBO and the last time I made a choice about db's i chose Direct Oracle Access over ADO to reduce overhead.

Quote:


The one gotcha I uncovered last night was the whole MaxStmtsPerConnection
and AutoClone properties of dbexpress. Basically each connection component
can only handle one active statement/query and additional queries cause
additional connections to be spawned, and are cloned from the original
connection. My project has 1 connection component, and a typical action may
require 2-5 active tables, so each request spawns 1-4 additional connections
and i havent been able to determine what happens to them after the action
completes. What I think may be happening is that all these connections are
eventually corrupting memory. Your thoughts?


Dan, I'm not sure why you think there will be more than one active statement
at any given time per connection. Are you using threads to fire queries
simultaneously?

Actually ive concluded that this isnt likely the problem. I reworked the app so each query had its own connection and had autoclone disabled. when placed under a load it had the same problems as my app did before.

Quote:

if your 2-5 active tables is the issue (I don't this case in my apps since I
move data straight into in memory datasets), then you can employ a similar
technique.

Im not quite sure what the issue is... thats the problem. The app has been solid for a long time. Every section of my code has exception handlers in place to return error screens that match my UI and give additional information. The problem is that the errors im getting TAccessViolation with 00000000:00000000 memory address are the default error handler, not any any of my code. From my experimentation ive determined that the errors seem to be happening BEFORE the beforedispatch of the TWebModule. Im at a loss of how to trap such an error to determine what the problem really is.

The app also works fine with 1-2 users online, it only exhibits the problems under a load. even a light one... so basically all that needs to be done is to have IIS spawn addition ISAPI treads... in other words the problem only occurs when multiple ISAPI threads have been created.

Also, the errors happen system wide, theres no localization to a specific web action... basically it just dies somewhere before BeforeDispatch when trying to process an actions request.

Quote:

How are you simulating a load/stress to your system in order to perform

Its an NT4, 500mhz PC. 256mb RAM, 20gb disk. Nothing special.. just a workstation reutilized as a server for testing. I run the oracle client on this box as well without any load issues.

Heres a quick rundown on whats actually changed in my project moving it from oracle to mysql.

1. The project was moved from Delphi 5 to Delphi 7.

2. Direct Oracle Access Components were replaced by dbexpress components.

3. The method of setting query variables was changed as follows:

- Oracle: Query.SetVariable('VariableName',VariableValue);
- dbExpres: Query.ParamByName('VariableName').Value:=VarName;

4. four queries which used sub-queries were reworked into two separate queries to work around MySQLs limitations regarding subqueries.

5. Additional error checking has been added in an effort to localize the problem. but the problem existed before these changes were made.

Thanks about it... and under Oracle DOA its rock solid stable, and under dbexpress it starts giving access violations at about 3-4 users online.

Any Ideas?

Thanks,

Dan Ridenhour



Quote:

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com





Back to top
Dan Ridenhour
Guest





PostPosted: Fri Sep 05, 2003 5:37 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote


"Shiv Kumar" <shivk (AT) erols (DOT) com> wrote:
Quote:
Dan,

Do your tests include "selects" only or do you also do
insert/update/deletes?

My tests involve a combination of selects, inserts, and updates.

Quote:

If you're doing the latter as well, then do you use SQL statements to do
these or some dataset's post method. Knowing that this is legacy code,
you're probably do that latter in this case as well.

Uunder oracle i was using Post methods, under dbexpress i use TSQLQueries to execute deletes, TSQLDatasets to retrieve datasets that I dont need to modify, and TSimpleDatasets when modifications are necessary. I use the TSimpleDataset.ApplyUpdates(-1) to post the changes to the DB.

Please note that the problems are occuring on actions which dont post any changes as well as those that do. Also, i found a problem with modifying more than one record in a dataset producing an 'statements out of sync. cant use that statement here' error when modifying multiple records in a dataset, so in those cases I do them as a series of TQuery's to make the changes directly.


Quote:

If so, you really need to move to using SQL statements for
select/insert/update/delete. This is probably where you'll get the most
gains.

By gains do you mean performance? Performance is fine, its the stability im having problems with. But I have been moving that direction, seems to be the best way to go with MySQL but the bulk of db updates still take place via an ApplyUpdates method of a TSimpleDataset.

Quote:

Are you able to do your stress testing such that it involves only selects?

Ill try this out this afternoon... although ill likely have to automate something in order to get enough stress on it to spawn extra threads.


Quote:

--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 05, 2003 11:01 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote

Are you able to debug your app using IIS?

You might want to build (from scratch) an smaller app that uses dbExpress
and MySQL to be able to reproduce this error.

Quote:
Its an NT4, 500mhz PC. 256mb RAM, 20gb disk. Nothing special.. just a
workstation reutilized as a server for testing. I run the oracle client on

this box as well without any load issues.
Quote:


So you don't even have multiple CPU I take it?

Have you removed the DOA specific units from your app?

Quote:
Thanks about it... and under Oracle DOA its rock solid stable, and under
dbexpress it starts giving access violations at about 3-4 users online.

Any Ideas?

Again, I'm not convinced this is a dbExpress issue. This issue is only now
cropped up due to speedier performance (I believe). Your access violation is
a clue here. You are referencing an object that has not been initialized.

By building a test harness that closely simulates your case (dbExpress and
MySQL), it might be easier to arrive at the issue.

The other option is using dbExpress to connect to Oracle and see if the
problem persists.
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 05, 2003 11:06 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote

As per my other post... If I were you, I'd build a simpler smaller
application that initially uses only selects. If you can't reproduce the
error you start adding in some update queries and so on.

Take a look at the Web Stress tool from Microsoft. Search for it on MSDN.

Quote:

By gains do you mean performance? Performance is fine, its the stability
im having problems with. But I have been moving that direction, seems to be

the best way to go with MySQL but the bulk of db updates still take place
via an ApplyUpdates method of a TSimpleDataset.

Not only performance but a sturdier system as well.
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Dan Ridenhour
Guest





PostPosted: Fri Sep 05, 2003 11:34 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote


"Shiv Kumar" <shivk (AT) erols (DOT) com> wrote:
Quote:
Are you able to debug your app using IIS?

You might want to build (from scratch) an smaller app that uses dbExpress
and MySQL to be able to reproduce this error.

Its an NT4, 500mhz PC. 256mb RAM, 20gb disk. Nothing special.. just a
workstation reutilized as a server for testing. I run the oracle client on
this box as well without any load issues.


So you don't even have multiple CPU I take it?

Nope its just a 500mhz NT box. nothing special.

Quote:

Have you removed the DOA specific units from your app?

All DOA objects have been removed, and the DOA units have been removed from my uses clauses. The app went from 1.1mb under doa, down to 815k with dbexpress.

Quote:

Thanks about it... and under Oracle DOA its rock solid stable, and under
dbexpress it starts giving access violations at about 3-4 users online.

Any Ideas?

Again, I'm not convinced this is a dbExpress issue. This issue is only now
cropped up due to speedier performance (I believe). Your access violation is
a clue here. You are referencing an object that has not been initialized.

Im not sure what the issue is either, im just looking at everything that changed. I have found that it doesnt seem to be directly tied to load. I sat on multiple machines hitting refresh and got 45 threads spawned without any issues... then clicked a few links by myself and got the same problem, and the last real user load test I started, people got errors within their first few clicks. It seems intermittent coming and going.

As for referencing an object that has not been initialized, Its happening outside of my code... since at this point every line of code I have is in a Try/Except block trying to figure out where the errors are occuring. Also the errors seem to occur before the WebModules 'BeforeDispatch' method is called... which leaves me at a loss for what is causing it.


Quote:

By building a test harness that closely simulates your case (dbExpress and
MySQL), it might be easier to arrive at the issue.

Thats where Im at now... starting from scratch with a D7 project that opens a few tables via dbexpress, builds a page based upon a disk based template, and displays it. Then I can pound on that to see if it dies.

Quote:

The other option is using dbExpress to connect to Oracle and see if the
problem persists.

That would be a nice idea, id love to do that, but the Oracle dbexpress drivers only come in the enterprise product... and I have professional... we carried a enterprise or C/S license of delphi thru D5, but went professional this time due to cost concerns.

I also cannot debug the app thru IIS since the IIS server is offsite... I connect to it via PCAnywhere over our T1 to install updates.

Thanks alot for sticking with me on this one, its funny i dont get stuck like this very often... actually its been a couple years since ive been this stuck.


Quote:
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com





Back to top
Dan Ridenhour
Guest





PostPosted: Fri Sep 05, 2003 11:45 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote


"Shiv Kumar" <shivk (AT) erols (DOT) com> wrote:
Quote:
As per my other post... If I were you, I'd build a simpler smaller
application that initially uses only selects. If you can't reproduce the
error you start adding in some update queries and so on.

Thats what Im starting now, although I already isolated a portion of my current application and repeatedly tested it... this section only used selects using TSQLQuery and TSQLDataset components... and it exhibited the same problems... basically even pages that only reference one DB and display the query results as a list in html still have the problem.

Btw, on an unrelated note I stressed it to 50+ threads and eventually started getting Invalid Username/Password errors like you mentioned in your post about connections hanging around for 240 seconds.

Also, this probably isnt related but after my app gets the AccessViolation error it will exhibit the 'click takes you to previous item clicked' thing... but after a couple mins (240 secs sounds about right) it rights itself and starts behaving properly again.


Quote:

Take a look at the Web Stress tool from Microsoft. Search for it on MSDN.

Ah to be well funded, I remember those days... I dont have a subscription to MSDN. I searched their website for web stress tools but only got FAQ articles about what you get when you subscribe.

Quote:


By gains do you mean performance? Performance is fine, its the stability
im having problems with. But I have been moving that direction, seems to be
the best way to go with MySQL but the bulk of db updates still take place
via an ApplyUpdates method of a TSimpleDataset.

Not only performance but a sturdier system as well.

Yea, Ive found in most things that the closer you get to the DB the better off your are.

Quote:
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com





Back to top
Shiv Kumar
Guest





PostPosted: Fri Sep 05, 2003 11:51 pm    Post subject: Re: Action taking you to previous action requested by user a Reply with quote


Quote:
Nope its just a 500mhz NT box. nothing special.

So it's *most probably* not a multi-threaded issue either.

Quote:
got 45 threads spawned without any issues

How do you get this number?

Quote:
That would be a nice idea, id love to do that, but the Oracle dbexpress
drivers only come in the enterprise product... and I have professional... we

carried a enterprise or C/S license of delphi thru D5, but went professional
this time due to cost concerns.
Quote:


Use Core Labs' dbExpress drivers for ORacle. Their trial version has some
limitations unfortunately (I think it's 6 fields per query).

Quote:
Thanks alot for sticking with me on this one, its funny i dont get stuck
like this very often... actually its been a couple years since ive been this

stuck.

No problem :)

What would it take for me to:

1. run this application on my server here?
2. Run this app in debug mode in my work station/server?

I don't have any third party stuff installed in my IDE

If you don't mind and I don't have to go through hoops to do this I'd be
willing to do the above.
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com




Back to top
Dan Ridenhour
Guest





PostPosted: Sat Sep 06, 2003 12:11 am    Post subject: Re: Action taking you to previous action requested by user a Reply with quote


"Shiv Kumar" <shivk (AT) erols (DOT) com> wrote:
Quote:

Nope its just a 500mhz NT box. nothing special.

So it's *most probably* not a multi-threaded issue either.

got 45 threads spawned without any issues

How do you get this number?

In the OnCreate event of the WebModule I check Application.ActiveCount and if its greater than the current value I have for max connections then I update my max connections global var in a critical section. This lets me see how many connections I have reached as a max. Ive also tried disabling this to solve the problem, but it didnt help.

Quote:
Use Core Labs' dbExpress drivers for ORacle. Their trial version has some
limitations unfortunately (I think it's 6 fields per query).

Thanks, ill try this out... although ill have to write a custom app for it, since many of my queries are bigger than that.
Quote:

What would it take for me to:

1. run this application on my server here?
2. Run this app in debug mode in my work station/server?

I don't have any third party stuff installed in my IDE

If you don't mind and I don't have to go through hoops to do this I'd be
willing to do the above.

Id love another set of eyes on it, but i doubt it would happen from a business perspective (its a system others have tried to immitate and failed before, so they are tight on who sees the code). Perhaps If i get a test app running that exhibits the problem i could distribute that. Im not much for 3rd party tools, they have a habit of going under (turbopower will be missed) the only 3rd party tools im using in my current project is the freeware MDWeb session management components. The last remaining 3rd party lib was Direct Oracle Access. ;-)



Quote:
--
Shiv R. Kumar
The Delphi Apostle
http://www.matlus.com





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.