Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-09

lazarus 1.6+fpc 2.6.4, win32, crashes in iphtml.pas

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

Hello,

I'm playing with lazarus 1.6 (a bit late, I know) with fpc 2.6.4, win32, and I have a strange problem with the ide:
the object inspector information box shows nothing and, eventually, when I click on fields in the object inspector, lazarus becomes unresponsive and then crashes.
If try to begug the ide under lazarus (tried both with the old 1.4.4 and the new 1.6), I see that it crashes in the heap manager (heap.inc) when it tries to allocate 1117978624 bytes (!)
This is the call stack:

#0 HANDLEERRORADDRFRAME(-1, 0x7c9201e0, 0x7c91e920) at D:\fpc-2.6.4\rtl\inc\system.inc:962
#1 HANDLEERRORFRAME(203, 0x10f6f92c) at D:\fpc-2.6.4\rtl\inc\system.inc:992 #2 HANDLEERROR(203) at D:\fpc-2.6.4\rtl\inc\system.inc:1002 #3 ALLOC_OSCHUNK(0x17619c4, 0, 1117978624) at
D:\fpc-2.6.4\rtl\inc\heap.inc:833
#4 SYSGETMEM_VAR(1117973760) at D:\fpc-2.6.4\rtl\inc\heap.inc:1006 #5 SYSGETMEM(1117973760) at D:\fpc-2.6.4\rtl\inc\heap.inc:1050 #6 GETMEM(0x1b, 1117973745) at D:\fpc-2.6.4\rtl\inc\heap.inc:251 #7 NEWANSISTRING(1117973736) at D:\fpc-2.6.4\rtl\inc\astrings.inc:64 #8 FPC_TRUELY_ANSISTR_UNIQUE(0xfda683) at
D:\fpc-2.6.4\rtl\inc\astrings.inc:659
#9 fpc_ansistr_unique at D:\fpc-2.6.4\rtl\i386\i386.inc:1585 #10 UPPERCASE(0xfda683 #255#139'E'#152#137'E'#248#198'E'#224, 0xfda683 #255#139'E'#152#137'E'#248#198'E'#224) at
D:\fpc-2.6.4\rtl\objpas\sysutils\sysstr.inc:97
#11 TIPHTML__NEXTTOKEN(<error reading variable>) at iphtml.pas:5132 #12 TIPHTML__PARSEHEAD(0x154e04c0, <error reading variable>) at iphtml.pas:5451
#13 TIPHTML__PARSEHTML(<error reading variable>) at iphtml.pas:7474 #14 TIPHTML__PARSE(<error reading variable>) at iphtml.pas:7538 #15 TIPHTML__LOADFROMSTREAM(0x131e14c0, <error reading variable>) at iphtml.pas:4725
#16 TLAZIPHTMLCONTROL__SETHTMLCONTENT(0x131e14c0, 0x0, <error reading variable>) at ipidehtmlcontrol.pas:368
#17 TMAINIDE__OICHANGEDTIMERTIMER(0x1324fc48, <error reading variable>) at main.pp:11811
#18 TCUSTOMTIMER__DOONTIMER(<error reading variable>) at customtimer.pas:175 #19 TCUSTOMTIMER__TIMER(<error reading variable>) at customtimer.pas:150 #20 TIMERCALLBACKPROC(0, 275, 20158, 489829657) at .\win32\win32callback.inc:2773
#21 USER32!GetDC at :0
#22 ?? at :0

The strange things is the transition between #10 and #11, line 5132 of iphtml.pas *doesn't* call uppercase, it is

    ParmName := ParmString

and ParmString is

   function ParmString: string;
   begin
     if PBW = 0 then
       Result := ''
     else begin
       ParmBuf[PBW] := #0;
       Result := StrPas(ParmBuf);
       PBW := 0;
     end;
   end;

Maybe there's a stray pointer somewhere that messes up the stack? If I uninstall turbopower_ipro I get the plain text information box in the object inspector and no crashes.

