meteorhacks / cluster

Clustering solution for Meteor with load balancing and service discovery
https://meteorhacks.com/cluster-a-different-kind-of-load-balancer-for-meteor.html
MIT License
632 stars 80 forks source link

Error: write after end #108

Closed luski closed 8 years ago

luski commented 8 years ago

When I run a sample Meteor application (todo list) with cluster, the following exception appears repeatedly all the time and account-ui module is not showing:

events.js:72
        throw er; // Unhandled 'error' event
              ^
(STDERR) Error: write after end
    at writeAfterEnd (_stream_writable.js:133:12)
    at Socket.Writable.write (_stream_writable.js:181:5)
    at Socket.write (net.js:616:40)
    at Socket.Writable.end (_stream_writable.js:341:10)
    at Socket.end (net.js:397:31)
    at App.handle_404 (/home/lgi/.meteor/packages/ddp-server/.1.2.2.1g7rtf4++os+web.browser+web.cordova/npm/node_modules/sockjs/lib/sockjs.js:61:11)
    at Listener.webjs_handler (/home/lgi/.meteor/packages/ddp-server/.1.2.2.1g7rtf4++os+web.browser+web.cordova/npm/node_modules/sockjs/lib/webjs.js:115:28)
    at Listener.handler (/home/lgi/.meteor/packages/ddp-server/.1.2.2.1g7rtf4++os+web.browser+web.cordova/npm/node_modules/sockjs/lib/sockjs.js:147:12)
    at Listener.handler (/home/lgi/.meteor/packages/ddp-server/.1.2.2.1g7rtf4++os+web.browser+web.cordova/npm/node_modules/sockjs/lib/sockjs.js:6:61)
    at Server.<anonymous> (/home/lgi/.meteor/packages/ddp-server/.1.2.2.1g7rtf4++os+web.browser+web.cordova/npm/node_modules/sockjs/lib/sockjs.js:154:24)

I run it locally by calling the "meteor run" command. Deploying it to the server by Meteor Up doesn't help. My configuration is as follows:

CLUSTER_DISCOVERY_URL=mongodb://localhost:27017/Cluster
CLUSTER_SERVICE=meteor-service
CLUSTER_WORKERS_COUNT=2
CLUSTER_UI_SERVICE=meteor-service
CLUSTER_ENDPOINT_URL=http://127.0.0.1
luski commented 8 years ago

Ok, I changed CLUSTER_SERVICE from "meteor-service" to "web" and everything is working now. I thought the name can be whatever

SierraGolf commented 8 years ago

I just stumbled across the same issue and I would suggest re-opening it since the documentation states:

# mark your server as a web service (you can set any name for this)
export CLUSTER_SERVICE=web

which for me implied I can actually set any name, in my case "web-app", but I got 404s on the /cluster-dpp/... endpoint.