Capicom dll usage in SQL Server 200 gives EXCEPTION_ACCESS_VIOLATI



Hi,

I am using the Capicom COM(version 2.1.0.2) component to encrypt/decrypt
data using SQL server 2000 scalar functions. The functions run fine once I
start the server and use the Capicom.dll for encryption/decryption for a
small number of records. When I run a query that applies the scalar function
on a large resultset returning around 300000 rows, the query runs fine the
first time around only.

However, when I run the query again, CAPICOM.EncryptedData object
initialization fails with EXCEPTION_ACCESS_VIOLATION error. If I wait for a
longer amount of time or restart the server, the function starts working
again till the time I run a query that again applies the function to a large
set of data.

I am running the function using the “sa” user on the SQL server. The machine
where SQL server 2000 is installed is a windows 2003 server.

Can you please let me know what might be causing the access violation? It
looks like a virtual memory space allocation issue to me. I am pasting
initial part of the SQL server error dumps for your reference.

Any help from you in this regard will be highly appreciated.

=====================================================================

BugCheck Dump

=====================================================================



This file is generated by Microsoft SQL Server 8.00.2039

upon detection of fatal unexpected error. Please return this file,

the query or program that produced the bugcheck, the database and

the error log, and any other pertinent information with a Service Request.



Computer type is AT/AT COMPATIBLE.

Bios Version is A M I - 3000518

SE7520BD22 Production BIOS Version 07.30, Build 0067

Current time is 22:00:50 05/14/08.

4 Intel x86 level 15, 2793 Mhz processor(s).

Windows NT 5.2 Build 3790 CSD Service Pack 1.



Memory
MemoryLoad = 44%
Total Physical = 2047 MB
Available Physical = 1140 MB
Total Page File = 4401 MB
Available Page File = 3589 MB
Total Virtual = 2047 MB
Available Virtual = 324 MB

*Stack Dump being sent to e:\Microsoft SQL Server\MSSQL\log\SQLDump0009.txt

*
*****************************************************************************
**

*

* BEGIN STACK DUMP:

* 05/14/08 22:00:50 spid 52

*

* Exception Address = 7C83002E (RtlAllocateHeap + 00000631 Line
0+00000000)
* Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION

* Access Violation occurred writing address 053C49F1

* Input Buffer 3996 bytes -

* DECLARE @RC int DECLARE @startVal bigint DECLARE @lastVal bigint DECL

* ARE @amountFrom varchar(12) DECLARE @amountTo varchar(12) DECLARE @net

* work varchar(1000) DECLARE @subnetwork varchar(1000) DECLARE @agent va

* rchar(1000) DECLARE @transaction varchar(10) DECLARE @datefrom varchar

* (10) DECLARE @dateto varchar(10) DECLARE @sortFirstLevel varchar(30)

* DECLARE @sortFirstOrder varchar(30) DECLARE @sortSecondLevel varchar(30

* ) DECLARE @sortSecondOrder varchar(30) DECLARE @sortThirdLevel varchar

* (30) DECLARE @sortThirdOrder varchar(30) DECLARE @fieldName varchar(25

* ) DECLARE @fieldValue varchar(100) DECLARE @key varchar(256) SELECT @

* startVal = 1 SELECT @lastVal = 300 SELECT @amountFrom = '1' SELECT @a

* mountTo = '999' SELECT @network = NULL SELECT @subnetwork = NULL SELE

* CT @agent = NULL SELECT @transaction = NULL SELECT @datefrom = NULL S

* ELECT @dateto = NULL SELECT @sortFirstLevel = NULL SELECT @sortFirstOr

* der = NULL SELECT @sortSecondLevel = NULL SELECT @sortSecondOrder = NU

* LL SELECT @sortThirdLevel = NULL SELECT @sortThirdOrder = NULL SELECT

* @fieldName = NULL SELECT @fieldValue = NULL SELECT @key = 'iLcy04RSXs

* qRU/XcCBx+fQ==' select getdate() --EXEC @RC = [Agentlink2UAT].[dbo

* ].[sp_DetailRecords] @startVal, @lastVal, @amountFrom, @amountTo, @netwo

* rk, @subnetwork, @agent, @transaction, @datefrom, @dateto, @sortFirstLev

* el, @sortFirstOrder, @sortSecondLevel, @sortSecondOrder, @sortThirdLevel

