Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Sock-shop front end - Detected task failure when scaling in Docker Swarm. #108

Open
wellisonraul opened this issue Sep 3, 2019 · 1 comment

Comments

@wellisonraul
Copy link

Hello all, this is my first post and I'm afraid maybe this is not the right way to post my problem so apologies if I did it on the wrong way.

I'm using a sock shop as a test bed for my scientific research. The cluster is made of 1 master and 2 workers in the Docker Swam Mode. I am monitoring the application to make changes in your behavior. If this happens, I scale the application. For clarity, I realized that when the numbers of microservices change: "occurs detected task failure in the Docker Swarm".

So, I took the front end log and you can see it here:

sockshop_front-end.4.vn6ci38c3pqk@node-09    | /usr/src/app/api/orders/index.js:67
sockshop_front-end.4.vn6ci38c3pqk@node-09    |             var customerlink = jsonBody._links.customer.href;
sockshop_front-end.4.vn6ci38c3pqk@node-09    |                                                ^
sockshop_front-end.4.vn6ci38c3pqk@node-09    | 
sockshop_front-end.4.vn6ci38c3pqk@node-09    | TypeError: Cannot read property 'customer' of undefined
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at Request._callback (/usr/src/app/api/orders/index.js:67:48)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at Request.self.callback (/usr/src/app/node_modules/request/request.js:186:22)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at Request.emit (events.js:198:13)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1081:10)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at Request.emit (events.js:198:13)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at IncomingMessage.<anonymous> (/usr/src/app/node_modules/request/request.js:1001:12)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at Object.onceWrapper (events.js:286:20)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at IncomingMessage.emit (events.js:203:15)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at endReadableNT (_stream_readable.js:1145:12)
sockshop_front-end.4.vn6ci38c3pqk@node-09    |     at process._tickCallback (internal/process/next_tick.js:63:19)
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! code ELIFECYCLE
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! errno 1
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! [email protected] start: `node server.js`
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! Exit status 1
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! 
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! Failed at the [email protected] start script.
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
sockshop_front-end.4.vn6ci38c3pqk@node-09    | 
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR! A complete log of this run can be found in:
sockshop_front-end.4.vn6ci38c3pqk@node-09    | npm ERR!     /home/myuser/.npm/_logs/2019-09-03T11_57_54_133Z-debug.log

This usually occurs after the scale increases or decreases. The time between the problem and the normal sockshop is 10 minutes. However, during this time the application becomes unavailable for use. All front end microservices often fail when this problem occurs.

I don't know if the information is sufficient to understand the issue, but I can investigate and submit more.

Any help is highly appreciated. Thanks all. Wellison Santos.

@rajibhossen
Copy link

rajibhossen commented Jun 7, 2021

You are probably trying to add to the cart without logging in first. as a result, the cart database kept userid as "undefined" and when the system tries to read, it gets an error because there's no customer object on "undefined" userid. Please ensure to log in first before adding an item to the cart.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants