Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Uncaught Range Error: Maximum call stack size exceeded
Thu, Feb 14 2019 1:20 AMPermanent Link

Richard Harding

Wise Nutrition Coaching

I am using EWB 2.06 b18 with EDB.

The customer has four PCs using EWB Server and EDB Server on a separate PC The system is used to manage the stock for their engineering company. Very occasionally, an "Uncaught Range Error: Maximum call stack size exceeded" occurs when a single row is saved after editing. One of the columns is a CLOB type.

It has never, ever occurred on my system.

==============================================================

webdata_tdataset.$p.tdataset_checksort = function()
{
  var $t = this;
  if ((($t.tdataset_fstate == webdata_dsinsert) && (($t.tdataset_frowno < $t.tdataset_frows.tobjectlist_fcount) || $t.tdataset_getsorted())) || (($t.tdataset_fstate == webdata_dsupdate) && $t.tdataset_getsorted()))
  {
     $t.tdataset_savestate(webdata_dsreset);
     try
     {
        $t.tdataset_internalsort();
     }
     finally
     {
        $t.tdataset_restorestate();      // Error occurs on this line. - called from webdata_tdataset.$p.save1
     }
  }
};
==============================================================

It occurs with both Chrome and Firefox. Any clues regarding what may be happening here?

Thank you
Richard
Fri, Feb 22 2019 2:54 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Richard,

<< The customer has four PCs using EWB Server and EDB Server on a separate PC The system is used to manage the stock for their engineering company. Very occasionally, an "Uncaught Range Error: Maximum call stack size exceeded" occurs when a single row is saved after editing. One of the columns is a CLOB type. >>

This is definitely an infinite recursion issue.  I would look for any event handlers that could get triggered by the "rows have changed" event notification mechanism in EWB, which is typically surfaced in this event:

https://www.elevatesoft.com/manual?action=viewevent&id=ewb2&comp=TDataSet&event=OnRowChanged

but could also trigger updates to controls that can cause other events to be triggered.

I would try to get them to nail down exactly what they're doing, and that should help track it down.

Tim Young
Elevate Software
www.elevatesoft.com
Sun, Feb 24 2019 3:42 PMPermanent Link

Richard Harding

Wise Nutrition Coaching

Thank you Tim.

The customer has a problem where very occasionly a row does not get posted after the window is closed. I added a log file to record the what was happening when the transaction was committed back on the 29 October.

I was a bit naughty when I inserted the log file entry in the AfteCommir and then added another commit to save the log file entry. I assigned nil to the Database methods in the close method of the edit form and it seemed to work. They only had one range error in the 4 months and it always worked on my system. I had forgotten about this when I emailed

I will describe the original problem in the next post.
Sun, Feb 24 2019 4:02 PMPermanent Link

Richard Harding

Wise Nutrition Coaching

The customer has a problem where very occasionly a row does not get posted after the window is closed. I have no idea how long this has been happening because the customer (rightly) just assumes that the row will be saved. I have been aware of the problem for many months.

There are two forms involved: A stock summary form and a stock edit form. I am guessing the problem lies in the way I handle the database methods.

The customer has not had one instance of the row not being saved since the log file has added. May be a coincidence or may be it slowed things down sufficiently or may be they just have not noticed - although most of the changes they make appear on the summary grid and they do check.

Unfortunately, I am at a loss on how to proceed and any assistance would be very much welcomed.

Thank you
Richard.

=======================================================================
// Closing Stock Edit form from Stock Summary Form
procedure TfmMenu.fmStockDetailClose(Sender: TObject);
begin
//  logoutput('fmStockDetailClose', 'log');

 Database.OnCommitError := nil;
 Database.AfterCommit := nil;
 Database.BeforeCommit := nil;
 Database.OnRollbackError := nil;
 Database.AfterRollback := nil;

 ShowProgress('Loading stock items');
 Database.LoadRows(Grid2.DataSet);  
end;

=======================================================================
// Database methods coded in the Stock Edit form
procedure TfmStockDetail.CommitErrorResponse(DlgResult: TModalResult);
begin
 if Database.NumPendingRequests > 0
    then Database.CancelPendingRequests;
 Close;
end;

procedure TfmStockDetail.CommitError(Sender: TObject; const ErrorMsg: String);
begin
 Database.StartTransaction;
 esLogFile.Insert;
 esLogFile.Columns['LogDetails'].AsString := 'Commit error: ' + ErrorMsg;
 esLogFile.Save;
 Database.Commit;

  MessageDlg('An error occurred while saving Stock Details' + LF +
             'All modifications have been lost' + LF + LF +
             ErrorMsg, 'Error saving Stock Details', mtError, [mbOk], mbOk, CommitErrorResponse, false);
end;

procedure TfmStockDetail.AfterCommit(Sender: TObject);
begin             
//  Database.StartTransaction;                                                               // Added 29 Oct 2018
//  esLogFile.Insert;                                                                                // Added 29 Oct 2018
//  esLogFile.Columns['LogDetails'].AsString := 'After commit';             // Added 29 Oct 2018
//  esLogFile.Save;                                                                                 // Added 29 Oct 2018
//  Database.Commit;                                                                             // Added 29 Oct 2018
 Close;
end;

function TfmStockDetail.BeforeCommit(Sender: TObject): boolean;
begin
//   logoutput('BeforeCommit', 'log');
  Result := true;
end;

procedure TfmStockDetail.RollbackError(Sender: TObject; const ErrorMsg: String);
begin
  MessageDlg('An error occurred while cancelling the modifications to Stock details' + LF + LF +
             ErrorMsg, 'Error cancelling modifications', mtError, [mbOk], mbOk, nil, True);
end;

procedure TfmStockDetail.AfterRollback(Sender: TObject);
begin
//   logoutput('AfterRollback', 'log');
  Close;
end;

==============================================================================
Image