Very strange debugging problem

I have a windows console program that interfaces with a 
library that interfaces with a hardware device. I run the 
same unmodified program with the same input and get 
different results on different trials. My program is the 
same, the test data is the same, yet different runs produce 
different results.

There are only two sorts of things that I can think of that 
could cause this:
(1) The state of the hardware device changes between runs.
(2) Some really weird memory error that causes my program to 
run correctly 75% of this time and fail other times.

Does anyone have any ideas on how I can narrow this down 
better?


0
NoSpam8358 (375)
9/1/2007 3:45:21 AM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
675 Views

Similar Articles

[PageSpeed] 8

"Peter Olcott" <NoSpam@SeeScreen.com> ha scritto nel messaggio 
news:gf5Ci.86140$Mu5.21970@newsfe15.phx...

> There are only two sorts of things that I can think of that could cause 
> this:
> (1) The state of the hardware device changes between runs.

I don't know about hardare...

> (2) Some really weird memory error that causes my program to run correctly 
> 75% of this time and fail other times.

Check that the physical memory cards are OK, with a memory checker tool.
And check your source code for memory leaks and correct memory management.
Try to use robust C++ container classes like std::vector, std::string, and 
not raw C arrays or char * strings in your code.

Moreover, Joe has an interesting article about memory management and memory 
corruption and techniques to avoid that in his web-site www.flounder.it ; 
you might read it.

G



0
9/1/2007 9:10:45 AM
"Giovanni Dicanio" <giovanni.dicanio@invalid.it> ha scritto nel messaggio 
news:O$ZjMgH7HHA.4584@TK2MSFTNGP03.phx.gbl...

> Moreover, Joe has an interesting article about memory management and 
> memory corruption and techniques to avoid that in his web-site 
> www.flounder.it ;

I'm sorry for the typo: it's www.flounder.com (of course)

G


0
9/1/2007 9:14:45 AM
"Peter Olcott" <NoSpam@SeeScreen.com> wrote in message 
news:gf5Ci.86140$Mu5.21970@newsfe15.phx...
>I have a windows console program that interfaces with a library that 
>interfaces with a hardware device. I run the same unmodified program with 
>the same input and get different results on different trials. My program is 
>the same, the test data is the same, yet different runs produce different 
>results.
>
> There are only two sorts of things that I can think of that could cause 
> this:
> (1) The state of the hardware device changes between runs.
> (2) Some really weird memory error that causes my program to run correctly 
> 75% of this time and fail other times.
>
> Does anyone have any ideas on how I can narrow this down better?

Other possible sources of inconsistent behavior are improperly synchronized 
multithreading and coincidences between the timing of hardware and software 
actions.  Maybe floating point rounding should be included, if your 
"inconsistent results" are numeric.  To hopefully narrow it down consider 
adding numerous TRACE statements (or a logging file) so you can look through 
the flow of results to see where differences appear.


0
Scott
9/1/2007 1:18:22 PM
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in 
message news:uv2VTqJ7HHA.4612@TK2MSFTNGP03.phx.gbl...
> "Peter Olcott" <NoSpam@SeeScreen.com> wrote in message 
> news:gf5Ci.86140$Mu5.21970@newsfe15.phx...
>>I have a windows console program that interfaces with a 
>>library that interfaces with a hardware device. I run the 
>>same unmodified program with the same input and get 
>>different results on different trials. My program is the 
>>same, the test data is the same, yet different runs 
>>produce different results.
>>
>> There are only two sorts of things that I can think of 
>> that could cause this:
>> (1) The state of the hardware device changes between 
>> runs.
>> (2) Some really weird memory error that causes my program 
>> to run correctly 75% of this time and fail other times.
>>
>> Does anyone have any ideas on how I can narrow this down 
>> better?
>
> Other possible sources of inconsistent behavior are 
> improperly synchronized multithreading and coincidences 
> between the timing of hardware and software actions. 
> Maybe floating point rounding should be included, if your 
> "inconsistent results" are numeric.  To hopefully narrow 
> it down consider adding numerous TRACE statements (or a 
> logging file) so you can look through the flow of results 
> to see where differences appear.
>
>
The program is a regression testing tool that tests the 
hardware interface libraries.
Sometimes when I run the tool it seems to test different 
sequences of operations. It provide the wrong data to the 
tests. I already have two different types of logging files.
Three out of four times it provides the correct data to the 
correct tests. One out of four times it provide incorrect 
data to the tests. This occurs without changing the data or 
the program. I store the list of data in a set of 
std::vectors of std::string. 


