View Issue Details

IDProjectCategoryView StatusLast Update
0005390JEDI Code LibraryJclCompressionpublic2011-02-22 21:05
Reporterpka4916Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionnot fixable 
Product VersionVersion 2.2 
Target VersionFixed in VersionVersion 2.3 
Summary0005390: JCL Compression Freezes up with ZIP files
DescriptionIf I use the compression demo that comes with JCL,
and I create a new ZIP file, and save it, i get a nice file.

Now When I open the File, and add several files to it, and hit SAVE, nothing happens. the whole program locks up.
Since this was happening randomly, I played some more, and seems to happen
when the file is 16Mb, and compressed is 12 Mb.

I also added the same code, that I am using in my program, and is the same as from the Demo in JCL.

NOTE: When I create 7z files, i do not have any issues, when I add files to an archive. it's only the ZIP files, that are locking up.
Additional Information AFormat := GetArchiveFormats.FindUpdateFormat(file10);
 if AFormat <> nil then
            begin
            imageArchive := AFormat.Create(file10, 0, false);
            imageArchive.OnProgress := ArchiveProgress;
            JclUpdateArchive(imageArchive).ListFiles;
            (imageArchive as TJclCompressArchive).AddFile('coverimage.png', localtemppath+'coverimage.png');
            (imageArchive as TJclCompressArchive).AddFile('gameicon.png', localtemppath+'gameicon.png');
            (imageArchive as TJclCompressArchive).AddFile('ingameimage.png', localtemppath+'ingameimage.png');
                 
           (imageArchive as TJclCompressArchive).Compress;
           FreeAndNil(imageArchive);
           end;
TagsNo tags attached.
Fixed in GIT commit
Fixed in SVN revision
IDE versionDelphi/C++Builder 2009

Activities

pka4916

2010-11-05 13:51

reporter   ~0018003

This is also with the latest official version.

outchy

2010-11-06 11:53

administrator   ~0018005

Could you send me the archive (split in files < 10MB) and I'll try to reproduce.

EMail is outchy at users dot sourceforge dot net

outchy

2010-11-07 11:29

administrator   ~0018009

Well received.

But I cannot reproduce the freeze here using 7z 9.16.

Here are the steps I did:
 - save the 3 rar archive parts;
 - extract them;
 - compile the latest development version of the JCL (daily zips at http://jcl.sf.net/daily or SVN)
 - compile the ArchiveDemo project in jcl/examples/windows/compression/archive
 - open it
 - switch to the tab "read and write"
 - open the archive "0022 - Super Mario 64 DS.zip"
 - add several files 1a.png, ...
 - click on "Save"

The compression runs as expected. System is windows 2k.

Note that in your code, you could avoid multiple typecasts by declaring imageArchive as TJclUpdateArchive.

pka4916

2010-11-07 13:07

reporter   ~0018010

Strange, it's failing for me.

I do have Winzip installed.. I don't know if that's part of it??
Since when I open the Zip file in the Demo,
I get a Winzip error later on also (randomly)
with this error

Assert Error (.\PreviewCOM.cpp@365): The operation completed successfully.

And I am using Windows 7 64 Bit

I am doing the same steps, and after "Save" the green bar at the bottom
doesn't so anything.

Let me uninstall Winzip and I will try again, that's the only thing I didn't do.

2010-11-07 13:47

 

working.JPG (50,890 bytes)
working.JPG (50,890 bytes)

2010-11-07 13:47

 

failing.JPG (55,482 bytes)
failing.JPG (55,482 bytes)

pka4916

2010-11-07 13:57

reporter   ~0018012

Last edited: 2010-11-07 13:59

btw, regarding the comment about imageArchive typecast.
This is what I use

Var
imagearchive : TJclCompressionArchive;
AFormat : TJclUpdateArchiveClass;
file1 : string;

begin
AFormat := GetArchiveFormats.FindUpdateFormat(file1);
if AFormat <> nil then
   begin
   imagearchive := AFormat.Create(file1, 0, false);
   imagearchive.OnProgress := ArchiveProgress;
   TJclUpdateArchive(imagearchive).ListFiles;
imagearchive as TJclCompressArchive).AddFile('coverimage.png','coverimage.png');
imagearchive as TJclCompressArchive).AddFile('gameicon.png', 'gameicon.png');
   (imagearchive as TJclCompressArchive).Compress ;
   FreeAndNil(imagearchive);
   end;