* , @sortThirdOrder, @fieldName, @fieldValue EXEC @RC = [Agentlink2UAT]

* .[dbo].[sp_DetailRecords_Encryption] @startVal, @lastVal, @amountFrom, @

* amountTo, @network, @subnetwork, @agent, @transaction, @datefrom, @datet

* o, @sortFirstLevel, @sortFirstOrder, @sortSecondLevel, @sortSecondOrder,

* @sortThirdLevel, @sortThirdOrder, @fieldName, @fieldValue, @key DECLAR

* E @PrnLine nvarchar(4000) PRINT 'Stored Procedure: Agentlink2UAT.dbo.sp

* _DetailRecords_Encryption' SELECT @PrnLine = ' Return Code = ' + CONVER

* T(nvarchar, @RC) PRINT @PrnLine select getdate()

*

*

* MODULE BASE END SIZE

* sqlservr 00400000 00CBAFFF 008bb000

* ntdll 7C800000 7C8BFFFF 000c0000

* kernel32 77E40000 77F41FFF 00102000

* ADVAPI32 77F50000 77FEBFFF 0009c000

* RPCRT4 77C50000 77CEEFFF 0009f000

* MSVCP71 7C3A0000 7C41AFFF 0007b000

* MSVCR71 7C340000 7C395FFF 00056000

* opends60 41060000 41065FFF 00006000

* SHELL32 7C8D0000 7D0D3FFF 00804000

* msvcrt 77BA0000 77BF9FFF 0005a000

* GDI32 77C00000 77C48FFF 00049000

* USER32 77380000 77411FFF 00092000

* SHLWAPI 77DA0000 77DF1FFF 00052000

* sqlsort 42AE0000 42B6FFFF 00090000

* ums 41070000 4107DFFF 0000e000

* IMM32 76290000 762ACFFF 0001d000

* comctl32 77420000 77522FFF 00103000

* sqlevn70 41080000 4108AFFF 0000b000

* NETAPI32 02C90000 02CE7FFF 00058000

* AUTHZ 02CF0000 02D03FFF 00014000

* COMRES 03120000 031E5FFF 000c6000

* ole32 031F0000 03323FFF 00134000

* XOLEHLP 03330000 03335FFF 00006000

* MSDTCPRX 03340000 033B7FFF 00078000

* msvcp60 033C0000 03420FFF 00061000

* MTXCLU 03430000 03448FFF 00019000

* VERSION 03450000 03457FFF 00008000

* WSOCK32 03460000 03468FFF 00009000

* WS2_32 03470000 03486FFF 00017000

* WS2HELP 03490000 03497FFF 00008000

* OLEAUT32 034A0000 0352BFFF 0008c000

* CLUSAPI 03570000 03581FFF 00012000

* RESUTILS 03590000 035A2FFF 00013000

* USERENV 035B0000 03673FFF 000c4000

* secur32 03680000 03692FFF 00013000

* mswsock 036B0000 036F0FFF 00041000

* DNSAPI 03700000 0372EFFF 0002f000

* winrnr 03770000 03776FFF 00007000

* WLDAP32 03780000 037ADFFF 0002e000

* rasadhlp 037D0000 037D7FFF 00008000

* NTMARTA 03FB0000 03FD1FFF 00022000

* SAMLIB 03FE0000 03FEEFFF 0000f000

* SSNETLIB 00E50000 00E65FFF 00016000

* security 042C0000 042C3FFF 00004000

* hnetcfg 042D0000 04328FFF 00059000

* wshtcpip 04370000 04377FFF 00008000

* SSmsLPCn 04400000 04407FFF 00008000

* SSnmPN70 04410000 04416FFF 00007000

* ntdsapi 044A0000 044B4FFF 00015000

* kerberos 04CD0000 04D27FFF 00058000

* cryptdll 04D30000 04D3BFFF 0000c000

* MSASN1 04D40000 04D51FFF 00012000

* msv1_0 044E0000 04506FFF 00027000

* iphlpapi 04510000 04529FFF 0001a000

* PSAPI 04530000 0453AFFF 0000b000

* rsaenh 04540000 0456EFFF 0002f000

* xpsp2res 10000000 102C4FFF 002c5000

* CLBCatQ 047C0000 04842FFF 00083000

* sqloledb 04850000 048D0FFF 00081000

* MSDART 04250000 04269FFF 0001a000

