Object loses methods - sometimes

Writing and using Classes in Dyalog APL

Object loses methods - sometimes

Postby RobertB on Fri Jan 04, 2013 9:38 am

hello,
we have got this problem for some time in the past, but till now just reading it in our logs and did not understand how this value error could happen.
today i had this error for the first time in my development environment.

it is an asp.net 2.0 application and dyalog 12.0.5.10211.

we have the class ArtikelVertragsDef which is derived from the class Datensatz:

Code: Select all
⎕class myObj
  #.ITWK.ArtikelVertragsDef    #.ITWK.Datensatz 


the class ArtikelVertragsDef has the following public methods:

Code: Select all
myObj.⎕nl ¯3
 CopyValues  CopyValuesWithoutStatus  FeldAbfrageZurSelektion  OderSelektion  OderSelektionGleich  SaetzeFiltern  SetDescr
      iption  Spaltenwerte  StandardSelect  UndSelektion  UndSelektionGleich  Vergleich  Wert  WertQTS  Werte  ∆DBDelete
      ∆DBInsert  ∆DBUpdate  ∆Ind  ∆MakeBindSym  ∆NoNullDB  ∆PopulateInstance  ∆RC2  ∆RC3zu2


but sometimes the method "Werte" causes a value error:

Code: Select all
obj.Werte
5:VALUE ERROR
      obj.Werte

obj.⎕nl ¯3
 CopyValues  CopyValuesWithoutStatus  FeldAbfrageZurSelektion  OderSelektion  OderSelektionGleich  SaetzeFiltern  SetDescr
      iption  Spaltenwerte  StandardSelect  UndSelektion  UndSelektionGleich  Vergleich  Wert  WertQTS  ∆DBDelete  ∆DBInse
      rt  ∆DBUpdate  ∆Ind  ∆MakeBindSym  ∆NoNullDB  ∆PopulateInstance  ∆RC2  ∆RC3zu2


other methods are working fine:

Code: Select all
obj.WertQTS
 #.AppDomain_4fc5b7cc_1_130017564216759886.Assembly_App_Web_itwarenkorb_dws_ae7ca9a1_l_expv2p.[ITWKPosArtikelAuswahl].[Art
      ikelVertragsDef] .  #.AppDomain_4fc5b7cc_1_130017564216759886.Assembly_App_Web_itwarenkorb_dws_ae7ca9a1_l_expv2p.[IT
      WKPosArtikelAuswahl].[ArtikelVertragsDef] .  ∇WertQTS  ⎕NERASE  #.ITWK.Datensatz


the method "Werte" is defined in the class Datensatz as follows:
Code: Select all
    ∇ r←Werte Feldnamen
      :Access Public Instance


all other methods are definded in the same way.


while this error occurs, i have created this object in a loop for 10.000 times and was looking for the missing method "Werte".
but the method was always provided.

where is the bug?
RobertB
 
Posts: 15
Joined: Fri Aug 27, 2010 7:16 am

Re: Object loses methods - sometimes

Postby Phil Last on Fri Jan 04, 2013 10:37 am

For a long time we had similar symptoms with one or two methods disappearing apparently randomly but I'm not sure it's the same cause.

We use vestigial scripts that do little else than define a few fields and :Include a few ordinary container namespaces. Although we don't use subclasses the classes form a conceptual hierarchy by including different subsets of namespaces that contain overlapping sets of methods. There might be half a dozen versions of a single named method in different spaces.

The order namespaces are included in a script determines which included homonym eventually gets called. If a method in an included class that is superseded by a later inclusion is edited then the interpreter seems occasionally to get confused and either the wrong version is included or none at all.

Our solution is that at the start of a session, whether development or runtime, all workspace objects: vars, fns, ops, spaces and classes are fixed from a codefile rather than being )SAVEd in a .DWS. Our code management software ensures all changes are stored automatically so that we can restart at any time.

Even though your setup may be vastly different with classes derived from other classes rather than using inclusions I'm guessing the underlying cause may well be similar and the symptoms disappear with something as simple as refixing all classes at session start.
User avatar
Phil Last
 
Posts: 628
Joined: Thu Jun 18, 2009 6:29 pm
Location: Wessex

Re: Object loses methods - sometimes

Postby StefanoLanzavecchia on Mon Jan 07, 2013 9:10 am

I've seen several times (but could never reproduce in lab) something similar. In our case the method which fails to be invoked comes from a class fully implemented in C#, so a "VALUE ERROR" is out of the question... I seem to remember we managed to verify that it's the actual method that it's missing, not that the method is trying to return a NULL.

Here's the significant bit of code:
Code: Select all
:If ×⍴url←req.{0::⍵ ⋄ ⊃Parameters[⊂'returnUrl']}''
    ⎕USING,←⊂',system.web.dll'              ⍝ sometimes in a strange case, we do not have the library
    rsp.Redirect⊂System.Web.HttpUtility.UrlDecode⊂url
:Else
    rsp.Redirect⊂'/secured/'
:EndIf


The error logged is:
Code: Select all
VALUE ERROR                                               
Login[8] rsp.Redirect⊂System.Web.HttpUtility.UrlDecode⊂url
                     ^                                   


The failing line runs successfully several hundred times every day. And once or twice every day it fails. "url" cannot be missing (and it's a local variable so it cannot be modified by other threads) and from the position of the caret it's either System.Web.HttpUtility.UrlDecode missing or returning NULL. To be honest, I cannot see a way for that method to return NULL... The question stands: how can it be missing? Notice that to be on the safe (paranoid) side, the DLL which contains the definition of the method is added to the ⎕USING list.
I mentioned in passing that the APL session is multithreaded and I'll repeat it here for extra clarity: I am talking about Dyalog APL threads but some of those threads are "callbacks" which come from a C# web server implemented in a .NET DLL hosted by that same Dyalog APL session.
User avatar
StefanoLanzavecchia
 
Posts: 113
Joined: Fri Oct 03, 2008 9:37 am

Re: Object loses methods - sometimes

Postby Vince|Dyalog on Wed Jan 09, 2013 9:32 am

Hi,

When the object has generated an unexpected VALUE ERROR, please generate a dumpws and contact us at Dyalog Support.

      2⎕nq '.' 'dumpws' 'c:\tmp\dya.dmp'

This will create a dump of the workspace which is similar to an aplcore. But, it won't terminate the process.

Regards,

Vince
Vince|Dyalog
 
Posts: 433
Joined: Wed Oct 01, 2008 9:39 am


Return to Object Oriented Programming

Who is online

Users browsing this forum: No registered users and 1 guest