Recent

Author Topic: [ReOpened][SOLVED] Serious FpOleBasic.pas error/bug  (Read 19336 times)

JD

  • Hero Member
  • *****
  • Posts: 1848
[ReOpened][SOLVED] Serious FpOleBasic.pas error/bug
« on: July 03, 2012, 11:46:26 pm »
Hi there everyone,

For some time now, about 25% of the time, whenever I compile one of my projects that uses FpSpreadsheet I get the error below and compilation fails

FpSpreadsheet\fpolebasic.pas(65,3) Fatal: Internal error 200305057

The error occurs on the line in bold below:
 AOLEDocument.Stream.Position:=0; //Ensures it is in the begining.

The procedure that causes the problem WriteOLEFile is as shown below
Code: [Select]
procedure TOLEStorage.WriteOLEFile(AFileName: string;
  AOLEDocument: TOLEDocument; const AOverwriteExisting: Boolean;
  const AStreamName: UTF8String);
var
  RealFile: TFileStream;
  fsOLE: TVirtualLayer_OLE;
  OLEStream: TStream;
  VLAbsolutePath: UTF8String;
begin
  VLAbsolutePath:='/'+AStreamName; //Virtual layer always use absolute paths.
  if not AOverwriteExisting and FileExists(AFileName) then begin
      Raise EStreamError.Createfmt('File already exists "%s"',[AFileName]);
  end;
  RealFile:=TFileStream.Create(AFileName,fmCreate);
  fsOLE:=TVirtualLayer_OLE.Create(RealFile);
  fsOLE.Format(); //Initialize and format the OLE container.
  OLEStream:=fsOLE.CreateStream(VLAbsolutePath,fmCreate);
  AOLEDocument.Stream.Position:=0; //Ensures it is in the begining.
  OLEStream.CopyFrom(AOLEDocument.Stream,AOLEDocument.Stream.Size);
  OLEStream.Free;
  fsOLE.Free;
  RealFile.Free;
end;

Has anyone had a similar experience and does anyone know how I can fix it?

JD

« Last Edit: September 19, 2012, 12:19:07 pm by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Serious FpOleBasic.pas error/bug
« Reply #1 on: July 04, 2012, 06:22:31 am »
Please report it, internal error could be said as "error that should never happen".

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Serious FpOleBasic.pas error/bug
« Reply #2 on: July 04, 2012, 08:06:55 am »
Internal errors are compiler errors. Please open a bug report for the compiler.

Which compiler version are you using? You could try using another version.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Serious FpOleBasic.pas error/bug
« Reply #3 on: July 04, 2012, 10:52:11 am »
Leledumbo: first search for the number of the IE  in the bug database of FPC with all filters off (so that you also see resolved and closed items)

Marked as fixed in 2.7.1: http://bugs.freepascal.org/view.php?id=21914

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Serious FpOleBasic.pas error/bug
« Reply #4 on: July 04, 2012, 11:41:52 am »
Internal errors are compiler errors. Please open a bug report for the compiler.

Which compiler version are you using? You could try using another version.

Sorry about that. I forgot. I'm using Lazarus 1.1 svn 37469 Win32/FPC 2.6.0 on Windows Vista.
« Last Edit: July 04, 2012, 01:42:10 pm by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Serious FpOleBasic.pas error/bug
« Reply #5 on: July 04, 2012, 11:47:28 am »
Leledumbo: first search for the number of the IE  in the bug database of FPC with all filters off (so that you also see resolved and closed items)

Marked as fixed in 2.7.1: http://bugs.freepascal.org/view.php?id=21914

I don't want to move to FPC version 2.7.1 yet because some of my large collection of installed components may no longer work! This has been the case in the past whenever I use the "non-release" FPC version.
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Serious FpOleBasic.pas error/bug
« Reply #6 on: July 04, 2012, 03:08:34 pm »
Quote
I don't want to move to FPC version 2.7.1 yet because some of my large collection of installed components may no longer work! This has been the case in the past whenever I use the "non-release" FPC version.
Again: report and wait for fix, it's just the same case with release version actually. Try 2.6.1 (fixes branch of 2.6.0?) if you're afraid with 2.7.1, there will NEVER be 2.6.0 with the fix applied.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Serious FpOleBasic.pas error/bug
« Reply #7 on: July 05, 2012, 12:00:47 pm »
I noticed you reported in the bug report you were running FPC 2.6.0. 2.6.0 receives no patches/improvements/changes at all.

It could be that a fix has been implemented (e.g. the fix in 2.7.1 that Marco talked about) and backported/applied to 2.6.1

I would strongly suggest getting a Lazarus version with FPC 2.6.1 (using e.g. a snapshot, or a separate install using fpcup or manual subversion) and testing with that.
The devs are quite probably going to ask you to do that anyway to confirm the bug is still present.

