Suffering from locks while showing message boxes?

pdj
pdj Member Posts: 643
If the OnAfterGetRecord trigger of a report contains a MESSAGE and then a CurrReport.BREAK any locked tables will remain locking untill the user presses Ok. Sample code to reproduce the situation:
OBJECT Table 77777 Break Test
{
  OBJECT-PROPERTIES
  {
    Date=10-06-09;
    Time=14:45:47;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
  }
  FIELDS
  {
    { 1   ;   ;No.                 ;Integer        }
    { 2   ;   ;Description         ;Text30         }
  }
  KEYS
  {
    {    ;No.                                     ;Clustered=Yes }
  }
  CODE
  {

    BEGIN
    END.
  }
}

OBJECT Report 77777 Break Test
{
  OBJECT-PROPERTIES
  {
    Date=10-06-09;
    Time=14:49:05;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    ProcessingOnly=Yes;
  }
  DATAITEMS
  {
    { PROPERTIES
      {
        DataItemTable=Table2000000026;
        DataItemTableView=SORTING(Number)
                          WHERE(Number=CONST(1));
        OnAfterGetRecord=BEGIN
                           BreakTest.LOCKTABLE;
                           BreakTest.FIND('-');

                           IF DoBreak THEN BEGIN
                             MESSAGE('Locking? - With BREAK');
                             CurrReport.BREAK;
                           END ELSE BEGIN
                             MESSAGE('Locking? - Without BREAK');
                           END;
                         END;

      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=12000;
            SectionHeight=846;
          }
          CONTROLS
          {
          }
           }
      }
       }
  }
  REQUESTFORM
  {
    PROPERTIES
    {
      Width=9020;
      Height=3410;
    }
    CONTROLS
    {
      { 1000000001;CheckBox;3410;0    ;440  ;440  ;ShowCaption=No;
                                                   CaptionML=ENU=Break (y/n);
                                                   SourceExpr=DoBreak }
      { 1000000002;Label  ;0    ;0    ;3300 ;440  ;ParentControl=1000000001 }
    }
  }
  CODE
  {
    VAR
      BreakTest@1000000000 : Record 77777;
      DoBreak@1000000001 : Boolean;

    BEGIN
    END.
  }
}
Try creating a few records in the table, and execute the report with the checkmark. While the message box is shown you can check the table is locked from a different client. This could be the reason for users experiencing timeout without the SQL seems to be doing anything. Problem reproduced in 3.70-Native & 5SP1-Native & 5SP1-SQL.

Is this expected (or even acceptable) behavior?
Regards
Peter

Comments

  • David_Singleton
    David_Singleton Member Posts: 5,479
    THis was fixed in one of the service packs in 4.00, but I think it resurfaced in a later version. Check out Waldo's blog I think he indicates the hot fix that fixes it.
    David Singleton
  • pdj
    pdj Member Posts: 643
    I guess you are refering to this one: https://mbs.microsoft.com/knowledgebase ... wsignin1.0 which is released for both 4SP3 and 5 (but not for 5SP1 where it is expected to be included)

    I don't have the code to reproduce the above problem, but I guess it is related to ERROR and not to the MESSAGE function. It might be the same bug, or at least very related. Neither ERROR nor MESSAGE should keep locks active.
    Regards
    Peter