[
  {
    "Id": "133993",
    "ThreadId": "40368",
    "Html": "Hi,<br>\r\n    I am trying to extract some zip files, in parallel. The zip files have different names though, they all contains same named files (with different contents). When i try to do that it throws exceptions such as &quot;CRC error: the file being extracted appears to be corrupted.....BadCrcException.....InternalExtract ...line 1369.&quot; <br>\r\n   It does not happen, if i only extract one file or extract file one after the other. I try to use &quot;<span>TempFileFolder&quot; but it also start raising some exceptions. <br>\r\nThe code is as follows:<br>\r\n<span style=\"font-size:13px\">\r\n<p>zFile = ZipFile.Read(_tempFolder + &quot;\\\\&quot; + fileName);</p>\r\n<p> zFile.ExtractAll(zDir, true);</p>\r\n</span></span>\r\n<p>           Let me know, how can i do that and also give me some performance tip. Thanks,<br>\r\nRegards,<br>\r\nOsman</p>\r\n",
    "PostedDate": "2008-11-20T11:53:34.393-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "133995",
    "ThreadId": "40368",
    "Html": "So you have multiple instances of the ZipFile class that you are using in multiple threads - is that right? <br>\r\nor do you have a single instance of the ZipFile class that you are using in multiple threads ?<br>\r\n<br>\r\nCan you give me a simple test case that reproduces the behavior you're experiencing?\r\n",
    "PostedDate": "2008-11-20T12:00:58.713-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "134023",
    "ThreadId": "40368",
    "Html": "Hi, Multiple threads working with different instances. I did not purely made threads but use<br>\r\n<br>\r\n<a href=\"http://www.codeplex.com/smartthreadpool\">http://www.codeplex.com/smartthreadpool</a> to simulate threads i.e. call the function. The function has a local variable ZipFile type and just extracts the zip file. Now, i have thousands of zip file. All the zip files have same set files inside ( the name of the files are same, although contents are different e.g say Address.txt file is present in every zip file having different address).<br>\r\n<br>\r\nuse this function :<br>\r\n<br>\r\n<span style=\"color:#0000ff;font-size:13px\"><span style=\"color:#0000ff;font-size:13px\">\r\n<p>private</p>\r\n</span>\r\n<p>&nbsp;</p>\r\n</span>\r\n<p><span style=\"font-size:13px\"> </span><span style=\"color:#0000ff;font-size:13px\">void</span><span style=\"font-size:13px\"> checkFolder()\r\n<p>&nbsp;</p>\r\n<p>{</p>\r\n</span></p>\r\n<span style=\"font-size:13px\">\r\n<p>&nbsp;</p>\r\n</span>\r\n<p><span style=\"color:#0000ff;font-size:13px\">string</span><span style=\"font-size:13px\">[] fileEntries = </span><span style=\"color:#2b91af;font-size:13px\">Directory</span><span style=\"font-size:13px\">.GetFiles(_uploadFolder,</span><span style=\"color:#a31515;font-size:13px\">&quot;*.zip&quot;</span><span style=\"font-size:13px\">);\r\n<p>&nbsp;</p>\r\n</span></p>\r\n<span style=\"font-size:13px\">\r\n<p>&nbsp;</p>\r\n</span>\r\n<p><span style=\"color:#0000ff;font-size:13px\">foreach</span><span style=\"font-size:13px\"> (</span><span style=\"color:#0000ff;font-size:13px\">string</span><span style=\"font-size:13px\"> fileName </span><span style=\"color:#0000ff;font-size:13px\">in</span><span style=\"font-size:13px\"> fileEntries)\r\n<p>&nbsp;</p>\r\n<p>{</p>\r\n</span></p>\r\n<span style=\"font-size:13px\">\r\n<p>_pool.QueueWorkItem(</p>\r\n</span>\r\n<p><span style=\"color:#0000ff;font-size:13px\">new</span><span style=\"font-size:13px\"> </span><span style=\"color:#2b91af;font-size:13px\">WorkItemCallback</span><span style=\"font-size:13px\">(</span><span style=\"color:#0000ff;font-size:13px\">this</span><span style=\"font-size:13px\">.processZip),</span><span style=\"color:#2b91af;font-size:13px\">Path</span><span style=\"font-size:13px\">.GetFileName(fileName));</span><span style=\"font-size:13px\">\r\n<p>&nbsp;</p>\r\n<p>}</p>\r\n<p>}</p>\r\n</span></p>\r\n<span style=\"color:#0000ff;font-size:13px\"><span style=\"color:#0000ff;font-size:13px\">\r\n<p>private</p>\r\n</span>\r\n<p>&nbsp;</p>\r\n</span>\r\n<p><span style=\"font-size:13px\"> </span><span style=\"color:#0000ff;font-size:13px\">object</span><span style=\"font-size:13px\"> processZip(</span><span style=\"color:#0000ff;font-size:13px\">object</span><span style=\"font-size:13px\"> fileName)\r\n<p>&nbsp;</p>\r\n</span></p>\r\n{<br>\r\n<span style=\"color:#0000ff;font-size:13px\"><span style=\"color:#0000ff;font-size:13px\">\r\n<p>string</p>\r\n</span>\r\n<p>&nbsp;</p>\r\n</span>\r\n<p><span style=\"font-size:13px\"> zDir = _tempFolder + </span><span style=\"color:#a31515;font-size:13px\">&quot;\\\\&quot;</span><span style=\"font-size:13px\"> + </span><span style=\"color:#2b91af;font-size:13px\">Path</span><span style=\"font-size:13px\">.GetFileNameWithoutExtension(fileName.ToString());</span><span style=\"font-size:13px\">\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n</span></p>\r\n<p><span style=\"color:#0000ff;font-size:13px\">if</span><span style=\"font-size:13px\">(System.IO.</span><span style=\"color:#2b91af;font-size:13px\">Directory</span><span style=\"font-size:13px\">.Exists(zDir)==</span><span style=\"color:#0000ff;font-size:13px\">false</span><span style=\"font-size:13px\">)\r\n<p>&nbsp;</p>\r\n<p>System.IO.</p>\r\n</span></p>\r\n<p><span style=\"color:#2b91af;font-size:13px\">Directory</span><span style=\"font-size:13px\">.CreateDirectory(zDir);\r\n<p>&nbsp;</p>\r\n<p>zFile = </p>\r\n</span></p>\r\n<p><span style=\"color:#2b91af;font-size:13px\">ZipFile</span><span style=\"font-size:13px\">.Read(_tempFolder + </span><span style=\"color:#a31515;font-size:13px\">&quot;\\\\&quot;</span><span style=\"font-size:13px\"> + fileName);\r\n<p>&nbsp;</p>\r\n<p>zFile.ExtractAll(zDir, </p>\r\n</span></p>\r\n<p><span style=\"color:#0000ff;font-size:13px\">true</span><span style=\"font-size:13px\">);\r\n<p>&nbsp;</p>\r\n</span></p>\r\n<br>\r\n}       <br>\r\n<br>\r\n<br>\r\n        Thanks,<br>\r\nRegards, Osman<br>\r\n           \r\n",
    "PostedDate": "2008-11-20T13:11:47.897-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "134059",
    "ThreadId": "40368",
    "Html": "ok let me have a look.\r\n",
    "PostedDate": "2008-11-20T14:36:44.02-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "134275",
    "ThreadId": "40368",
    "Html": "Let me give you another tip.<br>\r\n                        It works; if you use lock or sync. But it will defeat the purpose of the application. The application will not be truely multi-threaded. The processing would be one after the other.\r\n",
    "PostedDate": "2008-11-21T07:58:44.93-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "135232",
    "ThreadId": "40368",
    "Html": "Hi,<br>\r\n   I looked at the code and found several &quot;lock&quot;. It means that the component is not true multi-threaded. The block will be executed only one at a time. I also noticed that most of the lock are used in the events OnBegin, OnEnd...<br>\r\n <br>\r\nI would recommend that there should be some way to turn off all the event generation, it will make it faster and may be also multi-threaded. Thanks,<br>\r\n",
    "PostedDate": "2008-11-25T11:39:26.18-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "135406",
    "ThreadId": "40368",
    "Html": "That should lock only the current instance and not the other ones !?\r\n",
    "PostedDate": "2008-11-25T23:05:13.337-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "141718",
    "ThreadId": "40368",
    "Html": "The ZipFile instance is not multi-thread friendly.  I've updated the doc to state that.  See change set 27058.  workitem 5182:<br>\r\n<a href=\"http://www.codeplex.com/DotNetZip/WorkItem/View.aspx?WorkItemId=5182\">http://www.codeplex.com/DotNetZip/WorkItem/View.aspx?WorkItemId=5182</a><br>\r\n<br>\r\nOn the other hand, in your case, using multiple threads working with different instances of ZipFile, is supported and will work, if you have the v1.7.1.6 release or later.<br>\r\n<br>\r\nThere was a bug in releases prior to that, which initialized a static crc table in the instance constructor. This resulted in the BadCrcException which you originally reported. See work item 6637:  <a href=\"http://www.codeplex.com/DotNetZip/WorkItem/View.aspx?WorkItemId=6637\">http://www.codeplex.com/DotNetZip/WorkItem/View.aspx?WorkItemId=6637</a> <br>\r\n",
    "PostedDate": "2008-12-18T16:51:41.537-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]