Is this not correct then? (got the compression one from the demo)

outchy

2010-11-07 14:21

administrator   ~0018013

About the compression problem, make sure the files are not edit-locked while editing the archive (the archive should not be opened in Winzip or in the explorer).

The demo is able to work with compression/decompression/update archive classes. That's why its archive is declared as TJclCompressionArchive.
Since your code does update and only update, you should be able to declare imagearchive as TJclUpdateArchive:

Var
imagearchive : TJclUpdateArchive;
AFormat : TJclUpdateArchiveClass;
file1 : string;

begin
AFormat := GetArchiveFormats.FindUpdateFormat(file1);
if AFormat <> nil then
   begin
   imagearchive := AFormat.Create(file1, 0, false);
   imagearchive.OnProgress := ArchiveProgress;
   imagearchive.ListFiles;
   imagearchive.AddFile('coverimage.png','coverimage.png');
   imagearchive.AddFile('gameicon.png', 'gameicon.png');
   imagearchive.Compress ;
   FreeAndNil(imagearchive);
   end;

This change limits the amount of potentially unsafe/slow typecasts.

pka4916

2010-11-07 17:39

reporter   ~0018014

ok, I figured out where the problem is, but don't know what..

it's failing on the .Onprogress := Archiveprogress;
If I comment that one out, then it's fine.

I do have a procedure with Archiveprogress. But don't see what could be
wrong with that??



procedure Tdsmainform.ArchiveProgress(Sender: TObject; const Value, MaxValue: Int64);
var
  MyValue, MyMaxValue: Int64;
begin
  MyValue := Value;
  MyMaxValue := MaxValue;

  while MyMaxValue > High(Word) do
  begin
    MyMaxValue := MyMaxValue shr 8;
    MyValue := MyValue shr 8;
  end;
  mainprogressbar.TotalParts:=MyMaxValue;
  mainprogressbar.PartsComplete:=myvalue;
end;

outchy

2010-11-07 18:47

administrator   ~0018015

Which version of Delphi?

pka4916

2010-11-07 23:16

reporter   ~0018017

Last edited: 2010-11-08 03:20

ok, did some more work..

it's getting in an endless loop sometimes with this

while MyMaxValue > High(Word) do
  begin
    MyMaxValue := MyMaxValue shr 8;
    MyValue := MyValue shr 8;
  end;

Mymaxvalue is not changing sometimes.

and the other issue is that sometimes it locks up on sending the results to the progressbar

 mainprogressbar.TotalParts:=MyMaxValue;
 mainprogressbar.PartsComplete:=myvalue;



EDIT 2:

After playing with it for hours, it seems that it's coming for 99% from the
value parsing to the Progressbar.
I tried all the progressbars on my form (standard Delphi, and all the JV progressbars, and they all do the same).
when I disable the last 2 lines, I don't have any problems.
Other think noticed, with all the JV progress bars, that when you min, max the form, that the progressbar disappears.

outchy

2010-11-08 08:29

administrator   ~0018018

That's wierd, I'll try to spend some time on this issue on today...

pka4916

2010-11-09 03:16

reporter   ~0018023

I played some more with it, and keeps failing also on the demo file for the statusbar.
There's not really a logic in it. Tried looking at the code, but couldn't figure it out, and also no clue what to look for.

Could it be some kind of a conflict with another component, even though I'm not using other ones (like Razor,Toolbar 2000, Berg Soft)

outchy

2010-11-09 08:21

administrator   ~0018024

Perhaps a problem of thread safety, 7zip is threaded. Could you have a look at the thread ID each time the breakpoint is hit?

pka4916

2010-11-09 14:04

reporter   ~0018025

Last edited: 2010-11-09 14:12

ooh, good one..
I do remember seeing something like that, and then it stops.
let me work on that, to see if that's true or not.

