IBM Support

50 DB2 Nuggets #27 : Tech Tip - How to resolve a .NET application crash on Windows 64-bit platform?

Technical Blog Post


Abstract

50 DB2 Nuggets #27 : Tech Tip - How to resolve a .NET application crash on Windows 64-bit platform?

Body

Hello!

If you have a .NET application utilizing DB2 drivers on Windows 64-bit that is crashing in the following stack (in MS dumps), what would you do to fix the problem?

44  Id: 1350.b98 Suspend: 1 Teb: 000007ff`ffeb0000 Unfrozen 
Child-SP          RetAddr           : Args to Child 
                                      : Call Site 
00000000`0a31acc8 000007fe`fd3a10dc : 00000000`00000000 
00000000`07eb3eab 00000000`00000000 00000000`00000000 : 
ntdll!NtWaitForSingleObject+0xa 
00000000`0a31acd0 00000000`07d457bd : 00000000`00000000 
00000000`00000000 00000000`00000000 00000000`00000e40 : 
KERNELBASE!WaitForSingleObjectEx+0x9c 
00000000`0a31ad70 00000000`09aa13b8 : 00000000`00000000 
00000000`05588c60 00000000`00000000 00000000`09d71200 : 
db2app64!sqloAppWaitOnSync+0x4f 
00000000`0a31adc0 00000000`07d45d8b : 00000000`05588c60 
00000000`09d71200 00000000`00000000 00000000`00000000 : 
db2clio!SQLGetLength+0x2e366 
00000000`0a31ae40 00000000`73d537d7 : 00000000`05588c60 
00000000`00000000 00000000`00000000 00000000`00000000 : 
db2app64!sqloCreateAppThread+0x29b 
00000000`0a31f9e0 00000000`73d53894 : 00000000`73e095c0 
00000000`05588c60 00000000`00000000 00000000`00000000 : 
msvcr80!endthreadex+0x47 
00000000`0a31fa10 00000000`7665652d : 00000000`00000000 
00000000`00000000 00000000`00000000 00000000`00000000 : 
msvcr80!endthreadex+0x104 
00000000`0a31fa40 00000000`76d4c541 : 00000000`00000000 
00000000`00000000 00000000`00000000 00000000`00000000 : 
kernel32!BaseThreadInitThunk+0xd 
00000000`0a31fa70 00000000`00000000 : 00000000`00000000 
00000000`00000000 00000000`00000000 00000000`00000000 : 
ntdll!RtlUserThreadStart+0x21 

The reason for the crash is that the application is loading both ODBC and CLI DLL's at the same time, its unsupported, hence the application ran into a crash. The restriction is documented in our information center.

 

Please see the below document that contains this information:
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.cli.doc%2Fdoc%2Fc0000670.html 
 
Restriction :

Mixing ODBC and CLI features and function calls in an application is not supported on the Windows 64-bit operating system.

 

Resolution: 

Possible solutions:
- Use either CLI or ODBC driver but not both in the .NET application
- This restriction applies to a single process - as DLLs are loaded on a per-process basis. You can have different processes loading each separately but not one loading both. (The restriction relates to function pointers which are per-process.)

 

Following symptom might be seen in the Event Viewer coming from w3wp.exe process, which is a .NET IIS application process.

Log Name:      Application
Source:        Application Error
Date:          3/26/2014 3:21:20 PM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      (server name)
Description:
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2
Faulting module name: DB2CLIO.DLL, version: 9.7.500.703, time stamp: 0x500970a5
Exception code: 0xc0000005
Fault offset: 0x000000000003ab1f
Faulting process id: 0x25c
Faulting application start time: 0x01cf49288aff7252
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: D:\Program Files\IBM\IBM DATA SERVER DRIVER\BIN\DB2CLIO.DLL
Report Id: cf63034a-b51b-11e3-8a5a-005056b30442
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"&gt;
<System>
 <Provider Name="Application Error" />
 <EventID Qualifiers="0">1000</EventID>
 <Level>2</Level>
 <Task>100</Task>
 <Keywords>0x80000000000000</Keywords>
 <TimeCreated SystemTime="2014-03-26T19:21:20.000000000Z" />
 <EventRecordID>5539</EventRecordID>
 <Channel>Application</Channel>
 <Computer>JWPPPCAPP01.ec.checkfree.com</Computer>
 <Security />
</System>
<EventData>
 <Data>w3wp.exe</Data>
 <Data>7.5.7601.17514</Data>
 <Data>4ce7afa2</Data>
 <Data>DB2CLIO.DLL</Data>

 

To give a little more backgroung, DB2 has two libraries, a 'CLI' library and an 'ODBC' library. These libraries actually have similar function names.   CLI library called db2app64.dll, ODBC library called db2clio.dll. CLI library might be calling a DB2 function that  should also reside in db2app64.dll but instead Windows ends up finding that function in a different library called db2clio.dll.  Since that was the wrong DLL it trapped because the function pointers were all wrong.

The only reason why this would happen is if your application used both the CLI driver and ODBC driver in the same application. 

 

To investigate an application crash using a DB2 driver, key things to collect are:

- Background details of the application like what Operating System, what driver is being used, what is the application exactly doing..

- Environment details of DB2 driver and DB2 Database server

- Crash symptoms

- Windows Crash Dumps, you may use adPlus or similar utility to collect dumps

- Event Viewer Logs - both application and System, check for any errors the same when the application crashed

- Time stamp of the crash

- db2traces from the Client (might be needed)

- db2support from Client and Server (might be needed)

Thanks for reading! Hope the information is helpful.

 

Please post a comment if you have a question, we can answer.

 

[{"Business Unit":{"code":"BU029","label":"Data and AI"}, "Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11140712