Recent

Author Topic: Lazbuild EAccessViolation  (Read 5232 times)

antispam88

  • New member
  • *
  • Posts: 43
Re: Lazbuild EAccessViolation
« Reply #15 on: January 18, 2018, 11:35:24 pm »
As I mentioned before I have always the same list of projects with different targets (use jenkins to build them all). Sometimes it is working but most of the time I'm getting the errors descibed above.

These are my steps to get my output:
I used Lazarus to open C:\la zarus\ide\lazbuild.lpi, changed the build mode to debug and used Run -> Clean up and Build ...
After that I started gbd with C:\lazarus\mingw\x86_64-win64\bin\gdb.exe C:\lazarus\lazbuild.exe.
In the gdb bash I first set the parameters with "set args -B --build-mode=Release_32_1 --verbose --compiler="C:\lazarus\fpc\3.0.4\bin\x86_64-win64\ppc386.exe" src\project1.lpi" and then used "run" do start.
When the error occured I used "bt" to get the backtrace.

Have I missed something to get debug info?

Best regards,
antispam88

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #16 on: January 17, 2019, 03:48:03 pm »
Same error here running lazbuild from Jenkins on Mac OS X (Lazarus 2.0 RC3).
Can I help providing some logs?

Code: Pascal  [Select]
  1. TProject.DoLoadStateFile Statefile not found: /Users/Administrator/Build/dcu/i386-darwin/bssPluginHost.compiled
  2.  
  3. An unhandled exception occurred at $00000000:
  4. EAccessViolation: Access violation
  5. An unhandled exception occurred at $A7A1A530:
  6. EAccessViolation: Access violation
  7.   $A7A1A530
  8.   $001DE23B
  9.   $0003DD58
  10.   $0003DAC8
  11.   $0002C6CA
  12.   $0052D097
  13.   $0052E09D
  14.   $0002B4A6
  15.  
  16. An unhandled exception occurred at $000C6181:
  17. EAccessViolation: Access violation
  18.   $000C6181
  19.   $000C626D
  20.   $000CAD3F
  21.   $00190BE1
  22.   $00191190
  23.   $00013F48
  24.   $00013431
  25.   $00011E53
  26.   $000167CC

Xor-el

  • Sr. Member
  • ****
  • Posts: 257
Re: Lazbuild EAccessViolation
« Reply #17 on: January 17, 2019, 05:05:54 pm »
I have experienced same issue when using lazbuild in Travis CI but unfortunately cannot consistently reproduce it.
I just restart my build when the error happens and after 2 or 3 tries, it suddenly works.  ::)

antispam88

  • New member
  • *
  • Posts: 43
Re: Lazbuild EAccessViolation
« Reply #18 on: January 17, 2019, 08:43:41 pm »
Hi,

we are using lazbuild in jenkins environment.
Because we have still no real solution for our problem, we just use a loop with 10 tries.
With that approach lazbuild is "working".
I know that this couldn't be the final solution, but because the use is in our case not time critical, it is ok.

This is our script for linux arm:
Quote
if [ -e bin/project1 ]
then
   rm bin/project1;
   err=$?
   if [ $err -ne 0 ]; then exit $err; fi
fi
for i in {1..10..1}
do
   /home/pi/fpupdeluxe/lazarus/lazbuild /home/pi/project1/project1.lpi
   if [ -e bin/project1 ]
   then
      echo lazbuild bin/project1 OK
      exit 0
   else
      echo attempt $i failed: $?
   fi
done

Best regards,
antispam88

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #19 on: January 17, 2019, 09:15:05 pm »
That's really strange. We have Jenkins on another machine. It just starts lazbuild over ssh with plink.exe from Putty. And the same way - no errors after re-run.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 648
Re: Lazbuild EAccessViolation
« Reply #20 on: January 17, 2019, 09:40:59 pm »
I have just opened a ticket about a minor problem I had found in lazbuild:
0034892: (lazbuild) package not found: c:\lazarus\source\lazarus\examples\hello.lp
https://bugs.freepascal.org/view.php?id=34892



