View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0030637 | FPC | Documentation | public | 2016-09-24 01:52 | 2016-12-04 12:05 |
Reporter | Benito van der Zander | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.1.1 | ||||
Target Version | 3.0.2 | ||||
Summary | 0030637: heaptrc crashes after killing exception | ||||
Description | heaptrc crashes after killing exception: program Project1; {$mode objfpc}{$H+} uses heaptrc, sysutils; begin raise exception.create('a'); end. causes a segmentation fault in SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR 0000000000418540 53 push %rbx 0000000000418541 4889fb mov %rdi,%rbx 0000000000418544 488d3d35822600 lea 0x268235(%rip),%rdi # 0x680780 <U_$SYSTEM_$$_HEAP_LOCK> 000000000041854B e8f00c0000 callq 0x419240 <SYSTEM_$$_ENTERCRITICALSECTION$TRTLCRITICALSECTION> 0000000000418550 4889d8 mov %rbx,%rax 0000000000418553 488b5008 mov 0x8(%rax),%rdx 0000000000418557 488b92b8000000 mov 0xb8(%rdx),%rdx <-------------------------- 000000000041855E 48895018 mov %rdx,0x18(%rax) 0000000000418562 488b5008 mov 0x8(%rax),%rdx 0000000000418566 488982b8000000 mov %rax,0xb8(%rdx) 000000000041856D 488d3d0c822600 lea 0x26820c(%rip),%rdi # 0x680780 <U_$SYSTEM_$$_HEAP_LOCK> 0000000000418574 e8070d0000 callq 0x419280 <SYSTEM_$$_LEAVECRITICALSECTION$TRTLCRITICALSECTION> 0000000000418579 5b pop %rbx 000000000041857A c3 retq 000000000041857B 0000 add %al,(%rax) 000000000041857D 0000 add %al,(%rax) 000000000041857F 00 add %dl,0x41(%rbx) #0 SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR at :0 0000001 U_$SYSTEM_$$_FREELISTS at :0 0000002 SYSTEM_$$_SYSFREEMEM_VAR$PFREELISTS$PMEMCHUNK_VAR$$QWORD at :0 0000003 ?? at :0 0000004 ?? at :0 | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
has duplicate | 0031069 | closed | Michael Van Canneyt | Heaptrc documentation is wrong. |
|
Hi, could you please specify: - the OS you are using? - the exact compilation parameters. I figured from the text above that the cpu is x86_64, I tried your code both on win64 and linux, and did not see your problem. Your problem might originate from options present in your free pascal compiler configuration files, thus the best would be to find explicit command line parameters that trigger your problem using the -n option, which prevents reading of any configuration file. Note that you will need to explicitly add location of compiled RTL units using: -Fu/full/path/to/compiled/rtl/units/ of course after substitution. Please report impacted OS and provide full command line options with -n that reproduces your problem. Thanks in advance, |
|
$ fpc -n -Fu/home/benito/opt/fpc-trunk/rtl/units/x86_64-linux/ -gl project1.lpr benito@hostname:/tmp$ gdb project1 GNU gdb (Debian 7.11.1-2) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... wtf=============end===========Reading symbols from project1...done. (gdb) r Starting program: /tmp/project1 An unhandled exception occurred at $0000000000400209: Exception: a $0000000000400209 main, line 8 of project1.lpr Heap dump by heaptrc unit 26 memory blocks allocated : 28126/28160 15 memory blocks freed : 1989/2016 11 unfreed memory blocks : 26137 True heap size : 425984 True free heap : 398112 Should be : 398432 Call trace for block $00007FFFF7FA2600 size 32 Program received signal SIGSEGV, Segmentation fault. 0x0000000000418557 in SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR () |
|
Bug confirmed, and tracked down partially: revert rtl/inc/lnfodwf.pp to revision 33227, i.e. before a series of additions to handle more dwarf debug information, fixes this crash. I will ask Florian, you wrote all commits to this file since that revision to take a look. Pierre |
|
Using explicitly the heaptrc unit is no supported. Compile with -gh instead and everything works fine. |
|
But the uses clause is the recommended usage: http://www.freepascal.org/docs-html/rtl/heaptrc/usage.html And with -gh you cannot make a copy of the unit to change the constants. I use heaptrc with tracesize set to 48 |
|
That's probably a documentation issue where obviously the documentation contradicts itself. But anyway you can make changes to a copy of heaptrc and make sure it is in your project directory and perform a build all. -B What I really don't like is that you intentionally change code there and then start complaining... You should not do that. That's a whole different kind of bug report. In your case you should start with: I changed the heaptrc unit to accommodate a depth of 48 and now it no longer works.... It is rather far fetched to assume devs can debug a changed unit for you. That's beginners error and you know better. (I make the same irritating beginners errors, btw) And btw: with -B -gh the correct -your heaptrc- unit will be compiled in. |
|
I do not use the modified unit right now, because it is too slow. It is, I use uses heaptrc; till there is a leak, then I change it to uses heaptrc48; to fix the leak, and then change it back |
|
> http://www.freepascal.org/docs-html/rtl/heaptrc/usage.html Those are 3.0.0 docs, you are using 3.1.1. Decoding dwarf debugging info efficiently requires a working heap manager and this means that heaptrc needs to be loaded before the the dwarf line info decoding unit which is loaded by -gl, so heaptrc cannot be used explicitly. Docs need to be changed for the 3.2 series to reflect this. |
|
Docs for 3.0.2 already reflect this. If you use heaptrc directly, all kinds of strange things will happen. |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-09-24 01:52 | Benito van der Zander | New Issue | |
2016-09-24 09:26 | Pierre Muller | Note Added: 0094795 | |
2016-09-24 09:26 | Pierre Muller | Assigned To | => Pierre Muller |
2016-09-24 09:26 | Pierre Muller | Status | new => feedback |
2016-09-24 10:59 | Benito van der Zander | Note Added: 0094796 | |
2016-09-24 10:59 | Benito van der Zander | Status | feedback => assigned |
2016-09-24 17:06 | Pierre Muller | Note Added: 0094799 | |
2016-09-24 17:06 | Pierre Muller | Status | assigned => confirmed |
2016-10-15 18:56 | Florian | Note Added: 0095177 | |
2016-10-15 18:56 | Florian | Status | confirmed => resolved |
2016-10-15 18:56 | Florian | Resolution | open => no change required |
2016-10-16 15:50 | Benito van der Zander | Note Added: 0095187 | |
2016-10-16 15:50 | Benito van der Zander | Status | resolved => feedback |
2016-10-16 15:50 | Benito van der Zander | Resolution | no change required => reopened |
2016-10-16 17:12 | Thaddy de Koning | Note Added: 0095188 | |
2016-10-16 17:15 | Thaddy de Koning | Note Edited: 0095188 | View Revisions |
2016-10-16 17:17 | Thaddy de Koning | Note Edited: 0095188 | View Revisions |
2016-10-16 17:18 | Thaddy de Koning | Note Edited: 0095188 | View Revisions |
2016-10-16 17:21 | Thaddy de Koning | Note Edited: 0095188 | View Revisions |
2016-10-16 17:49 | Benito van der Zander | Note Added: 0095189 | |
2016-10-16 17:49 | Benito van der Zander | Status | feedback => assigned |
2016-10-16 18:20 | Florian | Note Added: 0095190 | |
2016-10-16 18:20 | Florian | Category | RTL => Documentation |
2016-10-16 18:20 | Florian | Description Updated | View Revisions |
2016-10-16 18:22 | Florian | Assigned To | Pierre Muller => Michael Van Canneyt |
2016-10-16 18:22 | Florian | Target Version | => 3.2.0 |
2016-11-12 23:49 | Michael Van Canneyt | Note Added: 0095811 | |
2016-11-12 23:49 | Michael Van Canneyt | Status | assigned => resolved |
2016-11-12 23:49 | Michael Van Canneyt | Resolution | reopened => fixed |
2016-11-12 23:49 | Michael Van Canneyt | Target Version | 3.2.0 => 3.0.2 |
2016-12-04 12:05 | Michael Van Canneyt | Relationship added | has duplicate 0031069 |