Permalink
Browse files

Release v0.0.27

  • Loading branch information...
1 parent ac9383c commit 33ff9d8bcc32cf57e2fa1c62f7c35b5843de04b8 @pgte committed Oct 11, 2010
Showing with 14 additions and 13 deletions.
  1. +4 −0 ChangeLog
  2. +7 −10 lib/fugue.js
  3. +1 −1 package.json
  4. +2 −2 test/test_app_reload.js
View
@@ -1,3 +1,7 @@
+2010.10.11 v0.0.27
+
+* fixed a possible racing condition for access to master pid file when respawning
+
2010.10.11 v0.0.26
* Now uses carrier (http://github.com/pgte/carrier) as a way to implement line reading on protocol
View
@@ -128,18 +128,15 @@ exports.start = function(server, port, host, worker_count, options) {
// It can come from env if we have been spawned or we have to create a new one
master_socket_path = null;
if (process.env._FUGUE_MASTER_SOCKET_PATH) {
- if (path.existsSync(process.env._FUGUE_MASTER_SOCKET_PATH)) {
- master_socket_path = process.env._FUGUE_MASTER_SOCKET_PATH;
- }
- }
- if (!master_socket_path) {
- // make new
- master_socket_path = process.env._FUGUE_MASTER_SOCKET_PATH = path.join(options.tmp_path, 'fugue_' + process.pid + '_master.sock');
+ master_socket_path = process.env._FUGUE_MASTER_SOCKET_PATH;
}
-
log('Using master socket path: ' + master_socket_path);
if (is_master) { // Master
+
+ var old_master_socket_path = process.env._FUGUE_MASTER_SOCKET_PATH;
+
+ master_socket_path = process.env._FUGUE_MASTER_SOCKET_PATH = path.join(options.tmp_path, 'fugue_' + process.pid + '_master.sock');
process.umask(0077);
@@ -161,8 +158,8 @@ exports.start = function(server, port, host, worker_count, options) {
// request socket to original server
// this startup part has to work synchronously, so we dig deep into the bindings...
var client_socket = netBinding.socket('unix');
- log('connecting to ' + master_socket_path);
- netBinding.connect(client_socket, master_socket_path);
+ log('connecting to ' + old_master_socket_path);
+ netBinding.connect(client_socket, old_master_socket_path);
var request_buffer = new Buffer("GIMME_SOCKET\n", 'ascii');
netBinding.write(client_socket, request_buffer, 0, request_buffer.length);
var responseBuffer = new Buffer(256);
View
@@ -1,6 +1,6 @@
{ "name" : "fugue"
, "description" : "Unicorn for node for node"
-, "version" : "0.0.26"
+, "version" : "0.0.27"
, "homepage" : "http://www.metaduck.com/fugue"
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com> (http://www.metaduck.com)"
, "contributors" :
View
@@ -60,7 +60,7 @@ exports.run = function(next) {
// wait some time before ending
setTimeout(function() {
clearInterval(intervalId);
- assert.equal(2, pid_count, "We expected to have contacted 2 workers. we contacted "+pid_count);
+ assert.equal(4, pid_count, "We expected to have contacted 4 workers. we contacted "+pid_count);
if (next) next();
}, 5000);
@@ -74,7 +74,7 @@ exports.run = function(next) {
conn.end();
});
- fugue.start(server, port, null, 1, {verbose: false , master_pid_path : master_pid_path } );
+ fugue.start(server, port, null, 2, {verbose: false , master_pid_path : master_pid_path } );
}

0 comments on commit 33ff9d8

Please sign in to comment.