* MSDATL3 04270000 04284FFF 00015000

* oledb32 04BA0000 04C18FFF 00079000

* OLEDB32R 04290000 042A0FFF 00011000

* odsole70 04C20000 04C30FFF 00011000

* capicom 053B0000 0542DFFF 0007e000

* MSSIGN32 042B0000 042BBFFF 0000c000

* CRYPT32 05430000 054C2FFF 00093000

* WININET 054D0000 0559EFFF 000cf000

* Normaliz 05150000 05158FFF 00009000

* iertutil 055A0000 055E4FFF 00045000

* WINTRUST 055F0000 0561AFFF 0002b000

* imagehlp 05620000 05648FFF 00029000

* SXS 05770000 0582BFFF 000bc000

* odsole70 05880000 05884FFF 00005000

* dbghelp 05990000 05A8FFFF 00100000

*

* Edi: 05760000: 000000C8 00000143 EEFFEEFF 00001002 00000000
0000F
E00

* Esi: 05763938: 01010084 000C0064 053B3760 053C49F1 00000001
00000
000

* Eax: 05763940: 053B3760 053C49F1 00000001 00000000 00000000
00000
000

* Ebx: 05760178: 053B3760 053B3734 00000001 00000000 00000000
00000
000

* Ecx: 053B3760: 053C2CCC 053C49F1 053C2FCE 053C2C89 053BCA8E
053C2
B88

* Edx: 053C49F1: 8B55FF8B 08458BEC 5008C083 116815FF C25D053B
CCCC0
004

* Eip: 7C83002E: 41890289 758B5604 B3E856D0 8BFFFFF5 4601E045
83DB3
328

* Ebp: 0526F7AC: 0526F7EC 053E1B72 05760000 00000000 05763D00
C63FB
5A5

* SegCs: 0000001B:

* EFlags: 00010283: 69005C00 63006E00 75006C00 65006400 49000000
4F005
700

* Esp: 0526F6DC: 00000000 05763D00 0029D530 7C8302B3 05763938
0526F
7D0

* SegSs: 00000023:

*
*****************************************************************************
**

*
-----------------------------------------------------------------------------
--

* Short Stack Dump

* 7C83002E Module(ntdll+0003002E) (RtlAllocateHeap+00000631)

* 053E1B72 Module(capicom+00031B72) (DllUnregisterServer+000218AC)

* 053C2FC1 Module(capicom+00012FC1) (DllUnregisterServer+00002CFB)

* 053C2FF5 Module(capicom+00012FF5) (DllUnregisterServer+00002D2F)

* 04C24962 Module(odsole70+00004962) (sp_OAGetErrorInfo+000002F2)

-------------------------------------------------------------------------------

.



Relevant Pages

  • Re: CONTAINS performance
    ... That said, and with the query plan, I can start to give you more ... relational join in the context of the free-text optimization, ... SQL Server tables. ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Access to SQLServer GCE
    ... Actually, as Larry points out, the Access client does a good job of filtering only information that you need. ... If your query is bound to a report, and you open that report supplying a typical "where" for that report, then Access will NOT pull down all the records, but in most cases Access will only pull down the required records and respect your filter. ... So SQL server will respect the conditions and filtering placed into those queries, and therefore only pull down those records you require. ... The suggestion in these cases is to consider using a pass-through query since all of that summing is done before the row comes down the network pipe. ...
    (comp.databases.ms-access)
  • Re: Indexing Service, Openquery and sp_executesql
    ... SQL Server version and sp are you running? ... > data from the indexing service catalog when pasted into ... > query analyzer, but failed when put against sp_executesql ... I would choose Microsoft Indexing ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Problem using Access or Query Designer to run queries in SQL Serve
    ... >or Query Designer within Enterprise Manager, it works and I get data back. ... >ODBC Call Failed [ODBC SQL Server Driver] Timeout Expirederror in Access ... >[ODBC SQL Server Driver] Timeout Expired ...
    (microsoft.public.sqlserver.odbc)
  • Extreme performance issues (SQL Server 2000/ADO.NET/C#)
    ... This process runs very quickly if run through Query ... same exact stored procedures and views, run in the same exact order, through ... system that runs SQL Server (a 4-cpu Xeons system with 2gigs of physical ... When I execute these steps manually through query analyser,, ...
    (microsoft.public.dotnet.framework.adonet)