0
NoSpam8358 (375)
9/1/2007 1:32:10 PM
You may have an uninitialized variable, in which you check two bits for a 
certain value.

"Peter Olcott" <NoSpam@SeeScreen.com> wrote in message 
news:nRdCi.156656$zz2.93043@newsfe12.phx...
>
> "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message 
> news:uv2VTqJ7HHA.4612@TK2MSFTNGP03.phx.gbl...
>> "Peter Olcott" <NoSpam@SeeScreen.com> wrote in message 
>> news:gf5Ci.86140$Mu5.21970@newsfe15.phx...
>>>I have a windows console program that interfaces with a library that 
>>>interfaces with a hardware device. I run the same unmodified program with 
>>>the same input and get different results on different trials. My program 
>>>is the same, the test data is the same, yet different runs produce 
>>>different results.
>>>
>>> There are only two sorts of things that I can think of that could cause 
>>> this:
>>> (1) The state of the hardware device changes between runs.
>>> (2) Some really weird memory error that causes my program to run 
>>> correctly 75% of this time and fail other times.
>>>
>>> Does anyone have any ideas on how I can narrow this down better?
>>
>> Other possible sources of inconsistent behavior are improperly 
>> synchronized multithreading and coincidences between the timing of 
>> hardware and software actions. Maybe floating point rounding should be 
>> included, if your "inconsistent results" are numeric.  To hopefully 
>> narrow it down consider adding numerous TRACE statements (or a logging 
>> file) so you can look through the flow of results to see where 
>> differences appear.
>>
>>
> The program is a regression testing tool that tests the hardware interface 
> libraries.
> Sometimes when I run the tool it seems to test different sequences of 
> operations. It provide the wrong data to the tests. I already have two 
> different types of logging files.
> Three out of four times it provides the correct data to the correct tests. 
> One out of four times it provide incorrect data to the tests. This occurs 
> without changing the data or the program. I store the list of data in a 
> set of std::vectors of std::string.
> 


0
alegr (1131)
9/1/2007 2:22:14 PM
Yep, that sounds about right.  

In the absence of anything useful to help diagnose the problem, it is hard to guess where
the problem might be.
					joe

On Fri, 31 Aug 2007 22:45:21 -0500, "Peter Olcott" <NoSpam@SeeScreen.com> wrote:

>I have a windows console program that interfaces with a 
>library that interfaces with a hardware device. I run the 
>same unmodified program with the same input and get 
>different results on different trials. My program is the 
>same, the test data is the same, yet different runs produce 
>different results.
>
>There are only two sorts of things that I can think of that 
>could cause this:
>(1) The state of the hardware device changes between runs.
>(2) Some really weird memory error that causes my program to 
>run correctly 75% of this time and fail other times.
>
>Does anyone have any ideas on how I can narrow this down 
>better?
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/5/2007 2:04:39 PM
All you keep saying is "my program doesn't work, what's wrong?"  The answer is: you might
have a bug.  But since you are not telling us ANYTHING about the nature of the program,
there's absolutely no way to answer the question.
					joe

On Sat, 1 Sep 2007 08:32:10 -0500, "Peter Olcott" <NoSpam@SeeScreen.com> wrote:

>
>"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in 
>message news:uv2VTqJ7HHA.4612@TK2MSFTNGP03.phx.gbl...
>> "Peter Olcott" <NoSpam@SeeScreen.com> wrote in message 
>> news:gf5Ci.86140$Mu5.21970@newsfe15.phx...
>>>I have a windows console program that interfaces with a 
>>>library that interfaces with a hardware device. I run the 
>>>same unmodified program with the same input and get 
>>>different results on different trials. My program is the 
>>>same, the test data is the same, yet different runs 
>>>produce different results.
>>>
>>> There are only two sorts of things that I can think of 
>>> that could cause this:
>>> (1) The state of the hardware device changes between 
>>> runs.
>>> (2) Some really weird memory error that causes my program 
>>> to run correctly 75% of this time and fail other times.
>>>
>>> Does anyone have any ideas on how I can narrow this down 
>>> better?
>>
>> Other possible sources of inconsistent behavior are 
>> improperly synchronized multithreading and coincidences 
>> between the timing of hardware and software actions. 
>> Maybe floating point rounding should be included, if your 
>> "inconsistent results" are numeric.  To hopefully narrow 
>> it down consider adding numerous TRACE statements (or a 
>> logging file) so you can look through the flow of results 
>> to see where differences appear.
>>
>>
>The program is a regression testing tool that tests the 
>hardware interface libraries.
>Sometimes when I run the tool it seems to test different 
>sequences of operations. It provide the wrong data to the 
>tests. I already have two different types of logging files.
>Three out of four times it provides the correct data to the 
>correct tests. One out of four times it provide incorrect 
>data to the tests. This occurs without changing the data or 
>the program. I store the list of data in a set of 
>std::vectors of std::string. 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/5/2007 2:06:52 PM
Reply:

Similar Artilces:

MFC .exe gets access violation exception in release version but not debug
Hello, thanks for trying to help. I have an MFC .exe that gets an access violation (C0000005) exception in the release version but not the debug version. So I don't know what line of code causes it. But why should they act differently in this way at all? The exception occurs when a tab on a property sheet is being clicked. The only output in the debug screen when the tab is being clicked is "Warning: skipping non-radio button in group." Would that cause it? Does tab order determine groups along with the tab stop property? What are reasons why MFC code would get an access ...

Strange Output
Hello, everybody !!! Why this fragment of code shows : ac cout<<"a\??/??/bc"; Thanks All !!! "Alex Dmitriev" <firejump@mail.ru> wrote in message news:ecTgPp8pEHA.3800@TK2MSFTNGP14.phx.gbl... > Hello, everybody !!! > Why this fragment of code shows : ac > > cout<<"a\??/??/bc"; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vccelng4/html/elconTrigraphs.asp '??/' is a '\' so you end up with "a\\\bc" http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vccelng4/html/elc...

Excel Object showing strange behavior
Hello, I have a sheet that I created that contains an Excel object (small spreadsheet) that when double clicked, will open up and allow it to be populated. After they populate it, and close it,...the data is automatically reflected in the object on the original sheet. This is shared with everyone and it's working great. BUT.....(always the but) Why have a few people sent the form back to me saying that when they double click the object it opens up a "Format Object" dialogue box rather than the editable sheet that it was supposed to do? They sent it back to me and sure enough...

Problems with sharing a workbook
We've got a weekly accuracy check spreadsheet that's on another drive and accessible to me and another co-worker. Normally, we work on it at different times of the day, but this week we decided to make it accessible to both of us for simultaneous editing. The data was first filtered to hide duplicates, then sorted by Employee ID and Date. I then went to Tools>Share Workbook, checked the box for sharing, and saved the workbook to our "G" drive. Then, the trial run: we both accessed it, I had him color-fill the last row and save. I then saved it on my computer. ...

hyperlink problem
OS is Windows XP Home. I recently switched from AOL to Comcast cable and am using Outlook Express as my e-mail client. When I get an email with a hyperlink, I cannot click on that hyperlink and go directly to the website. I can do nothing but write it down on a piece of paper and go into explorer and type it and go that way. I cannot cut and paste - it won't let me! I have reloaded IE6 with the SP1 updates and am getting the same problem. Any suggestions on what else I can try? Thanks, Sam You Cannot Open New Internet Explorer Window or Nothing Happens After You Click a Link: h...

Stock quote problem.
Money 2006 Canadian edition. This morning my Canadian stock and exchange traded fund quotes are out by a factor of 1000. Mutual funds and American stocks seem to be correct. Anyone know anything about this? In microsoft.public.money, Wally wrote: >Money 2006 Canadian edition. This morning my Canadian stock and exchange >traded fund quotes are out by a factor of 1000. Mutual funds and American >stocks seem to be correct. Anyone know anything about this? I saw several anomalous high prices when I updated prices earlier. The next time I updated prices, it was down to only 2....

Exchange Permissions--Strange One
Hi by default, domain admins (and ent. admins) are denied "receive as" and "send as" permissions to the mailbox store. additionally, by default, on the exchange advanced tab under the mailbox rights button, domain admins are DENIED Full Mailbox Access. However, if you look at the security tab for each user object, by default domain admins are allowed "send as" and "receive as" permissions. now i know that the "receive as" right is ignored on the ad user object, but i ran a small test. i logged on as a domain admin, opened up the domain admin...

Mailbox Manager Policy Problems
I have an Exchange 2000 server with approx 95 users. My organziation recently put an email retention policy into effect and we are using the mailbox manager to delete old mail after 120 days. The problem is that some mailboxes aren't getting touched at all, some are working ok, and others are having one or two folders omitted. We are deleting messages from Sent Items, Inbox, Deleted Items, System Cleanup Folders, and have also checked the All Other Mail Folders. Size is set to any and age is 120 days. Any help will be rewarded with monkeys in clown suits. Thanks in advance... mkfarr...