Since some of you are using Jenkins or Travis CI on a regular basis for continuous integration, can you collect more data (logs) to strip down this randomly strange behavior of lazbuild?

Maybe something similar to:
Code: Bash  [Select]
  1. if [ -e bin/project1 ]
  2. then
  3.         rm bin/project1;
  4.         err=$?
  5.         if [ $err -ne 0 ]; then exit $err; fi
  6. fi
  7. for i in {1..10..1}
  8. do
  9.         # /home/pi/fpupdeluxe/lazarus/lazbuild /home/pi/project1/project1.lpi
  10.         /home/pi/fpupdeluxe/lazarus/lazbuild   --version   --verbose   --verbose-pkgsearch   /home/pi/project1/project1.lpi   1> lazbuild."`date +%Y%m%d_%H%M%S`".log.txt   2> lazbuild."`date +%Y%m%d_%H%M%S`".error.log.txt
  11.         if [ -e bin/project1 ]
  12.         then
  13.                 echo lazbuild bin/project1 OK
  14.                 exit 0
  15.         else
  16.                 echo attempt $i failed: $?
  17.         fi
  18. done
  19.  
« Last Edit: January 17, 2019, 09:47:17 pm by valdir.marcos »

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #21 on: February 15, 2019, 10:05:28 am »
Here are two slightly different logs. Moreover - once I've seen this error without Jenkins.

Lazarus 2.0RC3, Mac OS X Mojave 10.14.3

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #22 on: February 15, 2019, 10:38:51 am »
And I've got just same error with lazbuild in Mac OS Terminal right now! It has more info:
Quote
An unhandled exception occurred at $0001B943:
EAccessViolation: Access violation
  $0001B943
  $005C6334
  $005C7703
  $0002CB46

TProject.DoLoadStateFile Statefile not found: /Users/Administrator/Build/dcu/i386-darwin/bssPluginHost.compiled
An unhandled exception occurred at $000CD0F1:
EAccessViolation: Access violation
  $000CD0F1
  $000D1C8B
  $005DA155
  $005D9525
  $001B3AE2
  $00014881
  $00013AA5
  $000120E6
  $00017986