If I run lazarus directly under gdb, I get a different backtrace (but still crashes in TIpHtml.ParseHead):

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 3692.0x340]
fpc_ansistr_decr_ref (S=0xfda682) at D:/fpc-2.6.4/rtl/i386/i386.inc:1542 1542 decl (%edx)
(gdb) bt
#0 fpc_ansistr_decr_ref (S=0xfda682) at D:/fpc-2.6.4/rtl/i386/i386.inc:1542 #1 0x10f6f810 in ?? ()
#2 0x00fdb714 in TIPHTML__PARSEHEAD (PARENT=0x13821af0, this=<error reading variable>) at iphtml.pas:5451
#3 0x00fe2865 in TIPHTML__PARSEHTML (this=<error reading variable>) at iphtml.pas:7474
#4 0x00fe2b96 in TIPHTML__PARSE (this=<error reading variable>) at iphtml.pas:7538
#5 0x00fd99fa in TIPHTML__LOADFROMSTREAM (S=0x1388c0c8, this=<error reading variable>) at iphtml.pas:4725
#6 0x01032007 in TLAZIPHTMLCONTROL__SETHTMLCONTENT (STREAM=0x1388c0c8, NEWURL=0x0, this=<error reading variable>) at ipidehtmlcontrol.pas:368 #7 0x00793a62 in DOHTML (parentfp=0x10f6fa84) at idehelpintf.pas:345 #8 0x00793913 in THINTWINDOWMANAGER__SHOWHINT (SCREENPOS=..., THEHINT=0x14ad8838 '<html><head><link rel="stylesheet" href="lazdoc://lazarus/lazdoc.css" type="text/css">'#13#10'<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"></head>'#13#10'<body>'#13#10'<div class="header"> <nobr>'..., this=<error reading variable>) at idehelpintf.pas:367 #9 0x00849258 in TSOURCEEDITORHINTWINDOWMANAGER__ACTIVATEHINT ( SCREENRECT=..., ABASEURL=0x138b56c 'lazdoc://',
AHINT=0x14ad8838 '<html><head><link rel="stylesheet" href="lazdoc://lazarus/lazdoc.css" type="text/css">'#13#10'<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"></head>'#13#10'<body>'#13#10'<div class="header"> <nobr>'..., AAUTOSHOWN=true, this=<error reading variable>) at sourceeditor.pp:1907
#10 0x0086589b in TSOURCEEDITORMANAGER__ACTIVATEHINT (SCREENRECT=..., BASEURL=0x138b56c 'lazdoc://',
THEHINT=0x14ad8838 '<html><head><link rel="stylesheet" href="lazdoc://lazaru
s/lazdoc.css" type="text/css">'#13#10'<meta http-equiv="Content-Type" content="t
ext/html; charset=utf-8"></head>'#13#10'<body>'#13#10'<div class="header"> <nob
r>'..., AUTOSHOWN=true, this=<error reading variable>) at sourceeditor.pp:10685
#11 0x0084dbf0 in TSOURCEEDITOR__ACTIVATEHINT (CLIENTRECT=..., ABASEURL=0x138b56c 'lazdoc://',
AHINT=0x14ad8838 '<html><head><link rel="stylesheet" href="lazdoc://lazarus/
lazdoc.css" type="text/css">'#13#10'<meta http-equiv="Content-Type" content="tex
t/html; charset=utf-8"></head>'#13#10'<body>'#13#10'<div class="header"> <nobr>
'..., AAUTOSHOWN=true, this=<error reading variable>) at sourceeditor.pp:3304
#12 0x00470cd8 in TMAINIDE__ONSRCNOTEBOOKSHOWHINTFORSOURCE ( SRCEDIT=0x128142c0, CARETPOS=..., AUTOSHOWN=true,
this=<error reading variable>) at main.pp:10818
#13 0x0086074a in TSOURCENOTEBOOK__SHOWSYNEDITHINT (MOUSEPOS=..., this=<error reading variable>) at sourceeditor.pp:8860 #14 0x00849745 in TSOURCEEDITORHINTWINDOWMANAGER__HINTTIMER ( SENDER=0x1337d598, this=<error reading variable>) at sourceeditor.pp:1991
#15 0x006009a3 in TCUSTOMTIMER__DOONTIMER (this=<error reading variable>) at customtimer.pas:175
#16 0x0060092a in TCUSTOMTIMER__TIMER (this=<error reading variable>) at customtimer.pas:150
#17 0x005581a0 in TIMERCALLBACKPROC (WINDOW_HWND=0, MSG=275, IDEVENT=18759, DWTIME=489955458) at ./win32/win32callback.inc:2773 #18 0x7e398734 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll #19 0x00000000 in ?? ()
(gdb)

