adii28

Hello,
I have a win32 application built using vc++ 6.0. When I do the release build on the machine which I developed the application on which is running win XP Prof SP2, the release versions runs fine. But when I deploy the release version onto the actual box where it will run which is a windows 2000 box the application crashes.
I have extensivly used STL in my aplication (std:Tongue Tiedtring, vecotrs and map). But I do not use new to allocate memory which I know can cause issue on vc++ 6.0 release build.
Also I am linking to runtime libraries for OCCI.
Is the difference in OS causing issues here.
Any pointers or help will be appreciated

Thanks
Aditya



Re: Visual C++ General Application in release mode crahes on win2k

einaros

Unless you debug the problem, step through the piece of code it breaks in, paste some source and generally provide more information, it's pretty much impossible for anyone to do anything but speculate. Just about anything can be causing this issue, from memory errors, application errors, library differences, unfulfilled dependencies, missing files; you name it.





Re: Visual C++ General Application in release mode crahes on win2k

einaros

Also, please don't make duplicate posts on the different forums. One is more than enough.





Re: Visual C++ General Application in release mode crahes on win2k

adii28

Apologies for the multiple posts. I figured vc++ language would be an appropriate forum and forgot to delete the other post.

Ok here is some more information. The application is a standard dialog based win32 which connects to an oracle database using OCCI and uses log4cxx framework for creating logs. Going through the logs, I catch an unknown exception while I am populating vectors after getting result set from the database. The following code is where the last log entry happens,


Code Snippet

rs = stmt->executeQuery("An SQL SELECT STATEMENT goes here");

rowCount = 0;


LOG4CXX_DEBUG(logger, "2000] Adding empty entry to .");
snbNumbers.push_back("");
int row = 0;
int index;
bool results = false;
while ( rs->next() ) {
LOG4CXX_INFO(logger, "2000] New row fetched.");
results = true;
string id = rs->getString( 1 );
appIDs.push_back(id);
LOG4CXX_DEBUG(logger, "2000] Fetched id:" + id);
string imageFileName = rs->getString( 2 );
LOG4CXX_DEBUG(logger, "2000] Fetched file:" + imageFileName);
index = IndexOf(classes, rs->getString(3));
string imageClass = classes.at( index + 1 );
LOG4CXX_DEBUG(logger, "2000] Fetched class:" + imageClass);
index = IndexOf(formats, rs->getString(4));
string imageFormat = formats.at( index + 1 );
LOG4CXX_DEBUG(logger, "2000] Fetched format:" + imageFormat);
string pageCount = rs->getString( 5 );
if ( pageCount.empty() )
pageCount = "";
LOG4CXX_DEBUG(logger, "2000] Fetched page count:" + pageCount);
string snbNumber = rs->getString( 18 );
if ( snbNumber.empty() )
snbNumber = "";
if ( ! (Contains(snbNumbers, snbNumber)) )
snbNumbers.push_back(snbNumber);
LOG4CXX_DEBUG(logger, "2000] Fetched SNB Number" + snbNumber);
string county = rs->getString( 7 );
if ( !(county.empty()) ) {
county = IndexCounty(county);
} else
county = "";
LOG4CXX_DEBUG(logger, "2000] Fetched county" + county);
index = IndexOf(states, rs->getString(8));
string state = states.at( index + 1 );
LOG4CXX_DEBUG(logger, "2000] Fetched state:" + state);
string comments = rs->getString( 9 );
if ( comments.empty() )
comments = "";
LOG4CXX_DEBUG(logger, "2000] Fetched comments:" + comments);
LOG4CXX_INFO(logger, "2000] Adding fetched item to data grid");

rowDetails.push_back(imageFileName);
rowDetails.push_back(imageClass);
rowDetails.push_back(imageFormat);
rowDetails.push_back(pageCount);
rowDetails.push_back(county);
rowDetails.push_back(state);
rowDetails.push_back(snbNumber);
rowDetails.push_back(comments);
pageDetails.push_back(rowDetails);
row++;
rowDetails.clear();
details.push_back(rs->getString( 2 ) );
LOG4CXX_DEBUG(logger, "2000] Detail:" + rs->getString( 2 ));
details.push_back(rs->getString( 10 ) );
LOG4CXX_DEBUG(logger, "2000] Detail:" + rs->getString( 10 ));
details.push_back(rs->getString( 11 ) );
LOG4CXX_DEBUG(logger, "2000] Detail:" + rs->getString( 11 ));
string tmpScannedBy = rs->getString( 12 );
if ( tmpScannedBy.empty() )
tmpScannedBy = "";
details.push_back(tmpScannedBy);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpScannedBy);
string tmpScannedDate = rs->getString( 13 );
if ( tmpScannedDate.empty() )
tmpScannedDate = "";
details.push_back(tmpScannedDate);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpScannedDate);
string tmpShippedBy = rs->getString( 14 );
if ( tmpShippedBy.empty())
tmpShippedBy = "";
details.push_back(tmpShippedBy);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpShippedBy);
string tmpShippedDate = rs->getString( 15 );
if ( tmpShippedDate.empty() )
tmpShippedDate = "";
details.push_back(tmpShippedDate);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpShippedDate);
string tmpServiceProviderID = rs->getString( 16 );
string tmpServiceProvider = "";
if ( !tmpServiceProviderID.empty() )
tmpServiceProvider = serviceProviders.at( IndexOf(serviceProviders, tmpServiceProviderID ) + 1 );
details.push_back(tmpServiceProvider);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpServiceProvider);
string tmpWaybill = rs->getString( 17 );
if ( tmpWaybill.empty() )
tmpWaybill = "";
details.push_back(tmpWaybill);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpWaybill);
string tmpRejectedBy = rs->getString( 19 );
if ( tmpRejectedBy.empty())
tmpRejectedBy = "";
details.push_back(tmpRejectedBy);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpRejectedBy);
string tmpRejectedDate = rs->getString( 20 );
if ( tmpRejectedDate.empty())
tmpRejectedDate = "";
details.push_back(tmpRejectedDate);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpRejectedDate);
string tmpRejectedCount = rs->getString( 21 );
if ( tmpRejectedCount.empty() )
tmpRejectedCount = "";
details.push_back( tmpRejectedCount );
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpRejectedCount);
string tmpXMLData = rs->getString( 22 );
if ( tmpXMLData.empty() )
tmpXMLData = "";
details.push_back(tmpXMLData);
LOG4CXX_DEBUG(logger, "2000] Detail:" + tmpXMLData);
rowCount++;
}
if ( ! results ) {
LOG4CXX_INFO(logger, "2000] No records found in the DB");
}
stmt->closeResultSet(rs);
conn->terminateStatement(stmt);
env->terminateConnection(conn);
rowDetails.clear();
LOG4CXX_INFO(logger, "2000] Terminating DB statement");
}
catch (exception &excp) {
excpStr = excp.what();
LOG4CXX_ERROR(logger, "2100] Exception " + excpStr + ". This could be fatal");
}


