Recent

Author Topic: diff between Ubuntu's FPC and 'ours'.  (Read 2038 times)

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
diff between Ubuntu's FPC and 'ours'.
« on: February 29, 2020, 08:20:28 am »
I see a very strange issue with the tests I have been running on the Beta of Ubuntu 20.04

If I compile my app with the FPC 3.0.4 from the ubuntu repository (be it the U18.04 or U20.04) it works as expected.
But if I compile with the FPC 3.0.4 from the Lazarus Sourceforge repo that compiled app will have a little exception at exit when running on U20.04, no problems on earlier distros.

The only combination that I see this crash on is Built Using SourceForge Compiler AND Run on U20.04.

I have built two VMs (one based on U18.04, one on the beta U20.04) and compiled with both compilers on each, this pattern is quite repeatable.

And the crash itself is just as mystifying, see here I have put a couple of debug lines in the FormDestroy handler for the major forms -

Code: [Select]
Close syncform
Close searchform
Close settform
Closing main form
Heap dump by heaptrc unit
21135 memory blocks allocated : 2615144/2661792
21135 memory blocks freed     : 2615144/2661792
0 unfreed memory blocks : 0
True heap size : 393216
True free heap : 393216
An unhandled exception occurred at $00007F1FADCC1073:
EAccessViolation:
  $00007F1FADCC1073

Did you spot it ?  The crash apparently has happened AFTER heaptrc has counted up all the memory !

And yes, same crash if HeapTRC is turned off. No sign of a problem if I use Qt5. No sign of it using FPC 3.2.0

I have tried some simpler apps and no sign of this pattern so its must be being triggered off by may code somewhere but I have no idea where !   Any suggestions on what to try next ??

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: diff between Ubuntu's FPC and 'ours'.
« Reply #1 on: February 29, 2020, 02:20:32 pm »
run app in gdb and try to get a backtrace (might be as simple as gdb ./app and wait till it crashes, or "bt" after it crashes)

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: diff between Ubuntu's FPC and 'ours'.
« Reply #2 on: February 29, 2020, 02:43:56 pm »
AFAIR there was some problems with some versions of glibc (dynlibs unloading or something like that).

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: diff between Ubuntu's FPC and 'ours'.
« Reply #3 on: March 01, 2020, 11:56:31 pm »
run app in gdb and try to get a backtrace (might be as simple as gdb ./app and wait till it crashes, or "bt" after it crashes)

OK, here is the result, I have left my debug messages in the screen scrap to show were its happening, again, its after all the Lazarus forms have closed, after the heaptrace report.
Code: Pascal  [Select][+][-]
  1. Close syncform
  2. Close searchform
  3. Close settform
  4. [Thread 0x7ffff4ffc700 (LWP 2763) exited]
  5. Closing main form
  6. Heap dump by heaptrc unit
  7. 21032 memory blocks allocated : 2587412/2633760
  8. 21032 memory blocks freed     : 2587412/2633760
  9. 0 unfreed memory blocks : 0
  10. True heap size : 393216
  11. True free heap : 393216
  12.  
  13. Thread 1 "tomboy-ng" received signal SIGSEGV, Segmentation fault.
  14. 0x00007ffff43fd073 in ?? () from /lib/x86_64-linux-gnu/librsvg-2.so.2
  15. (gdb) bt
  16. #0  0x00007ffff43fd073 in  () at /lib/x86_64-linux-gnu/librsvg-2.so.2
  17. #1  0x00007ffff74285cf in __GI___call_tls_dtors () at cxa_thread_atexit_impl.c:155
  18. #2  0x00007ffff7427d1d in __run_exit_handlers (status=0, listp=0x7ffff75c8718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=
  19.     true, run_dtors=run_dtors@entry=true) at exit.c:46
  20. #3  0x00007ffff7427d70 in __GI_exit (status=<optimised out>) at exit.c:139
  21. #4  0x00007ffff74051ea in __libc_start_main (main=0x7fffffffdf10, argc=0, argv=
  22.     0x99e5d0 <VMT_$FORMS_$$_TAPPLICATION>, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0xfd126709af25e279)
  23.     at ../csu/libc-start.c:342
  24. #5  0xfd127676b26be279 in  ()
  25. #6  0xfd126709af25e279 in  ()
  26. #7  0x0000000000000000 in  ()
  27. (gdb)

My code does not use any svg capabilities explicitly but I guess there is some in the Lazarus icon handling code ?  The backtrace seems (to my uneducated eyes) to point to something going wrong with the threads at exit. Now, my app has no running extra threads at this stage, the problem seems all up stream.  But just how far up stream ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: diff between Ubuntu's FPC and 'ours'.
« Reply #4 on: March 02, 2020, 08:04:09 am »
Can you rebuild Lazarus without any optimizations enabled (-O- option to disable all optimizations)?

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: diff between Ubuntu's FPC and 'ours'.
« Reply #5 on: March 02, 2020, 08:30:01 am »
yeah, sure Cyrax.

I was just heading back to here to mention I have just realized that Lazarus it self is dropping core on exit. So its just a bit more serious.

Cyrax, the -O- switch, I am guessing that's an edit of the Makefile ?  Can you save me scrolling through the 3.5k lines of Makefile and point me to just where that edit is, please ?

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: diff between Ubuntu's FPC and 'ours'.
« Reply #6 on: March 02, 2020, 09:40:03 am »
Cyrax, the -O- switch, I am guessing that's an edit of the Makefile ?  Can you save me scrolling through the 3.5k lines of Makefile and point me to just where that edit is, please ?

Unless something's been changed recently you should be able to do something like

Code: [Select]
make OPT='-O-' all

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: diff between Ubuntu's FPC and 'ours'.
« Reply #7 on: March 02, 2020, 10:09:06 am »
Yep, thanks Mark, that built so I assume its been passed through to fpc, hmm, should I ?

Anyway, it does not appear to have made a difference.  Still get a big crash when I exit out of Lazarus, I have not tried, yet, to build my app, need to resolve some dependencies first.  Here is the console output when Lazarus is closed -

Code: [Select]
bannon@Focal-VirtualBox:~/bin/Lazarus/fixes_2_0$ ~/bin/start-laz-fixes
SetPrimaryConfigPath NewValue="~/.fixes_2_0" -> "/home/dbannon/.fixes_2_0"
Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] PrimaryConfigPath="/home/dbannon/.fixes_2_0"
Hint: (lazarus) [TMainIDE.ParseCmdLineOptions] SecondaryConfigPath="/etc/lazarus"
Looking for code tools config file:  "/home/dbannon/.fixes_2_0/codetoolsoptions.xml"
NOTE: codetools config file not found - using defaults
Hint: (lazarus) [TBuildManager.SetBuildTarget] Old=x86_64-linux-gtk2 New=x86_64-linux-gtk2 Changed: OS/CPU=True LCL=False
NOTE: help options config file not found - using defaults
LAZARUS END - cleaning up ...
Hint: (lazarus) [TMainIDE.Destroy] B  -> inherited Destroy... TMainIDE
Hint: (lazarus) [TMainIDE.Destroy] END
/home/dbannon/bin/start-laz-fixes: line 3:  5824 Segmentation fault      (core dumped) ./lazarus --pcp=~/.fixes_2_0

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018