I tried both 1.6 and the fixes_1_6 branch with the same result.

Under Linux, where I'm using fpc 3.0.0, I have no such problems.

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

El 29/09/16 a les 19:35, Luca Olivetti via Lazarus ha escrit:

Show quoted text 11 lines
Hello, I'm playing with lazarus 1.6 (a bit late, I know) with fpc 2.6.4, win32, and I have a strange problem with the ide: the object inspector information box shows nothing and, eventually, when I click on fields in the object inspector, lazarus becomes unresponsive and then crashes. If try to begug the ide under lazarus (tried both with the old 1.4.4 and the new 1.6), I see that it crashes in the heap manager (heap.inc) when it tries to allocate 1117978624 bytes (!) This is the call stack:

[snip]

FWIW, "transplanting" the version of turbopower_ipro from lazarus 1.4.4 to 1.6 (and defining html_print in its lpk otherwise it doesn't compile) "solves" this problem.

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

El 30/09/16 a les 11:15, Luca Olivetti via Lazarus ha escrit:

Show quoted text 18 lines
El 29/09/16 a les 19:35, Luca Olivetti via Lazarus ha escrit: > Hello, > > I'm playing with lazarus 1.6 (a bit late, I know) with fpc 2.6.4, win32, > and I have a strange problem with the ide: > the object inspector information box shows nothing and, eventually, when > I click on fields in the object inspector, lazarus becomes unresponsive > and then crashes. > If try to begug the ide under lazarus (tried both with the old 1.4.4 and > the new 1.6), I see that it crashes in the heap manager (heap.inc) when > it tries to allocate 1117978624 bytes (!) > This is the call stack: [snip] FWIW, "transplanting" the version of turbopower_ipro from lazarus 1.4.4 to 1.6 (and defining html_print in its lpk otherwise it doesn't compile) "solves" this problem.

I now found that the problem is with the directive

{$MODESWITCH NESTEDPROCVARS}.

