Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    [BUG] DataSource throws call stack size exceeded when totalRows > 126000 in Chrome

    Hi, Isomorphic,

    We've encountered a bug in SmartClient core then servers responds with fetch operation then totalRows is more than 126000 records. Looks like Chrome will throw call stack exception then `addCacheData` method tries to call `addListAt` on this.localData array.
    The problem is that localData.length is set to 126000 in `setFullLength` and problems begins at: addListAt:
    Code:
    var tail = this.splice(pos, this.length - pos); // tail array will become very very large, 126000 items..
    // add back the tail
    this.push.apply(this, tail);  // <-- here we're getting call stack exceeded looks like Chrome can't call a function with 126000 arguments :)
    I cannot find a way how to fast fix that, maybe do you have some tips how can we workaround this? Some disable cache option or something?

    Also tested on latest SmartClient 10.x LGPL 2017-02-18


    Code:
    Uncaught RangeError: Maximum call stack size exceeded
        at Array.addListAt (ISC_Core.js:11182)
        at cons.addCacheData (ISC_DataBinding.js:46253)
        at cons.updateCache (ISC_DataBinding.js:45811)
        at cons.handleUpdate (ISC_DataBinding.js:45690)
        at cons.dataSourceDataChanged (ISC_DataBinding.js:45641)
        at cons.eval (eval at isc__makeFunction (ISC_Core.js:2065), <anonymous>:4:10)
        at cons.thunk (ISC_Core.js:7341)
        at cons.observation [as dataChanged] (ISC_Core.js:7295)
        at cons.updateCaches (ISC_DataBinding.js:15251)
        at Object.handleUpdate (ISC_DataBinding.js:7870)
    Testing code:
    Code:
    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <meta http-equiv="Cache-control" content="no-cache">
        <title></title>
    
        <script>var isomorphicDir = "isomorphic/";</script>
        <script src=isomorphic/system/modules-debug/ISC_Core.js></script>
        <script src=isomorphic/system/modules-debug/ISC_Foundation.js></script>
        <script src=isomorphic/system/modules-debug/ISC_Containers.js></script>
        <script src=isomorphic/system/modules-debug/ISC_Grids.js></script>
        <script src=isomorphic/system/modules-debug/ISC_Forms.js></script>
        <script src=isomorphic/system/modules-debug/ISC_DataBinding.js></script>
        <script src=isomorphic/skins/EnterpriseBlue/load_skin.js></script>
    </head>
    <body>
    <script>
        var testData = new Array(500).map(function (v, i) {
            return {id: "" + (i + 1), name: 'title_' + (i + 1)}
        });
    
    
        isc.Comm.sendCustom = function (request) {
            var transaction = request.transaction;
            var transactionNum = transaction.transactionNum;
            var callback = transaction.callback;
    
            var startRow = request.fields._startRow;
            var endRow = request.fields._endRow;
    
            var data = testData.concat().slice(startRow, endRow + 1);
    
            var results = JSON.stringify({
                response: {
                    data: data,
                    startRow: startRow,
                    endRow: data.length - 1,
                    status: 0,
                    totalRows: 126000
                }
            });
    
            this.fireCallback(callback, "transactionNum,results,wd", [transactionNum, results]);
        };
    
        var ds = isc.RestDataSource.create({
            ID: "ds",
            dataFormat: 'json',
            dataTransport: 'custom',
            jsonPrefix: null,
            fields: [{name: 'id', primaryKey: true}, {name: 'name'}]
        });
        var listGrid = isc.ListGrid.create({
            width: 300,
            height: 200,
            dataSource: "ds",
            useAllDataSourceFields: true,
            autoFetchData: true
        });
        var form = isc.DynamicForm.create({
            dataSource: "ds",
            useAllDataSourceFields: false,
            fields: [
                {
                    name: "name",
                    title: "Title"
                }
            ]
        });
        form.editNewRecord();
    
        var button = isc.Button.create({
            title: 'Add',
            click: function () {
                form.saveData();
            }
        });
    
        isc.VLayout.create({
            autoDraw: true,
            members: [listGrid, form, button]
        });
    </script>
    </body>
    </html>

    #2
    Your mention of "also tested" on SC 10.x doesn't specify what release you're actually using, but we've addressed this in SC 10.1p and newer releases. The fix will be in the nightly builds dated 2017-02-23 and beyond.

    Comment


      #3
      Ah, yes, we are using SmartClient 10.0, will be more specific in future :) 1000x Thank you!

      Comment


        #4
        We've addressed this issue back to SC 9.1p now - same builds.

        Comment

        Working...
        X