(An aside: I've been using the 2.6.1 version a while now and like the bug fixes compared to 2.6.0... without any new problems... knock on wood.)

Also, even though the problem is not reproducible 100% of the time, it might be helpful to include a minimal test program if that is possible (and still demonstrates the bug)...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Serious FpOleBasic.pas error/bug
« Reply #8 on: July 05, 2012, 12:36:12 pm »
@Leledumbo
It is not a question of fear. It is more a question of having to rewrite perfectly working code in projects that are so close to delivery date and just before the summer holidays.  %)

@BigChimp
Yes I did submit a bug report; simply because what I suspected with the 2.7.1 version came to pass. That is, some of my major components, including the indispensible Virtual TreeView, refused to compile. I was hoping that perhaps a workaround could be found by rewriting the code in the fpolebasic.pas file.  ::)

I've downloaded the 2.6.1 version but I've not tested it yet. I hope it will solve the problem without forcing me to make major changes in my setup.

Thanks,

JD
« Last Edit: July 05, 2012, 01:23:31 pm by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Serious FpOleBasic.pas error/bug
« Reply #9 on: July 05, 2012, 01:54:47 pm »
@JD: to clarify: my point was not about the reason for filing the bug; my point is you shouldn't have used 2.6.0 to make that report: any fix that will be performed will never get in 2.6.0 so you'll have to move to 2.6.1 anyway.
(Ok, assuming the problem/fix is in the FPC side of things, but given that it is an internal error, that seems very likely)

Let's hope 2.6.1 Just Works for you...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Serious FpOleBasic.pas error/bug
« Reply #10 on: July 05, 2012, 03:10:07 pm »
@JD: to clarify: my point was not about the reason for filing the bug; my point is you shouldn't have used 2.6.0 to make that report: any fix that will be performed will never get in 2.6.0 so you'll have to move to 2.6.1 anyway.
(Ok, assuming the problem/fix is in the FPC side of things, but given that it is an internal error, that seems very likely)

Let's hope 2.6.1 Just Works for you...

Well I just tested Laz 1.1 svn 37865/FPC 2.6.1 Win32 and unfortunately it did not work. However, I patched up the fpolebasic.pas file according to the suggestion of Jose Méjuto http://bugs.freepascal.org/view.php?id=22370 and I was able to compile the project.

The only downside was that I had to remove Virtual TreeView from the project because it cannot compile using 2.6.1 (same scenario with 2.7.1).  %) I'll be needing LuizAmerico's help with that since he's the maintainer of the package.

Thanks to all for your suggestions.

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: [SOLVED] Serious FpOleBasic.pas error/bug
« Reply #11 on: July 07, 2012, 07:28:13 am »
I commited the work around from the bug report, so it should work OK now if you svn update your fpspreadsheet and go back to FPC 2.6.0

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Serious FpOleBasic.pas error/bug
« Reply #12 on: July 09, 2012, 02:08:46 pm »
I noticed you reported in the bug report you were running FPC 2.6.0. 2.6.0 receives no patches/improvements/changes at all.

It could be that a fix has been implemented (e.g. the fix in 2.7.1 that Marco talked about) and backported/applied to 2.6.1

Compiler fixes are not as often merged to fixes as RTL/packages fixes, because they are more interweaved.
 

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: [SOLVED] Serious FpOleBasic.pas error/bug
« Reply #13 on: July 09, 2012, 02:18:39 pm »
There still is a difference between not at all and not as often, is there? Then I fail to see why my post needs clarification?

Anyway, looking at Felipe's post, the issue has actually been fixed already - even for FPC 2.6.0.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
[REOPENED] Re: [SOLVED] Serious FpOleBasic.pas error/bug
« Reply #14 on: September 12, 2012, 02:29:20 pm »
Unfortunately, I'm running into the same internal error 200305057 with the fpspreadsheet svn code (r2475, dated 2012-07-05) in another position:
Code: [Select]
  // work around code for the bug 22370
  tmpStream:=AOLEDocument.Stream;
  tmpStream.Position:=0; //Ensures it is in the begining.
  //previous code: AOLEDocument.Stream.Position:=0; //Ensures it is in the begining.

  OLEStream.CopyFrom(AOLEDocument.Stream,AOLEDocument.Stream.Size); //<= Fatal: internal error 200305057

Both with Laz 1.0+FPC 2.6.0 and Laz trunk+FPC 2.6.1 (r22356)
Edit: also with Laz trunk+FPC trunk (r22340)
Edit: source code that demonstrates the problem can be downloaded via
https://bitbucket.org/reiniero/postcode/downloads/fpspreadsheetinternalerror.zip
(which is the source code of commit 4e331a9e4015)

Edit: Tried to create a simple Laz application that replicates it, but it doesn't seem to trigger the error:
See simple Lazarus application attached to bug report.
« Last Edit: September 13, 2012, 11:11:31 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018