If I compile the old turbopower_ipro with this directive (even if it doesn't need it) it doesn't work (the information box doesn't show anything, though I didn't manage to crash lazarus yet), while if I rewrite the new iphtml.pas in order to remove the directive it works OK.

A bug in fpc 2.6.4?

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Mattias Gaertner
to Luca Olivetti
Show quoted text 13 lines
[...] > FWIW, "transplanting" the version of turbopower_ipro from lazarus 1.4.4 > to 1.6 (and defining html_print in its lpk otherwise it doesn't compile) > "solves" this problem. I now found that the problem is with the directive {$MODESWITCH NESTEDPROCVARS}. If I compile the old turbopower_ipro with this directive (even if it doesn't need it) it doesn't work (the information box doesn't show anything, though I didn't manage to crash lazarus yet), while if I rewrite the new iphtml.pas in order to remove the directive it works OK.

Does that mean you will provide a patch to fix this?

A bug in fpc 2.6.4?

Maybe. Although it exists since 2.6.0.

Mattias

Reply by email

Ondrej Pokorny
to Luca Olivetti: El 30/09/16 a les 11:15, Luca Olivetti via Lazarus ha escrit: I now found that the…
Luca Olivetti wrote
If I compile the old turbopower_ipro with this directive (even if it doesn't need it) it doesn't work (the information box doesn't show anything, though I didn't manage to crash lazarus yet), while if I rewrite the new iphtml.pas in order to remove the directive it works OK.

Strange, there is no {$MODESWITCH NESTEDPROCVARS} directive in my Lazarus trunk\components\turbopower_ipro\iphtml.pas or any other file (except of one file in examples).

Ondrej

Reply by email

Luca Olivetti
to Ondrej Pokorny

El 30/09/16 a les 12:51, Ondrej Pokorny via Lazarus ha escrit:

Show quoted text 9 lines
On 30.09.2016 12:27, Luca Olivetti via Lazarus wrote: > If I compile the old turbopower_ipro with this directive (even if it > doesn't need it) it doesn't work (the information box doesn't show > anything, though I didn't manage to crash lazarus yet), while if I > rewrite the new iphtml.pas in order to remove the directive it works OK. Strange, there is no {$MODESWITCH NESTEDPROCVARS} directive in my Lazarus trunk\components\turbopower_ipro\iphtml.pas or any other file (except of one file in examples).

ipdefine.inc.

An it's not the only file using it:

lcl/grids.pas
components/lazdebuggergdbmi/gdbmidebugger.pp
components/debuggerintf/dbgintfdebuggerbase.pp
components/lazutils/lcsvutils.pas

Which could explain some other random crashes I saw

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Ondrej Pokorny
to Luca Olivetti
Luca Olivetti wrote 13 lines
El 30/09/16 a les 12:51, Ondrej Pokorny via Lazarus ha escrit: > On 30.09.2016 12:27, Luca Olivetti via Lazarus wrote: >> If I compile the old turbopower_ipro with this directive (even if it >> doesn't need it) it doesn't work (the information box doesn't show >> anything, though I didn't manage to crash lazarus yet), while if I >> rewrite the new iphtml.pas in order to remove the directive it works >> OK. > > Strange, there is no {$MODESWITCH NESTEDPROCVARS} directive in my > Lazarus trunk\components\turbopower_ipro\iphtml.pas or any other file > (except of one file in examples). ipdefine.inc.

Already fixed in trunk. See http://mantis.freepascal.org/view.php?id=29982

I'll add it to merge list for 1.6

Ondrej

Reply by email

Luca Olivetti
to Mattias Gaertner: On Fri, 30 Sep 2016 12:27:46 +0200 Does that mean you will provide a patch to fix this?…

El 30/09/16 a les 12:46, Mattias Gaertner via Lazarus ha escrit:

Show quoted text 18 lines
On Fri, 30 Sep 2016 12:27:46 +0200 Luca Olivetti via Lazarus wrote: > [...] >> FWIW, "transplanting" the version of turbopower_ipro from lazarus 1.4.4 >> to 1.6 (and defining html_print in its lpk otherwise it doesn't compile) >> "solves" this problem. > > I now found that the problem is with the directive > > {$MODESWITCH NESTEDPROCVARS}. > > If I compile the old turbopower_ipro with this directive (even if it > doesn't need it) it doesn't work (the information box doesn't show > anything, though I didn't manage to crash lazarus yet), while if I > rewrite the new iphtml.pas in order to remove the directive it works OK. Does that mean you will provide a patch to fix this?

Yes, attached (beware, made under windows with TortoiseSVN), but it's less "elegant" that the solution with nestedprocvars (if it is supposed to work).
And, as I said to Ondrej, there are more units using that switch.

> A bug in fpc 2.6.4? Maybe. Although it exists since 2.6.0.

I could file a bug then but I'm afraid I cannot produce a simple test case.

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -------------- next part -------------- A non-text attachment was scrubbed... Name: nonestedprocs.patch Type: text/x-patch Size: 3350 bytes Desc: not available URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160930/3a58ce95/attachment.bin>

Reply by email

Luca Olivetti
to Ondrej Pokorny: Already fixed in trunk. See http://mantis.freepascal.org/view.php?id=29982 I'll add it to…

El 30/09/16 a les 13:01, Ondrej Pokorny via Lazarus ha escrit:

Show quoted text 18 lines
On 30.09.2016 12:57, Luca Olivetti via Lazarus wrote: > El 30/09/16 a les 12:51, Ondrej Pokorny via Lazarus ha escrit: >> On 30.09.2016 12:27, Luca Olivetti via Lazarus wrote: >>> If I compile the old turbopower_ipro with this directive (even if it >>> doesn't need it) it doesn't work (the information box doesn't show >>> anything, though I didn't manage to crash lazarus yet), while if I >>> rewrite the new iphtml.pas in order to remove the directive it works >>> OK. >> >> Strange, there is no {$MODESWITCH NESTEDPROCVARS} directive in my >> Lazarus trunk\components\turbopower_ipro\iphtml.pas or any other file >> (except of one file in examples). > > ipdefine.inc. Already fixed in trunk. See http://mantis.freepascal.org/view.php?id=29982 I'll add it to merge list for 1.6

Duh, basically is the same fix I just sent. I deserve it for not checking trunk.
However, if the problem is with {$MODESWITCH NESTEDPROCVARS} and fpc 2.6.4, there are still a handful of units that use it in trunk:

lcl/grids.pas
components/lazdebuggergdbmi/gdbmidebugger.pp
components/debuggerintf/dbgintfdebuggerbase.pp
components/fpdebug/app/fpdserver/debugthreadcommand.pas components/turbopower_ipro/examples/sumabfrm.pas
components/lazutils/lcsvutils.pas

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email