strongloop / strong-remoting

Communicate between objects in servers, mobile apps, and other servers.
www.strongloop.com
Other
105 stars 93 forks source link

Unpredictable behaviour when remotely invoking remote methods #236

Closed pulkitsinghal closed 8 years ago

pulkitsinghal commented 9 years ago

First let me explain why I'm saying that I noticed "Unpredictable behaviour". I ran the same exact code twice and one time it crashed:

Will traverse 420 rows by fetching 3 page(s) of size <= 200
total lineitems retrieved for page #1: 44777
...
create.consignment.products ERROR [TypeError: expecting an array, a promise or a thenable See http://goo.gl/s8MMhc]

Whereas the next time it ran to completion:

Will traverse 420 rows by fetching 3 page(s) of size <= 200
total lineitems retrieved for page #1: 200

I've no idea why or how it got 44777 from the first time around but it had to be a junk value being miscast somehow:

    // here i'm remotely invoking a remote method named getRows() asynchronously
    return ReportModel.getRowsAsync(params.reportId, PAGE_SIZE, pageNumber)
      .then(function (stockOrderLineitemModelInstances) {
        console.log('total lineitems retrieved for page #%d: %d',
          pageNumber, stockOrderLineitemModelInstances.length);

And here's the source code for the remote method itself: https://github.com/ShoppinPal/warehouse/blob/b0965669c18ea3626acd8be75da8480c4829b7a7/common/models/report-model.js#L138-L165

If anyone has seen ghost issues such as this one and can venture a guess at troubleshooting them, please let me know.

richardpringle commented 8 years ago

Hey @pulkitsinghal, did this ever come up again? I would like to close if it hasn't. I also think that this might not be an issue with strong-remoting so I would like to close if possible.

richardpringle commented 8 years ago

@pulkitsinghal, closing the issue for now. Please re-open and mention me in a new comment if the issue persists.