EDIT: it starts a thread, and then stops.
       was trying to break on the Onprogress procedure, but couldn't get
       it too stop either.

Can I set an option somewhere to use only 1 thread ?

pka4916

2010-11-10 03:41

reporter   ~0018069

I'm stepping through the code line by line, and noticed something weird.

 mainprogressbar.TotalParts:=MyMaxValue;
 mainprogressbar.PartsComplete:=myvalue;

mymaxvalue is always 1014 eventhough the max should only be 100 ?
Myvalue steps from 2,4,6 .. 62 and then locks up.

it's repeating the procedure

procedure TJclCompressionArchive.DoProgress(const Value, MaxValue: Int64);
begin
if Assigned(FOnProgress) then FOnProgress(Self, Value, MaxValue);
end;

the "self" contains the values
((mainform.Tdsmainform.ArchiveProgress,$48D1FD0), (nil,nil), (nil,nil), '', 1, 1, 0, '', 66488116, $6FF0ED0, $6FF0550)

and it seems to freeze at some point on the DoProgress event

outchy

2010-11-11 15:06

administrator   ~0018095

Please have a look at the archive demo, revision 3417.

outchy

2010-11-11 16:08

administrator   ~0018098

no, tomorrow's daily zip (2010-11-12), you can already download rev 3417 in Sourceforge ViewVC (see Download GNU Tarball at the bottom of http://jcl.svn.sf.net/viewvc/jcl/trunk/jcl/ ).

pka4916

2010-11-11 17:30

reporter   ~0018100

Last edited: 2010-11-12 13:39

ok, updated my code with the new items, in the Demo and in my program.
but it's still locking up, then it's doing the TThread function.

I did see that you updated the sevenzip.pas file.
Do I need that one also?

It's freezing here after about 6-9 times
it's stops executing that TThread it never reaches the procedure for that one.


procedure Tdsmainform.ArchiveProgress(Sender: TObject; const Value, MaxValue: Int64);
var
  MyValue, MyMaxValue: Int64;
begin
  MyValue := Value;
  MyMaxValue := MaxValue;

  while MyMaxValue > High(Word) do
  begin
    MyMaxValue := MyMaxValue shr 8;
    MyValue := MyValue shr 8;
  end;

FProgressmax:=mymaxvalue;
FProgressvalue:=myvalue;
------> tthread.Synchronize (nil,syncharchiveprogress);
// never makes it to syncharchiveprogress after 6-9 times
end;



procedure Tdsmainform.syncharchiveprogress;
begin
mainprogressbar.Max :=FProgressmax;
mainprogressbar.Position :=FProgressvalue;
end;



Installed the whole package from 11/12 JCL and JVCL and same problem.
locks up right away

pka4916

2010-11-12 15:18

reporter   ~0018105

I'm playing around, and don't know if it helps.
but it only seems to be happening when you open the archive and Add files.
it works fine, when you unzip files, and creating new files seems to be fine too.

pka4916

2010-11-13 01:05

reporter   ~0018107

Last edited: 2010-11-13 01:10

There is also something else wrong..


FProgressmax:=mymaxvalue;
FProgressvalue:=myvalue;

FProgressvalue always stays 0 while myvalue has a number... how is that possible ?

Edit: both were declared as Byte. Changed it to Integer and now that part is
working.

Now back to the original issue.

7Z works with no problems, I tried a lot of files...
As soon as I use Zip, it freezes up on me

pka4916

2010-11-17 04:50

reporter   ~0018125

Last edited: 2010-11-17 13:34

I started debugging the JCLcompression.pas file
and it's getting stuck on this line in the following procedure

procedure TJclSevenzipUpdateArchive.Compress;
begin
.
.
SevenzipCheck(OutArchive.UpdateItems(OutStream, ItemCount, UpdateCallback));
.
.
end;

it doesn't even go to Sevenzipcheck

pka4916

2010-11-28 04:42

reporter   ~0018204

ok, now I know why it's failing.

You can only ADD 1 file to a ZIP at a time.
If you do 2 files, then it fails.

so I need to add 1 file, save, add 1 file and save.

