-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Description
When the server is under high load the following error is produced:
1|advertis | Error: Callback was already called.
1|advertis | at /var/www/vhosts/advertising-api/node_modules/async/dist/async.js:903:32
1|advertis | at /var/www/vhosts/advertising-api/node_modules/async/dist/async.js:3835:13
1|advertis | at interceptInvocationErrors (/var/www/vhosts/advertising-api/node_modules/strong-remoting/lib/remote-objects.js:692:16)
1|advertis | at /var/www/vhosts/advertising-api/node_modules/loopback-phase/node_modules/async/lib/async.js:154:25
1|advertis | at /var/www/vhosts/advertising-api/node_modules/loopback-phase/node_modules/async/lib/async.js:154:25
1|advertis | at /var/www/vhosts/advertising-api/node_modules/loopback-phase/node_modules/async/lib/async.js:154:25
1|advertis | at /var/www/vhosts/advertising-api/node_modules/strong-remoting/lib/remote-objects.js:656:7
1|advertis | at /var/www/vhosts/advertising-api/node_modules/strong-remoting/lib/http-context.js:397:7
1|advertis | at callback (/var/www/vhosts/advertising-api/node_modules/strong-remoting/lib/shared-method.js:253:5)
1|advertis | at /var/www/vhosts/advertising-api/common/models/source.js:215:9
This is a result of the next method being called. I checked my model and I am very careful about not calling the method twice, and If I was indeed calling it twice, it would be happening on all requests, not only when the server is stressed out. The issue consistently happens when there is about a load of 1500 concurrent users.
Also to clarify, the code that is responsible to throwing the error at the first level of the stack trace:
self.phases.run(ctx, function interceptInvocationErrors(err) {
if (!err) {
return cb();
}
ctx.error = err;
self.execHooks('afterError', method, scope, ctx, function(hookErr) {
cb(hookErr || err);
});
});