Trying to find an infinite loop

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Hi guys,

I'm trying to track down an infinite loop in some SQL generator code. I found one potential candidate. Can you think of a value for strValue that would throw this into an infinite loop?

Thanks,
Chad
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Link

Each member function finds the first (lowest beginning position) subsequence in the controlled sequence, beginning on or after position pos, that matches the operand sequence specified by the remaining operands. If it succeeds, it returns the position where the matching subsequence begins. Otherwise, the function returns npos.
 

tkdkid

Senior member
Oct 13, 2000
956
0
0
What's the L in L'\'' for?

I don't really think that loop can be inifinite for any value of strValue, but stick a breakpoint in there and watch what happens.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Originally posted by: tkdkid
What's the L in L'\'' for?

I don't really think that loop can be inifinite for any value of strValue, but stick a breakpoint in there and watch what happens.

L denotes a wide-character.

The problem is that we are seeing an issue on a production system that is causing the CPU to spike to 100%. I have narrowed down the problem to this module, but I can't seem to find where the issue is occurring. We have not been able to duplicate the issue in another environment, and the problem occurs seemingly randomly (i.e. not at a certain time of day or under a certain load). I have a feeling its data-related, and that's why I'm trying to find suspect areas where "bad" data may be causing an infinite loop.

Thanks for your feedback, though.
 

tkdkid

Senior member
Oct 13, 2000
956
0
0
Does it break if the ' is the first character in the string?

I ask because the description of insert says it inserts before the position given, so it may be trying to insert a ' into memory that doesn't belong to the string.

If I had c++ installed I could be more help. I may try this at home later.
 

tkdkid

Senior member
Oct 13, 2000
956
0
0
You could put a loop counter in there, and if it exceeds 1000 or so, have it write out the original string to a log file.

Just another thought.