Strange. since for 7z I don't need to do that.

pka4916

2010-12-02 21:00

reporter   ~0018238

Will this be fixed????

outchy

2010-12-13 11:37

administrator   ~0018247

That sounds like an internal error in sevenzip code.

A copy/paste from Perry's message in newsgroups that sums this problem up:

<copy>
ok, I figured out, when it's failing when you ADD files to a ZIP file.

If you add only 1 File and save it, then it works just fine.
When you add 2 or more files to a ZIP file, then it freezes the whole thing up.

When I do this for 7Z files, then it's working just fine.
Guess that explains, why it was working for adding just 1 file.

I updated my Bug report on the web, and hope someone could look into it.
since now I need to open - update - close file a lot of times.

thank you

   Perry
</copy>

pka4916

2010-12-13 16:35

reporter   ~0018254

I am Perry :)

pka4916

2011-02-19 21:30

reporter   ~0018393

I guess you can close this ticket.
Have to found out from 7z if this is or will be fixed.

Issue History

Date Modified Username Field Change
2010-11-05 12:52 pka4916 New Issue
2010-11-05 13:51 pka4916 Note Added: 0018003
2010-11-05 14:22 obones Project JEDI VCL => JEDI Code Library
2010-11-06 11:50 outchy IDE version => Delphi/C++Builder XE
2010-11-06 11:50 outchy Category 00 JVCL Components => JclCompression
2010-11-06 11:50 outchy Product Version Daily / SVN => Version 2.2
2010-11-06 11:50 outchy Additional Information Updated
2010-11-06 11:53 outchy Note Added: 0018005
2010-11-07 11:29 outchy Note Added: 0018009
2010-11-07 13:07 pka4916 Note Added: 0018010
2010-11-07 13:47 pka4916 File Added: working.JPG
2010-11-07 13:47 pka4916 File Added: failing.JPG
2010-11-07 13:57 pka4916 Note Added: 0018012
2010-11-07 13:59 pka4916 Note Edited: 0018012
2010-11-07 14:21 outchy Note Added: 0018013
2010-11-07 17:39 pka4916 Note Added: 0018014
2010-11-07 18:47 outchy Note Added: 0018015
2010-11-07 23:16 pka4916 Note Added: 0018017
2010-11-07 23:31 pka4916 Note Edited: 0018017
2010-11-08 03:20 pka4916 Note Edited: 0018017
2010-11-08 08:28 outchy IDE version Delphi/C++Builder XE => Delphi/C++Builder 2009
2010-11-08 08:29 outchy Note Added: 0018018
2010-11-09 03:16 pka4916 Note Added: 0018023
2010-11-09 08:21 outchy Note Added: 0018024
2010-11-09 14:04 pka4916 Note Added: 0018025
2010-11-09 14:12 pka4916 Note Edited: 0018025
2010-11-10 03:41 pka4916 Note Added: 0018069
2010-11-11 15:06 outchy Note Added: 0018095
2010-11-11 16:08 outchy Note Added: 0018098
2010-11-11 17:30 pka4916 Note Added: 0018100
2010-11-11 21:50 pka4916 Note Edited: 0018100
2010-11-12 13:39 pka4916 Note Edited: 0018100
2010-11-12 15:18 pka4916 Note Added: 0018105
2010-11-13 01:05 pka4916 Note Added: 0018107
2010-11-13 01:10 pka4916 Note Edited: 0018107
2010-11-17 04:50 pka4916 Note Added: 0018125
2010-11-17 13:34 pka4916 Note Edited: 0018125
2010-11-28 04:42 pka4916 Note Added: 0018204
2010-12-02 21:00 pka4916 Note Added: 0018238
2010-12-13 11:37 outchy Note Added: 0018247
2010-12-13 16:35 pka4916 Note Added: 0018254
2011-02-19 21:30 pka4916 Note Added: 0018393
2011-02-22 21:05 outchy Status new => closed
2011-02-22 21:05 outchy Resolution open => not fixable
2011-02-22 21:05 outchy Fixed in Version => Version 2.3 (Subversion repository/Daily zips)