Interesting Rule Problem and "on other computer"
I pulled my old .pst into a clean installation of Outlook 2003. I then saw that my rules were there, and downloaded my mail. No where to be found. I saw them come in (over 1000 mails!) - but they were not in the inbox, not anywhere. I even did a search for emails that were newer than yesterday, and nothing popped up. Then, later, I realized that the rules were set to something like "other computer" or something like that. That designation was removed when I went in and edited each and every rule and made sure that all items were pointing to the right places. The strange thing was...

User Breakpoint problem
I'm using VC++ 6.0. I get a message similar to this one: "User Breakpoint called from code at: 0x77f2706f" I found a description of this problem in the MS Knowledge Base (article 148455), it says that it is a bug in MS VC++ and it has a resolution for it. It tells me to use the following code: CSharedFile file; // Do stuff to fill in the CSharedFile HGLOBAL hGlob = file.Detach(); #if _MFC_VER <= 0x0600 ::GlobalUnlock(hGlob); #endif But this is done with MFCs, and I am NOT using MFCs and I have never even heard of the CSharedFile class. Can anyone t...

Excel Problem
Last night Excel started messing up on my computer. Dell Computer about 6 years old. Windows XP Pro, MS Office 2002. Open a spreadsheet, Excel opens to a blank spreadsheet and then says it has encountered an error and shuts down. Error appears to be something about a kernel 32.dll (not sure). Tried detect and repair, safe mode, nothing works. Does it from a file open, shortcut or program launch. Need some advice. Google is your friend http://www.google.com/search?source=ig&hl=en&rlz=&q=kernel32.dll&aq=3&aqi=g10&aql=&oq=kernel&gs_rfai= -- Don ...

Problem with sum across worksheets
Hi, I have several applications where I keep monthly data on tabbed worksheets, labled Jan07, Feb07, Mar07... I also add a worksheet I usually call RangeEnd that acts to stop sums for ranges. It has been my practice to make a year end worksheet that would have the same shape data structure and place in each cell the formula "=sum(Jan07:RangeEnd!A1)" and copy it into all the appropriate cells for which I want summed data. This seems to work just fine so long as the sells I am summing are not themselves sums. For example, if cell C1 holds a value, say 10. The C1 cell in th...

Strange Email failure error
Can anyone help? Using Outlook 2002 and POP3 mail. I've always been able to send emails to my wife's work email address until this week, when I get this very strange failure notice. "Connected to 213.2.49.230 but greeting failed. Remote host said: 421 reppsrv01.repp.co.uk is not accepting new connections. Please try later I'm not going to try again; this message has been in the queue too long." Does anyone know what the hell this means? thanks -- Google is your Friend Email address deliberately false to avoid spam: gordonATgbpcomputingDOTcoDOTuk www.gbpcomputin...

Pivot Table External Data % Problem
Hi All, I have the following scenario: This is happening in both Excel 2003 & Excel 2007 using XP. I am accessing an external data source though ODBC. There is one table with Account Number, Date, Month, Amount. There is another table with Account Number, Account Name. I join the two tables using MS Query during the Pivot Table Wizard steps. I then create the Pivot Table with Account # & Account Name as Row Labels, Month as Column Labels, and Amount as the Data. Everything works fine, the Amounts for each month are summed and show up under the correct Month for each Account, for e...

Exmerge Problems
I have migrated all mailboxes from an Exchange 2000 Server to Exchange 2003. I have restored an IS to a Recovery Storage Group. I am trying to use the exmerge tool to pull out one user's information only. I continue to fail on the Exmerge with the "Error opening message store (MSEMS). Verify that the Microsoft Exchange Information Store service is running and that you have the correct permissions to log on. (0x8004011d)" error. I have verified that my account is not denied in any form or fasion, I have permissions everywhere, and the IS is running. In fact, I am able to co...

Money 2002 backup restore problem
I had a corrupt system file (or something) that required me to reformat my hard drive. I always backed up my Money file to a floppy disk on a routine basis. When I tried to restore the file I received an error that the file "was corrupt or not a Money backup file." I'm pretty certain the file is not corrupt and this is a problem with the restore process. Anyone have a similar problem? (Yes, I've read all the procedures on how to do it.) TIA, Dave Many people who get themselves in this situation installed a different version of Money than the one they were actually u...

