{"action":"created","issue":{"url":"https://api.github.com/repos/atom/electron/issues/1968","labels_url":"https://api.github.com/repos/atom/electron/issues/1968/labels{/name}","comments_url":"https://api.github.com/repos/atom/electron/issues/1968/comments","events_url":"https://api.github.com/repos/atom/electron/issues/1968/events","html_url":"https://github.com/atom/electron/issues/1968","id":88102596,"number":1968,"title":"Windows socket and named pipe servers don't work in main process","user":{"login":"mmastrac","id":512240,"avatar_url":"https://avatars.githubusercontent.com/u/512240?v=3","gravatar_id":"","url":"https://api.github.com/users/mmastrac","html_url":"https://github.com/mmastrac","followers_url":"https://api.github.com/users/mmastrac/followers","following_url":"https://api.github.com/users/mmastrac/following{/other_user}","gists_url":"https://api.github.com/users/mmastrac/gists{/gist_id}","starred_url":"https://api.github.com/users/mmastrac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmastrac/subscriptions","organizations_url":"https://api.github.com/users/mmastrac/orgs","repos_url":"https://api.github.com/users/mmastrac/repos","events_url":"https://api.github.com/users/mmastrac/events{/privacy}","received_events_url":"https://api.github.com/users/mmastrac/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/atom/electron/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/atom/electron/labels/windows","name":"windows","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-14T02:15:45Z","updated_at":"2015-06-16T02:39:09Z","closed_at":null,"body":"I've been tracking down a bug in a program that works in OSX but fails mysteriously in Windows. I've pared down a minimal repro case to the `net.createConnection` / `net.createServer` APIs w/ a named pipe failing when run in the main atom process.\r\n\r\nIf you specify `ATOM_SHELL_INTERNAL_RUN_AS_NODE=1` for both ends of the test it will function as you'd expect. If either one (or both) are `ATOM_SHELL_INTERNAL_RUN_AS_NODE=0`, the repro will hang in the middle of the test and fail to continue the ping/pong cycle. \r\n\r\nReproduction steps (tested on Win7/32 w/electron-v0.28.0-win32-ia32):\r\n  * Save the snippet below as `repro.js`\r\n  * Open two Windows command consoles\r\n  * In the first one, run `electron.exe repro.js`\r\n  * In the second one, run `electron.exe repro.js client`\r\n\r\nWhat happens:\r\n  * The ping/pong only runs a few cycles back and forth, then stops. It may occasionally continue after a pause of 30-60s.\r\n![screen shot 2015-06-13 at 8 10 06 pm](https://cloud.githubusercontent.com/assets/512240/8146764/5a48d748-1208-11e5-908e-c538c3f80121.png)\r\n\r\n\r\nWhat I expect to happen:\r\n  * The ping/pong continues indefinitely\r\n![screen shot 2015-06-13 at 8 10 43 pm](https://cloud.githubusercontent.com/assets/512240/8146766/6538da86-1208-11e5-8c66-729e258ea577.png)\r\n\r\n\r\n\r\n```\r\nvar net = require('net');\r\n\r\nvar addr = '\\\\\\\\?\\\\pipe\\\\testpipe';\r\n\r\nvar counter = 0;\r\n\r\nif (process.argv[2] == 'client') {\r\n\tvar client = net.createConnection({ path: addr }, function() {\r\n\t\tconsole.log(\"Connected to named pipe as client\");\r\n        client.on('data', function(data) {\r\n        \tconsole.log(\"rec'd: \" + data);\r\n        \tsetTimeout(function() {\r\n        \t\tclient.write(\"ping \" + counter++);\r\n        \t}, 500);\r\n        });\r\n\r\n        client.write('ping!');\r\n\t}.bind(this));\r\n} else {\r\n\tnet.createServer(function(client) {\r\n        console.log(\"Connected to named pipe as server\");\r\n        client.on('data', function(data) {\r\n        \tconsole.log(\"rec'd: \" + data);\r\n        \tsetTimeout(function() {\r\n        \t\tclient.write(\"pong \" + counter++);\r\n        \t}, 500);\r\n        });\r\n\t}.bind(this)).listen(addr);\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/atom/electron/issues/comments/112263874","html_url":"https://github.com/atom/electron/issues/1968#issuecomment-112263874","issue_url":"https://api.github.com/repos/atom/electron/issues/1968","id":112263874,"user":{"login":"zcbenz","id":639601,"avatar_url":"https://avatars.githubusercontent.com/u/639601?v=3","gravatar_id":"","url":"https://api.github.com/users/zcbenz","html_url":"https://github.com/zcbenz","followers_url":"https://api.github.com/users/zcbenz/followers","following_url":"https://api.github.com/users/zcbenz/following{/other_user}","gists_url":"https://api.github.com/users/zcbenz/gists{/gist_id}","starred_url":"https://api.github.com/users/zcbenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcbenz/subscriptions","organizations_url":"https://api.github.com/users/zcbenz/orgs","repos_url":"https://api.github.com/users/zcbenz/repos","events_url":"https://api.github.com/users/zcbenz/events{/privacy}","received_events_url":"https://api.github.com/users/zcbenz/received_events","type":"User","site_admin":true},"created_at":"2015-06-16T02:39:09Z","updated_at":"2015-06-16T02:39:09Z","body":"Seems like a bug of Node.js integrations."}}