 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 7th, 2006, 10:21 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
simple arithmetic overflow vbscript
Hi, I have a windows 2003 server running ASP. Initially everything was fine. But recently it throws 'overflow' error when executing basic arithmetic.
The error is:
Microsoft VBScript runtime error '800a0006'
Overflow
I created a simple asp:
<%@ Language=VBScript%>
<%
option explicit
dim a,b,c,d
a = 1
b = 1
c = 1
d = a * b / c
response.write d
%>
The overflow error is at line (d = a * b / c).
And the wierd thing is that it happens randomly. sometimes it's fine, sometimes it throws 'overflow' error. When i restart IIS service, it ALWAYS working fine in the beginnig. After few hours later, 'overflow' error begins to surface. w3wp.exe is around 100mb.
But when i run the same code (in .vbs) on the server, looping for 1000 times, it doesnt give me the 'overflow' error. Also i created the same codes using vb.net, it doesnt give me the 'overflow' error.
Is this some kind of a virus? In the end I reformated the server and everything works great for few months till recently the same 'overflow' error appears.
Please2 help.
|
|

September 8th, 2006, 07:38 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
are ABC always defined as displayed above, or are they variables? Can C ever be 0?
"The one language all programmers understand is profanity."
|
|

September 9th, 2006, 10:21 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
The 0 thing was one of my thoughts.
>What are the values of a, b and c at the time of overflow?
>Are you not using cInt or cLng functions? (use then see if your error chnages to 'invalid use of cInt')
Wind is your friend
Matt
|
|

September 10th, 2006, 09:46 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the reply.
a,b,c is set to 1 and never change in the code. The code is as above. Unless c can suddenly change to 0...... I will output abcd then, and see what happen.
I did try using cInt and cDbl, but it also returns 'overflow' error.
Currently the servers seems to be working as i configure IIS to recycle worker processors every 10 hours, and i created 3 worker processor instead of 1.
Could it be asp engine problem? how can i diagnose/troubleshoot it? any recommendations what tools to use? Thanks
|
|

September 10th, 2006, 10:09 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;a,b,c is set to 1 and never change in the code
if it never changes why calculate? you lost me a bi there.
Which brigs me to:
;;;Unless c can suddenly change to 0
mmmmmm, now Im really confused. You cant out put a result if a division by 0 is present
;;; did try using cInt and cDbl,
I hav ehad your error before. My prblem was results that were outside the range of an allowed integer using cInt, cDble fixed it.
;;;how can i diagnose/troubleshoot it?
Strip you page back till error free, test n run, test n run, test n run - until you find your problem. mmmmm, a slow long winded process. It will tell you where your problem is sometime during this process. There is a heap of info on your error on the net, several causes, have you googled it?
BTW is is a stack overflow error or just an overfloe error? IME these are un common and are like a needle in the haystack. Sorry couldnt be much help...
Wind is your friend
Matt
|
|

September 10th, 2006, 11:39 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry for the confusion. The real codes is not like the above. The above is the simple test code to show that even 1*1/1 simple calculation can create strange 'overflow' error in 2 of my server 2003. The real code is to resize the image based on the inputed height or width.
Initially i thought it's because of cInt or cDble, so i convert everything (using cInt and cDble) in the codes, but it still gives me the 'overflow' error. After debugging the codes, i found out that it's definately not because of division of 0 or outside the range of datatype. Because with the same value of abc, sometimes got 'overflow' and sometimes are fine. So, I created the simple arithmetic page (which is 1*1/1), and it gives me 'overflow' error!???
The error:
Microsoft VBScript runtime error '800a0006'
Overflow
then the line that causes the error (which is on the 1*1/1)
Thanks.
|
|

September 11th, 2006, 04:19 AM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the servers now is going wild!!! keep on giving overflow error. funny thing is that the 'overflow' error occured when im doing a division. but it's not division by 0.
my test page is as follow:
<%
on error resume next
dim a,b,c,d
a = 1
b = 1
c = 1
d = cdbl(cdbl(cdbl(a) * cdbl(b)) / cdbl(c))
response.write a & " * " & b & " / " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 1
b = 1
c = 1
d = a + b + c
response.write a & " + " & b & " + " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 1
b = 1
c = 1
d = a * b + c
response.write a & " * " & b & " + " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 1
b = 1
c = 1
d = a + b / c
response.write a & " + " & b & " / " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 1
b = 1
c = 1
d = a * b / c
response.write a & " * " & b & " / " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 1
b = 1
c = 1
d = a / b * c
response.write a & " / " & b & " * " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 1
b = 1
c = 1
d = a + b - c
response.write a & " + " & b & " - " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 80
b = 144
c = 177
d = a * b / c
response.write a & " * " & b & " / " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 80
b = 144
c = 177
d = a + b / c
response.write a & " + " & b & " / " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 80
b = 144
c = 177
d = a + b * c
response.write a & " + " & b & " * " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
a = 80
b = 144
c = 177
d = a + b + c
response.write a & " + " & b & " + " & c
response.write " = " & d
response.write err.description & "<br>"
err.clear
%>
The 'overflow' occurs on ALL the lines that has the division. Please note that this happens quite randomly.
|
|

September 11th, 2006, 07:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Wish I could help. I have seen this only once, your issue isnt jumping out at me. I guess stripping it back doesnt tell you much if its only a random problem
Wind is your friend
Matt
|
|

September 11th, 2006, 07:36 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
This line here:
a = 80
b = 144
c = 177
d = a + b / c
What value are you expecting? Because I get 80.813559322033898305084745762712
"The one language all programmers understand is profanity."
|
|

September 13th, 2006, 01:21 AM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks mat for bothering into looking at this.
dparsons, you are right,
a = 80
b = 144
c = 177
d = a + b / c
should return 80.813559322033898305084745762712
However, on my 2 servers, sometimes it returns the correct answer, and sometimes gives me 'overflow' error. The 'overflow' error occurs randomly. My point is no matter what value i put, the division arithmetic will gives me random 'overflow' error, even 1+1/1!!!!
|
|
 |