1.9.0.30 - CreateObject("Ionic.Zip.ZipFile") - Invalid procedure call or argument

Dec 3, 2009 at 10:54 AM

Hi,

I'm having weird intermitant issue when using the 1.9.0.30 library within vbscript .

I'm using the component in Sql 2000 DTS ActiveX Script - This package is running 10 simultaneous times. I'm firing stored procedure creating a file of each results and i want to zip these files i.e 10 of these processes running at once - I'm using the packages threading capabilities to speed the report generation up ~1000 reports. 

So over a few days i've noticed these errors and when i rerun it all works fine. drilling into the issue a bit more today and out of 4 tests this morning my script has worked fine twice and twice its failed on every file created. This type of error has only been seen post  trying to use 1.9.0.29

Have you any ideas why? , Anyway to get some more detailed information out in my scenario

Hoping you can help

Matt

 

Heres the code,

On Error Resume Next
...
Call Err.Clear()
'Create a new zip
Set objZip = CreateObject("Ionic.Zip.ZipFile")
If Err.Number <> 0 Then	
    Call LogDatabase(105566, Err.Description)
    Call LogZipCreateError(objZip, "Cannot create zip")	
    Exit Function	
End If
...
Sub LogZipCreateError(objZip, strDescription)
	Call LogDatabase(105565, strDescription & " - (" & Err.Description & ")")
	On Error Resume Next
	'Kill zip obj if exists
	Call objZip.Dispose()
	Set objZip = Nothing
	Call Err.Clear()
End Sub

Heres the records from the LogDatabase function, this function is fine its used everywhere in my code

105566 Invalid procedure call or argument
105565 Cannot create zip - (Invalid procedure call or argument)

 

 

 

Coordinator
Dec 3, 2009 at 4:59 PM

Yes, I've seen something similar in an environment where many ZIPs were being created simultaneously.  The other one was also SQL Server. 

In 1.9.0.30, I introduced a parallel deflation capability within the library itself.  It allocates a number of additional buffers and starts threads to perform the compression in parts.  This is often faster, but it takes much more memory. Also it make be counterproductive if you already have a parallel task running.  You can run out of memory, for example.

The parallel deflation happens automatically, but you can disable it.  Set the ParallelDeflateThreshold property on the zipfile instance to -1.  like this:

Set objZip = CreateObject("Ionic.Zip.ZipFile")
'' check return here
objZip.ParallelDeflateThreshold = -1

This reverts the behavior of the library to the pre-1.9.0.30 behavior - all compression is done on a single-threaded basis.

Try this and see if it works for you.

Dec 4, 2009 at 12:25 PM

Thanks for the reply, Cheeso

Unfortunately i can't set the property my creatobject statement blows out with Invalid procedure call or argument.

I've looked at the default constructor in the source and i can't see anything here could cause the issue.

The really strange thing is that sometimes it works and sometimes it doesn't, On other test servers it creates the object perfectly .

The process is running under a SqlAgentJob, the jobs owner is part of the sysadmin fixed role hence should have full server permissions

Perhaps its something to do with registering the object

here is how i register and unregister via a bat files .....

Register.Bat...
D:
cd D:\Bin\Tools\
gacutil -i D:\Bin\DotNetZip\1.9.0.30\Ionic.Zip.dll

C:
cd C:\WINNT\Microsoft.NET\Framework\v2.0.50727\
regasm D:\Bin\DotNetZip\1.9.0.30\Ionic.Zip.dll
pause

cscript D:\Bin\DotNetZip\1.9.0.30\TestRegistration.vbs
pause
Unregesiter.bat ...
D:
cd D:\Bin\Tools\
gacutil -u Ionic.Zip
C:
cd C:\WINNT\Microsoft.NET\Framework\v2.0.50727\
regasm D:\Bin\DotNetZip\1.9.0.30\Ionic.Zip.dll /u
pause

cscript D:\Bin\\DotNetZip\1.9.0.30\TestRegistration.vbs
pause
I would apprecaite any further insight 
Matt
Coordinator
Dec 5, 2009 at 12:58 PM

Ah, I see.

I was thinking it had to do with a memory problem, maybe the object creation was failing due to lack of memory.

But that's not what you're seeing.  You appear to just be seeing an intermittent problem. 

I don't know why that would happen.

If I were troubleshooting this I would install the PRocMon tool from sysinternals (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx), and look at what happens when the CreateObject fails.

Also, try the hints on debugging failures in loading assemblies.   http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspx 

Old stuff, but still handy.

 

Jul 6, 2010 at 4:36 PM

Hi

Did you find the solution? I am having the same problem with SSIS "Cannot create ActiveX component ". It works fine on dev server but when deployed the test server it is giving me the error "Cannot create ActiveX component". I am just hitting the wall with that.

Any help will be appritiated.

Siraj