Code Snippet

int Controller::IndexOf(const vector<string>& tmpVector, string srchString) {
for (int i = 0; i < tmpVector.size(); ++i) {
if (tmpVector[i] == srchString)
return i;
}
}

string Controller::IndexCounty(string county) {
map<string,string>::iterator it = mapCounty.begin(), stop = mapCounty.end();
for( ; it != stop; it ++ ) {
if (it->first == county)
return it->second;
else
continue;
}

}


Stepping through is not helping as the code runs on the xp box in debug and release mode.




Re: Visual C++ General Application in release mode crahes on win2k

einaros

I suggest you get a crash dump on the win2000 box and open that in your Visual Studio on the XP box. That will allow you to examine the stack at the point of the crash, in addition to memory if you do a full crash dump. To create a crash dump you can use a utility such as the one at http://einaros.blogspot.com/2006/09/easily-capturing-application-crash.html.





Re: Visual C++ General Application in release mode crahes on win2k

adii28

Will check the dump, thanks. Heres one more thing the debug build runs fine on win2000.





Re: Visual C++ General Application in release mode crahes on win2k

einaros

Yeah, that's a pretty common case. There are plenty threads on the forum going along the lines of "release build crashes, debug runs!" and vice versa. I'm sure you'll find them if you do a couple of searches, but I'd go with the crash dumps first.





Re: Visual C++ General Application in release mode crahes on win2k

adii28

This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(5d0.6f8): Access violation - code c0000005 (first/second chance not available)
eax=00000180 ebx=0019dd40 ecx=0012e758 edx=beb566c4 esi=0019dd18 edi=0019dd70
eip=77f94956 esp=0012e730 ebp=0012ea28 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00200246
*** ERROR: Symbol file could not be found. Defaulted to export symbols for NTDLL.DLL -
NTDLL!ZwGetContextThread+0xb:
77f94956 c20800 ret 8
0:000> .ecxr
eax=0012f720 ebx=0068f4c0 ecx=00000000 edx=00000000 esi=0261035a edi=00000005
eip=0042e8cf esp=0012f6f8 ebp=0012f730 iopl=0 nv up ei pl nz ac pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00210216
Unable to load image C:\_initial\release\In_Process.exe, Win32 error 2
*** WARNING: Unable to verify timestamp for In_Process.exe
In_Process!CDataGrid::Resize+0x10:
0042e8cf
0:000> dv
Unable to find processor type for C:\_initial\release\In_Process.exe, using default
this = 0x00000000
clientRect = struct tagRECT
rectParent = struct tagRECT