Marked memory at $042C5BA0 invalid
Wrong signature $AAAAAAAA instead of 4A31CCE6
« Last Edit: February 15, 2019, 11:26:00 am by Arvur »

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #23 on: February 15, 2019, 11:25:05 am »
And Call Stack from lazbuild ran in IDE:
Quote
#0 FPC_CHECK_OBJECT_EXT at :-1
#1 SETTHREAD(0x07745f60, 0x00000000) at exttools.pas:403
#2 SETTOOL(0x0764b030, 0x00000000) at exttools.pas:1307
#3 DESTROY(0x0764b030, 0x00000001) at exttools.pas:1596
#4 SYSTEM$_$TOBJECT_$__$$_FREE at :-1
#5 CLASSES_$$_THREADFUNC$POINTER$$LONGINT at :-1
#6 CTHREADS_$$_THREADMAIN$POINTER$$POINTER at :-1
#7 _pthread_body at :-1
#8 _pthread_start at :-1
#9 thread_start at :-1

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #24 on: February 15, 2019, 12:03:34 pm »
Upgraded to Lazarus 2.0 Release. The problem is still here (((
« Last Edit: February 15, 2019, 12:13:28 pm by Arvur »

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #25 on: February 26, 2019, 12:50:03 pm »
I've found the reason :o It is relative(?) path to unit in lpr-file uses clause:
Code: Pascal  [Select]
  1. uses
  2.   Interfaces,
  3.   Unit1 in '..\..\<Path>\Unit1.pas',
  4.   Unit2;
  5.  
This bug is not stable. But with 100+ paths in lpr it fails always! :D

valdir.marcos

  • Hero Member
  • *****
  • Posts: 648
Re: Lazbuild EAccessViolation
« Reply #26 on: March 14, 2019, 03:08:50 am »
I've found the reason :o It is relative(?) path to unit in lpr-file uses clause:
Code: Pascal  [Select]
  1. uses
  2.   Interfaces,
  3.   Unit1 in '..\..\<Path>\Unit1.pas',
  4.   Unit2;
  5.  
This bug is not stable. But with 100+ paths in lpr it fails always! :D
I have created a new simple project (attached) with 100+ forms on a 10-level deep path and it's not enough to confirm your report.
I have build it successfully on Windows with command:
Code: Text  [Select]
  1. C:\lazarus>c:\lazarus\lazbuild.exe  --lazarusdir=c:\lazarus\  --verbose  --verbose-pkgsearch  -B  C:\teste\Project_Lazbuild_EAccessViolation2\project1.lpi

The only difference, I have realized so far is LPR file does not show path information for units:
Code: Pascal  [Select]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Interfaces, // this includes the LCL widgetset
  10.   Forms, Unit1, Unit2, Unit3, Unit4, Unit5, Unit6, Unit7, Unit8, Unit9, Unit10,
  11.   Unit11, Unit12, Unit13, Unit14, Unit15, Unit16, Unit17, Unit18, Unit19,
  12.   Unit20, Unit21, Unit22, Unit23, Unit24, Unit25, Unit26, Unit27, Unit28,
  13.   Unit29, Unit30, Unit31, Unit32, Unit33, Unit34, Unit35, Unit36, Unit37,
  14.   Unit38, Unit39, Unit40, Unit41, Unit42, Unit43, Unit44, Unit45, Unit46,
  15.   Unit47, Unit48, Unit49, Unit50, Unit51, Unit52, Unit53, Unit54, Unit55,
  16.   Unit56, Unit57, Unit58, Unit59, Unit60, Unit61, Unit62, Unit63, Unit64,
  17.   Unit65, Unit66, Unit67, Unit68, Unit69, Unit70, Unit71, Unit72, Unit73,
  18.   Unit74, Unit75, Unit76, Unit77, Unit78, Unit79, Unit80, Unit81, Unit82,
  19.   Unit83, Unit84, Unit85, Unit86, Unit87, Unit88, Unit89, Unit90, Unit91,
  20.   Unit92, Unit93, Unit94, Unit95, Unit96, Unit97, Unit98, Unit99, Unit100,
  21.   Unit101, Unit102, Unit103, Unit104, Unit105, Unit106, Unit107, Unit108,
  22.   Unit109, Unit110, Unit111, Unit112, Unit113, Unit114, Unit115, Unit116,
  23.   Unit117, Unit118, Unit119, Unit120, Unit121
  24.   { you can add units after this };
  25.  
  26. {$R *.res}
  27.  
  28. begin
  29.   RequireDerivedFormResource := True;
  30.   Application.Initialize;
  31.   Application.CreateForm(TForm1, Form1);
  32.   ...
  33.   Application.CreateForm(TForm121, Form121);
  34.   Application.Run;
  35. end.



But both LPI and LPS do:
Code: XML  [Select]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CONFIG>
  3.   <ProjectOptions>
  4.     <Version Value="10"/>
  5.     <PathDelim Value="\"/>
  6.     <General>
  7.       <SessionStorage Value="InProjectDir"/>
  8.       <MainUnit Value="0"/>
  9.       <Title Value="project1"/>
  10.       <ResourceType Value="res"/>
  11.       <UseXPManifest Value="True"/>
  12.       <Icon Value="0"/>
  13.     </General>
  14.     <VersionInfo>
  15.       <StringTable ProductVersion=""/>
  16.     </VersionInfo>
  17.     <BuildModes Count="1">
  18.       <Item1 Name="Default" Default="True"/>
  19.     </BuildModes>
  20.     <PublishOptions>
  21.       <Version Value="2"/>
  22.     </PublishOptions>
  23.     <RunParams>
  24.       <local>
  25.         <FormatVersion Value="1"/>
  26.       </local>
  27.     </RunParams>
  28.     <RequiredPackages Count="1">
  29.       <Item1>
  30.         <PackageName Value="LCL"/>
  31.       </Item1>
  32.     </RequiredPackages>
  33.     <Units Count="122">
  34.       <Unit0>
  35.         <Filename Value="project1.lpr"/>
  36.         <IsPartOfProject Value="True"/>
  37.       </Unit0>
  38.       <Unit1>
  39.         <Filename Value="unit1.pas"/>
  40.         <IsPartOfProject Value="True"/>
  41.         <ComponentName Value="Form1"/>
  42.         <ResourceBaseClass Value="Form"/>
  43.         <UnitName Value="Unit1"/>
  44.       </Unit1>
  45.       <Unit2>
  46.         <Filename Value="folder01\folder02\folder03\folder04\folder05\folder06\folder07\folder08\folder09\folder10\unit2.pas"/>
  47.         <IsPartOfProject Value="True"/>
  48.         <ComponentName Value="Form2"/>
  49.         <ResourceBaseClass Value="Form"/>
  50.         <UnitName Value="Unit2"/>
  51.       </Unit2>
  52.       <Unit3>
  53.         <Filename Value="folder01\folder02\folder03\folder04\folder05\folder06\folder07\folder08\folder09\folder10\unit3.pas"/>
  54.      
  55.       ...
  56.      
  57.       <Unit121>
  58.         <Filename Value="folder01\folder02\folder03\folder04\folder05\folder06\folder07\folder08\folder09\folder10\unit121.pas"/>
  59.         <IsPartOfProject Value="True"/>
  60.         <ComponentName Value="Form121"/>
  61.         <ResourceBaseClass Value="Form"/>
  62.         <UnitName Value="Unit121"/>
  63.       </Unit121>
  64.     </Units>
  65.   </ProjectOptions>
  66.   <CompilerOptions>
  67.     <Version Value="11"/>
  68.     <PathDelim Value="\"/>
  69.     <Target>
  70.       <Filename Value="project1"/>
  71.     </Target>
  72.     <SearchPaths>
  73.       <IncludeFiles Value="$(ProjOutDir)"/>
  74.       <OtherUnitFiles Value="folder01\folder02\folder03\folder04\folder05\folder06\folder07\folder08\folder09\folder10"/>
  75.       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
  76.     </SearchPaths>
  77.     <Linking>
  78.       <Options>
  79.         <Win32>
  80.           <GraphicApplication Value="True"/>
  81.         </Win32>
  82.       </Options>
  83.     </Linking>
  84.   </CompilerOptions>
  85.   <Debugging>
  86.     <Exceptions Count="3">
  87.       <Item1>
  88.         <Name Value="EAbort"/>
  89.       </Item1>
  90.       <Item2>
  91.         <Name Value="ECodetoolError"/>
  92.       </Item2>
  93.       <Item3>
  94.         <Name Value="EFOpenError"/>
  95.       </Item3>
  96.     </Exceptions>
  97.   </Debugging>
  98. </CONFIG>



Code: Pascal  [Select]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CONFIG>
  3.   <ProjectSession>
  4.     <PathDelim Value="\"/>
  5.     <Version Value="10"/>
  6.     <BuildModes Active="Default"/>
  7.     <Units Count="122">
  8.       <Unit0>
  9.         <Filename Value="project1.lpr"/>
  10.         <IsPartOfProject Value="True"/>
  11.         <IsVisibleTab Value="True"/>
  12.         <TopLine Value="4"/>
  13.         <CursorPos X="20" Y="14"/>
  14.         <UsageCount Value="20"/>
  15.         <Loaded Value="True"/>
  16.       </Unit0>
  17.       <Unit1>
  18.         <Filename Value="unit1.pas"/>
  19.         <IsPartOfProject Value="True"/>
  20.         <ComponentName Value="Form1"/>
  21.         <HasResources Value="True"/>
  22.         <ResourceBaseClass Value="Form"/>
  23.         <UnitName Value="Unit1"/>
  24.         <EditorIndex Value="1"/>
  25.         <TopLine Value="17"/>
  26.         <CursorPos X="23" Y="34"/>
  27.         <UsageCount Value="20"/>
  28.         <Loaded Value="True"/>
  29.         <LoadedDesigner Value="True"/>
  30.       </Unit1>
  31.       <Unit2>
  32.         <Filename Value="folder01\folder02\folder03\folder04\folder05\folder06\folder07\folder08\folder09\folder10\unit2.pas"/>
  33.         <IsPartOfProject Value="True"/>
  34.         <ComponentName Value="Form2"/>
  35.         <HasResources Value="True"/>
  36.         <ResourceBaseClass Value="Form"/>
  37.         <UnitName Value="Unit2"/>
  38.         <EditorIndex Value="2"/>
  39.         <UsageCount Value="20"/>
  40.         <Loaded Value="True"/>
  41.         <LoadedDesigner Value="True"/>
  42.       </Unit2>
  43.      
  44.       ...
  45.      
  46.       <Unit121>
  47.         <Filename Value="folder01\folder02\folder03\folder04\folder05\folder06\folder07\folder08\folder09\folder10\unit121.pas"/>
  48.         <IsPartOfProject Value="True"/>
  49.         <ComponentName Value="Form121"/>
  50.         <HasResources Value="True"/>
  51.         <ResourceBaseClass Value="Form"/>
  52.         <UnitName Value="Unit121"/>
  53.         <EditorIndex Value="121"/>
  54.         <UsageCount Value="20"/>
  55.         <Loaded Value="True"/>
  56.         <LoadedDesigner Value="True"/>
  57.       </Unit121>
  58.     </Units>
  59.     <JumpHistory HistoryIndex="-1"/>
  60.   </ProjectSession>
  61. </CONFIG>



This bug is not stable. But with 100+ paths in lpr it fails always! :D
Can you provide a simple sample project that shows that error?

valdir.marcos

  • Hero Member
  • *****
  • Posts: 648
Re: Lazbuild EAccessViolation
« Reply #27 on: March 14, 2019, 07:34:37 am »
Your backtrace looks like there is no debug info.
Does the problem happen only with a certain program? Then you should upload it here to be tested.
Juha, when I put "--version" on a Lazbuild command, it just shows the version of Lazbuild ignoring all the rest.
Should this be the expected behaviour?
Code: Text  [Select]
  1. C:\lazarus>c:\lazarus\lazbuild.exe  --version  --lazarusdir=c:\lazarus\  --verbose  --verbose-pkgsearch  -B  C:\teste\Project_Lazbuild_EAccessViolation2\project1.lpi

But without the "--version", the command works properly:
Code: Text  [Select]
  1. C:\lazarus>c:\lazarus\lazbuild.exe  --lazarusdir=c:\lazarus\  --verbose  --verbose-pkgsearch  -B  C:\teste\Project_Lazbuild_EAccessViolation2\project1.lpi

Arvur

  • New member
  • *
  • Posts: 38
    • My GitHub
Re: Lazbuild EAccessViolation
« Reply #28 on: March 14, 2019, 03:47:15 pm »
I have build it successfully on Windows
I've never seen this error on Windows. Mac OS X only!

The only difference, I have realized so far is LPR file does not show path information for units:
The main point is paths in lpr )) When I remove them all works fine on Mac OS too.

Can you provide a simple sample project that shows that error?
I did not manage to reproduce it on an clean empty project. One hundred units with paths in lpr and empty search path in lpi, some uses, relative folders and... it still works. There must be something else.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3581
  • I like bugs.
Re: Lazbuild EAccessViolation
« Reply #29 on: March 15, 2019, 02:02:13 am »
Juha, when I put "--version" on a Lazbuild command, it just shows the version of Lazbuild ignoring all the rest.
Should this be the expected behaviour?
Yes, that's how it is implemented. TLazBuildApplication.ParseParameters has:
Code: Pascal  [Select]
  1. if HasOption('v','version') then begin
  2.   writeln(VersionStr);
  3.   exit;
  4. end;
It could be changed if needed, but would it make sense?
You don't need the version when actually building something.