View Issue Details

IDProjectCategoryView StatusLast Update
0036959LazarusUtilitiespublic2020-06-06 11:01
Reportersuve Assigned To 
PrioritynormalSeverityminorReproducibilityrandom
Status newResolutionopen 
Platformx86_64, aarch64, armv7hlOSLinux 
Product Version2.0.8 
Summary0036959: LazBuild crashes with --recursive builds
DescriptionEdited by Juha:
The original summary was "Random access violations while trying to build LazPaint" which was a duplicate for 0036318.
This issue is now reserved for --recursive builds crash.
---

I'm trying to build LazPaint (https://github.com/bgrabitmap/lazpaint/) for Fedora. In the distro's development environment, we use FPC 3.2.0-beta (svn revision 44680) and Lazarus 2.0.8.

The builds fail randomly with an EAccessViolation. There isn't any pattern I could spot, as just re-trying the build immediately without any changes would often result in a successful build. The aarch64 build also sometimes throws an EBusError.

I have attached the build logs, though I imagine that by themselves, they aren't immensely helpful. I'll be happy to follow any steps that might help pinpoint the issue.

The aarch64 build log is larger because I'm building LazPaint twice - once using GTK2, and once using Qt4. The x86_64 and armv7hl builds failed while building the gtk2 version, while aarch64 succeeded in building the gtk2 version and died while building the qt one.
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Relationships

related to 0036318 assignedJuha Manninen lazbuild crashes when compiling packages 
related to 0037179 assignedMattias Gaertner [lazbuild] [patch] Lazbuild randomly aborts project building process. 

Activities

suve

2020-04-23 16:59

reporter  

lazpaint-x86_64.log (766,664 bytes)
lazpaint-armv7hl.log (763,819 bytes)
lazpaint-aarch64.log (1,576,718 bytes)

Alfred

2020-04-23 17:45

reporter   ~0122367

This is not a FPC problem.
See: https://bugs.freepascal.org/view.php?id=36318
You use lazbuild. And that is the cause of this problem.

If you are able to reproduce this problem, you could be very helpfull in solving it !

suve

2020-04-23 18:43

reporter   ~0122368

Oh blimey, you're right. I tried "gdb fpc" and it reported that there's no symbols at the addresses. With "gdb lazbuild", the addresses make sense. Time for some debugging.

Alfred

2020-04-24 08:39

reporter   ~0122374

Would you mind trying this patch for Lazarus ?
On my systems, no crash anymore.
exttools.patch (953 bytes)   
Index: ide/exttools.pas
===================================================================
--- ide/exttools.pas	(revision 63052)
+++ ide/exttools.pas	(working copy)
@@ -1222,8 +1222,7 @@
       raise Exception.Create('TExternalTools.Destroy some tools still running');
     if ExternalToolList=Self then
       ExternalToolList:=nil;
-    if ExternalTools=Self then
-      ExternalTools:=nil;
+    if ExternalTools<>Self then
     inherited Destroy;
     FreeAndNil(fRunning);
     FreeAndNil(fParsers);
@@ -1231,6 +1230,8 @@
     LeaveCriticalSection;
   end;
   DoneCriticalsection(FCritSec);
+  if ExternalTools=Self then
+    inherited Destroy;
 end;
 
 function TExternalTools.Add(Title: string): TAbstractExternalTool;
@@ -1378,7 +1379,7 @@
 begin
   if FTool=AValue then Exit;
   if FTool<>nil then
-    FTool.Thread:=nil;
+    FTool.FThread:=nil;
   FTool:=AValue;
   if FTool<>nil then
     FTool.Thread:=Self;
exttools.patch (953 bytes)   

suve

2020-04-24 13:04

reporter   ~0122378

Yes, after applying the patch, the crashes stop - though I've had some problems with lazbuild failing while building lazbuild.

One thing I've noticed during the lazbuild-rebuilds is that the crashes occurred only when performing --recursive builds; without that option, the rebuilds never crashed. I'll try to investigate if there's some corner-case related to recursive builds.

Juha Manninen

2020-04-25 12:09

developer   ~0122407

suve, please see my edits for Description.
Please follow the ExternalTool bug and patch in the related issue.
I understood you could reproduce the problem more often than others, making you an important tester.

Issue History

Date Modified Username Field Change
2020-04-23 16:59 suve New Issue
2020-04-23 16:59 suve File Added: lazpaint-x86_64.log
2020-04-23 16:59 suve File Added: lazpaint-armv7hl.log
2020-04-23 16:59 suve File Added: lazpaint-aarch64.log
2020-04-23 17:45 Alfred Note Added: 0122367
2020-04-23 18:43 suve Note Added: 0122368
2020-04-23 20:14 Jonas Maebe Project FPC => Lazarus
2020-04-23 23:51 Maxim Ganetsky Category Compiler => Utilities
2020-04-23 23:51 Maxim Ganetsky Product Version => 2.0.8
2020-04-23 23:51 Maxim Ganetsky LazTarget => -
2020-04-23 23:53 Maxim Ganetsky Relationship added related to 0036318
2020-04-24 08:39 Alfred Note Added: 0122374
2020-04-24 08:39 Alfred File Added: exttools.patch
2020-04-24 13:04 suve Note Added: 0122378
2020-04-25 12:06 Juha Manninen Summary Random access violations while trying to build LazPaint => LazBuild crashes with --recursive builds
2020-04-25 12:06 Juha Manninen Description Updated View Revisions
2020-04-25 12:09 Juha Manninen Note Added: 0122407
2020-06-06 11:01 Juha Manninen Relationship added related to 0037179