gmichaud
October 5th, 1999, 07:00 PM
This is my third year working on this large project, and I must say it's one
of the strangest and hardest to fix bug that I ever encountered.
In a loop, i am querying a class module for a conditional and a mathematical expression, evaluating it using a math parser that I designed in VC++ using ATL, and then adding the resulting item to an array. This is a system that builds a price quote based on customer data and business rules.
From this point on in my program i get odd behaviour. The loop returns 2 or 3 times, but the problem happens the very first time.
The strange thing with the problem is that i am unable to trace it. While i highly suspect the ActiveX component i have absolutely no proof as running it in debug mode reveals no particular problem. If i try to step through my code, the problem completely goes aways, it runs perfect, and does so until i reset the program and run it again.
When the problem happens, the program either...
1. Enter what seems to be an infinite loop, freeze for 2-3 second, and then GPF (Visual Basic 6.0 SP3).
or
2. Corrupt my local variables by stripping the last character off some string, which then cause an error since i'm doing Left() and Mid() calls on strings that used to be longer.
The behaviour is predictible, that is, it will always happen at the same time (i'm not able to determine the specific call), and it's always the same result.
Removing, adding or changing code with equivalent code (i.e. a concatenation operation with left(), mid() and right() and an equivalent replace() operation) is what changes the problem. For instance, when i have the following piece of code:
PartNumberToAdd = Replace(PartNumberToAdd, "<" & varName & ">", CurrentCustomFence.Options(varName))
VB does an infinite loop somewhere (untraceable, if i add breakpoints or if i step there is no problem) and then GPF (prob #1).
If i change this line for:
PartNumberToAdd = Replace(PartNumberToAdd, "<" & varName & ">", CurrentCustomFence.Options(varName))
Which is equivalent, the content of PartNumberToAdd loose it's last character somewhere in the loop shortly after or before the first replace operation
This is very odd, and I've been stuck at this problem for the last two weeks!!! I really don't know what is the problem, and it is impossible to reproduce beside in my program. As I said, if i step through the code everything works perfectly (important: and does so until I reset the program completely). This _may_ mean that it is memory related and that it only happens in certain circumstances (i.e. large stack or something like this). I have been running very stable elsewhere in the program for the last 2 years, but this is highly problematic...
I would like to be able to have a simple piece of code that reproduce the problem, but as soon as i simplify my code it always goes away. I feel that this is not a problem with my syntax as i'm usually able to debug and correct my errors rapidly. I feel that my ActiveX math expression parser is the culprit, but i did a small piece of code that really stressed the componenent and i had no problems whatsoever with it.
If anyone would be willing to help me, i would gladly share more information or source code.
Best regards,
Gabriel Michaud
of the strangest and hardest to fix bug that I ever encountered.
In a loop, i am querying a class module for a conditional and a mathematical expression, evaluating it using a math parser that I designed in VC++ using ATL, and then adding the resulting item to an array. This is a system that builds a price quote based on customer data and business rules.
From this point on in my program i get odd behaviour. The loop returns 2 or 3 times, but the problem happens the very first time.
The strange thing with the problem is that i am unable to trace it. While i highly suspect the ActiveX component i have absolutely no proof as running it in debug mode reveals no particular problem. If i try to step through my code, the problem completely goes aways, it runs perfect, and does so until i reset the program and run it again.
When the problem happens, the program either...
1. Enter what seems to be an infinite loop, freeze for 2-3 second, and then GPF (Visual Basic 6.0 SP3).
or
2. Corrupt my local variables by stripping the last character off some string, which then cause an error since i'm doing Left() and Mid() calls on strings that used to be longer.
The behaviour is predictible, that is, it will always happen at the same time (i'm not able to determine the specific call), and it's always the same result.
Removing, adding or changing code with equivalent code (i.e. a concatenation operation with left(), mid() and right() and an equivalent replace() operation) is what changes the problem. For instance, when i have the following piece of code:
PartNumberToAdd = Replace(PartNumberToAdd, "<" & varName & ">", CurrentCustomFence.Options(varName))
VB does an infinite loop somewhere (untraceable, if i add breakpoints or if i step there is no problem) and then GPF (prob #1).
If i change this line for:
PartNumberToAdd = Replace(PartNumberToAdd, "<" & varName & ">", CurrentCustomFence.Options(varName))
Which is equivalent, the content of PartNumberToAdd loose it's last character somewhere in the loop shortly after or before the first replace operation
This is very odd, and I've been stuck at this problem for the last two weeks!!! I really don't know what is the problem, and it is impossible to reproduce beside in my program. As I said, if i step through the code everything works perfectly (important: and does so until I reset the program completely). This _may_ mean that it is memory related and that it only happens in certain circumstances (i.e. large stack or something like this). I have been running very stable elsewhere in the program for the last 2 years, but this is highly problematic...
I would like to be able to have a simple piece of code that reproduce the problem, but as soon as i simplify my code it always goes away. I feel that this is not a problem with my syntax as i'm usually able to debug and correct my errors rapidly. I feel that my ActiveX math expression parser is the culprit, but i did a small piece of code that really stressed the componenent and i had no problems whatsoever with it.
If anyone would be willing to help me, i would gladly share more information or source code.
Best regards,
Gabriel Michaud