Very Strange
Hi I have a Word 2007 document. In this I am using 3 different heading styles. I want to use the feature 'Select Text with Similar Formatting' but it is not working. I have 5 headings that are all Title Case, size 10, Times New Roman, Left aligned and Bold there is exactly the same formatting applied to all 5 headings - I even checked the paragraph spacing - all headings are 0pt before and 12pt after. I checked show and hide - everything I repeat everything is the same - can you tell me why oh why will this feature only select 3 of my headings and not the 5???? ...

Printing Problems in Entourage
I have no problem printing a monthly calendar, but if I print a weekly format, the program crashes every time. Any one else having that problem? Any suggested solutions? This is a known issue. To work around it, Try removing multi-day events that cross the weekly boundary. On 9/29/05 5:20 PM, in article 1128032452.981239.31830@o13g2000cwo.googlegroups.com, "Tony" <tonystinson@bellsouth.net> wrote: > I have no problem printing a monthly calendar, but if I print a weekly > format, the program crashes every time. Any one else having that > problem? > > Any su...

Problem using a report from Access2003 to Access2007
I am trying to use a database created with Access 2003 in Access 2007 but have come up with a problem. The database contains a report which produces invoices for sales between two dates. When the report is run the user is asked to input sale date From and To (this is set up in the Invoice Query), Invoice Date and Invoice Start Number - these two are set up as text boxes on the report. Invoice Date conrol source has [Enter Invoice Date] and Invoice Start Number has [Page]+[Invoice Start Number]-1. This works fine in Access 2003 and the invoices come out correctly but in 2007 invoice ...

Serialization Problem
Hi, I am trying to use the following code to make xml serialization to a file. The following error is being given: "An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error generating the XML document." The problem should be due to inheritance. Can someone help me solve the problem out. Thanks in Advance ICommunicationTuple ict = new MessageQueueCommunication("test"); XmlSerializer ser = new XmlSerializer(typeof(ICommunicationTuple)); StreamWriter writer = new StreamWriter("c...

Problem: new calendar entries land on wrong date
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange When making a new calendar entry, it will not land on the date I select, but rather on: March 20, 2020!!!! <br><br>The only way in which I can make a calendar entry is to make it in iCal, and then let iCal synch with Entourage calendar. <br><br>Likewise, the Entourage calendar, when printing, will only show/print imported holidays, not the actual entries as displayed. <br><br>What's wrong? <br> I have re-installed Office from scratch - no imp...

signature problems in 2003
I have a huge problem and have no clue how to fix. I have multiple e-mail accounts in outlook 2003 setup. I also have created a different signature for each of these accounts. when I go to write a 'new' e-mail, my default account shows up, and when I change to a different account, my signature stays the same as my default account's signature, it doens't change to the other e-mail account I'm trying to send from. Any thoughts or suggestions on how to fix this? The help in outlook 2003 absolutely reeks, in my opinion. It hasn't helped me one bit. I've had to so...

why this strange result with vlookup
hi i have this formula in a cell =VLOOKUP(A3,'LookUp Data'!A2:O740,2,FALSE) but any time i pick a code from my list items in column A it gives #NA but as soon as i change to a different code it gives the name. any help why My best guess would be a data type mismatch. Looking up text in a column of numbers. When you change the value the type gets converted and the result is returned. Hard to say though based on yoru description. The ohter thig to look for might be blank characters padded at the end of the input. -- HTH... Jim Thomlinson "Amin" wrot...

Simple calculated field problem
Hi, I am very new to Access and am trying to do something I think should be reasonably simple, but can't work out the syntax I need. My database is to track weight loss. I have only one table at the moment (this will grow but my problem only involves a single table), which is called 'Measurements'. The table has only 3 fields, 'Date', 'Weight' and 'Fat%'. I would like to be able to track weight loss from one day to the next, so am trying to make a query that shows, for each day, the values in the Weight and Fat% fields, and a calculated field tha...

Problem Resolving Email Addresses to Contacts in CRM via Outlook
When creating a new email and inserting the email address I am sending too which does map to a CRM contact in CRM 3.0. I get the following error. "The sender does not have an e-mail address in Microsoft CRM. Do you want to send the e-mail? If you click yes, the e-mail will be sent out, but no corresponding activity will be created in Microsoft CRM. What am I doing wrong here? I also noticed that Microsoft CRM contacts do show up when I click the "To:" however the contacts that I've added in CRM are not showing up? Thanks! This is due to your CRM user record not h...