The program does not even make it to the part where this exception is happening, it crashes earlier.
I am suspecting it has got to do with the occi libs, as the program crashes while fetching data from tables and population the respective strings or vectors. Could be a heap issue dlls managing their own heap






Re: Visual C++ General Application in release mode crahes on win2k

adii28

Code Snippet

<avrf:message>Corrupted heap block.</avrf:message>
<avrf:parameter1>3681000 - Heap handle used in the call.</avrf:parameter1>
<avrf:parameter2>9692fd8 - Heap block involved in the operation.</avrf:parameter2>
<avrf:parameter3>21 - Size of the heap block.</avrf:parameter3>
<avrf:parameter4>82721000 - Reserved</avrf:parameter4>
- <avrf:stackTrace> <avrf:trace>vrfcore!VfCoreRedirectedStopMessage+81</av

Code Snippet

rf:trace> <avrf:trace>ntdll!RtlpNtMakeTemporaryKey+393d</avrf:trace> <avrf:trace>ntdll!RtlpNtMakeTemporaryKey+4a4b</avrf:trace> <avrf:trace>ntdll!RtlpNtMakeTemporaryKey+4c4e</avrf:trace> <avrf:trace>ntdll!RtlpNtMakeTemporaryKey+7cef</avrf:trace> <avrf:trace>ntdll!RtlInitializeSListHead+115c0</avrf:trace> <avrf:trace>ntdll!iswdigit+128</avrf:trace> <avrf:trace>vfbasics!AVrfpRtlFreeHeap+16b</avrf:trace> <avrf:trace>In_Process!free+66</avrf:trace> <avrf:trace>In_Process!operator delete+9</avrf:trace> <avrf:trace>In_Process!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy+6e</avrf:trace> <avrf:trace>In_Process!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >+11</avrf:trace> <avrf:trace>In_Process!Controller::InitialQuery+2336</avrf:trace> <avrf:trace>In_Process!Controller::Controller+5b3</avrf:trace> <avrf:trace>In_Process!MainDialog::DlgProc+9f</avrf:trace> <avrf:trace>USER32!GetDC+6d</avrf:trace> <avrf:trace>USER32!PrivateExtractIconExW+2b2</avrf:trace> <avrf:trace>USER32!PrivateExtractIconExW+fe</avrf:trace> <avrf:trace>USER32!RegisterUserApiHook+9b</avrf:trace> <avrf:trace>USER32!GetWindowTextLengthW+547</avrf:trace> <avrf:trace>USER32!CreateDialogIndirectParamAorW+33</avrf:trace> <avrf:trace>USER32!CreateDialogParamA+4a</avrf:trace> <avrf:trace>In_Process!MainDialog::CreateMain+4f</avrf:trace> <avrf:trace>In_Process!LoginController::Command+7fb</avrf:trace> <avrf:trace>In_Process!LoginDialog::LoginDialogProc+13b</avrf:trace> <avrf:trace>USER32!GetDC+6d</avrf:trace> <avrf:trace>USER32!PrivateExtractIconExW+2b2</avrf:trace> <avrf:trace>USER32!PrivateExtractIconExW+fe</avrf:trace> <avrf:trace>USER32!GetWindowRgn+12d</avrf:trace> <avrf:trace>USER32!SendMessageW+49</avrf:trace> <avrf:trace>USER32!AppendMenuA+1d0</avrf:trace> <avrf:trace>USER32!IsDialogMessage+4a</avrf:trace> <avrf:trace>In_Process!WinMain+24b</avrf:trace> <avrf:trace>In_Process!WinMainCRTStartup+ce</avrf:trace> <avrf:trace>kernel32!RegisterWaitForInputIdle+49</avrf:trace> </avrf:stackTrace>






Re: Visual C++ General Application in release mode crahes on win2k

adii28

Code Snippet

while ( rs->next() ) {
if ( first ) {
LOG4CXX_DEBUG(logger, "2000] " + tmpStatement);
tmpStatement = tmpStatement + " AND (cd = '" + rs->getString( 1 ) + "'";
LOG4CXX_DEBUG(logger, "2000] " + tmpStatement);
}
else {
tmpStatement = tmpStatement + " OR cd = '" + rs->getString( 1 ) + "'";
LOG4CXX_DEBUG(logger, "2000] " + tmpStatement);
}
first = false;
}



Now i think the problem is tmpStatement is declared and initialized in the module, but in the above statement I think the app gets into occi's heap and as there is no tmpStatement there it crashes.
Now any ideas on how I can sove this