v13 crashes compiled and freezes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

v13 crashes compiled and freezes

4D Tech mailing list
This is my weekend for perplexing 4D issues.

v13.6: crashes and freezes compiled but not a hint of a problem running
interpreted. The exact point of the crash is not even clear.

Here is the snippet of code where the crash is reported:

If (<>vt_CurrProc#ProcType )
  <>vt_CurrProc:=ProcType
  If (Not(<>bCanAcquireMedia))
    DisableMenuAcquire
  End if
End if

RW_Lock   //semaphore
InitMenus   //load menu bar & names

$j:=Size of array(as_localMen)

For ($i;1;$j)

-->
​    ​
If (Length(as_localMen{$i})>1)

   ...

The error in the 4D error dialog is an array range error of al_localMen.
Suspicious given the two lines above it but that's what it reports.

So enabling the debuglog and running compiled:

0 p=6 puid=25 Log level: 4
0 p=6 puid=25 meth: DO_MENUS
0 p=6 puid=25 (0) cmd: Current process (ProcType). < ms
1 p=6 puid=25 meth: DO_MENUS
1 p=6 puid=25 (0) cmd: Current process (ProcType). < ms
1 p=6 puid=25 meth: DO_MENUS
1 p=6 puid=25 (0) cmd: Semaphore("$ReadWriteLock") (RW_Lock). < ms
1 p=6 puid=25 meth: DO_MENUS
1 p=6 puid=25 (0) cmd: SET MENU BAR(1) (InitMenus). 4 ms

4D err dial
​og start...


62 p=6 puid=25 form: s_mess; event: OnLoad

63 p=6 puid=25 meth: S_MESS (coreDialog)
63 p=6 puid=25 (0) cmd: Form event (error_HANDLER (coreDialog)). < ms


We get into the InitMenus method, set a menu bar and then there's a pause
of about 60ms before the 4D error dialog begins to initialize itself. That
dialog goes on to report the error as the array range check in the parent
method.

The InitMenu code is:

If (Not(<>InCataloguerMode))
  SET MENU BAR(1)
Else
  SET MENU BAR(3)
End if
  //custom menu names
For ($menuNum;1;Size of array(<>aiFullMenu))
  For ($menuItem;1;<>aiFullMenu{$menuNum})
    $menuCode:=String($menuNum)+String($menuItem;"00")
    $index:=Find in array(<>as_MItemIDs;$menuCode)
    If ($index>0)
      SET MENU ITEM($menuNum;$menuItem;<>at_MItemNam{$index})
    End if
  End for
End for

So I'm really stumped by this one.

1) why does 4D freeze completely? I've never seen this before. The error
dialog is shown but 4D is completely unresponsive.

2) what is the the actual error? An issue with the Menu bar (because that's
where the debuglog recording stops) or with the array (because that's what
's reported as the error)?


I have run both the structure and the data through MSC a couple of times.
The only issues with the structure are warnings about missing style sheets
in various forms, none of which are even draw at this point and are petty
common in an old v13 structure anyway.

I'm looking for ideas here.


--
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: v13 crashes compiled and freezes

4D Tech mailing list
OK, I resolved the freezing part - turns out there was an event handler
installed that was filtering keystrokes.

On Mon, May 22, 2017 at 8:19 AM, Kirk Brooks <[hidden email]> wrote:
>
> 1) why does 4D freeze completely? I've never seen this before. The error
> dialog is shown but 4D is completely unresponsive.
>
> --
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: v13 crashes compiled and freezes

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Hi Kirk,

Just a thought. Are you sure the array as_localMen is initialized in compiled mode?

In the past I've been bitten by that kind of issue. In compiled mode the array variable is always defined, but for some reason the ARRAY ...(myArray;0) line was not called. Then I found that Size of array (myArray) returned a huge number. So 4D thought there were lots of elements (no range check error raised) but the memory was not reserved because there should have been none. Result: crash when trying to access the none existent array elements.

HTH
Koen

Op 22-mei-2017, om 17:19 heeft Kirk Brooks via 4D_Tech <[hidden email]> het volgende geschreven:

> $j:=Size of array(as_localMen)



--------------------
Compass bvba
Koen Van Hooreweghe
Kloosterstraat 65
9910 Knesselare
Belgium
tel +32 495 511.653

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: v13 crashes compiled and freezes

4D Tech mailing list
My first favorite cause of crashing compiled databases is a negative array index. That's very reliable, hard to find.
The best way to avoid such problems is to code defensively while handling arrays.

Good luck
Lutz

--  
Lutz Epperlein  
----------------------------------------------
Agendo Gesellschaft für politische Planung mbH
Köpenicker Str. 9
10997 Berlin
http://www.agendo.de/
----------------------------------------------


**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: v13 crashes compiled and freezes

4D Tech mailing list
Lutz,

Agreed. This is a db that started back in the '90s and has an extremely
complicated scheme of arrays to handle the menus. Then over the years other
devs needed to change or add some functionality and, I think, rather than
try to unravel what was existing added on more menu management for their
purposes. This resulted in a very complex web which I upset by making a
change unrelated to menus at all. I'm going to take a little time and see
if all of that is even necessary any longer. The tools available for menu
management are much better now. When I found myself trying to pull a tech
note out of ACI FTP from 1996 so I could read up on how menus were managed
back then I realized I may be going about this the wrong way.

On Tue, May 23, 2017 at 12:10 AM, Epperlein, Lutz (agendo) via 4D_Tech <
[hidden email]> wrote:

> My first favorite cause of crashing compiled databases is a negative array
> index. That's very reliable, hard to find.
> The best way to avoid such problems is to code defensively while handling
> arrays.
>

--
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Loading...