{"thread":{"id":"46264","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","startedAt":"2017-06-26T20:48:08Z","lastAt":"2017-06-29T20:12:23Z","messageCount":7,"participants":["Gyandeep Singh","Stefan Beller","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"323292","messageId":"CAHaNChecHzZqzafe4P85Kz4BtJuisO+krCvm=yPW9wGMXWJK_A@mail.gmail.com","threadId":"46264","inReplyTo":"CAHaNChewK_4a7sPgZqWTNSmchiSbKOJUrpCrGLmcnR+cw6J5qw@mail.gmail.com","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","fromName":"Gyandeep Singh","fromEmail":"gyandeeps@gmail.com","sentAt":"2017-06-26T20:45:42Z","receivedAt":"2017-06-26T20:48:08Z","isPatch":false,"sender":{"key":"gyandeeps@gmail.com","avatar":"https://gravatar.com/avatar/a1dfdea756447e4fc11416147a714a24fca5128b29655f2c236abd1f9c9bb5a2?d=mp&s=160"},"body":"Environment:\n\nOS: Windows 7\nGit: git version 2.13.1.windows.2\nNodeJS: 8.1.2\n\nSteps:\n\n1. Create a js file with content\n\nconst http = require('http');\nconst fs = require('fs');\nconst port = 3000;\nconst app = http.createServer((req,res) => {\n    res.writeHead(200);\n    res.end(\"hi\");\n});\n\napp.listen(port);\n\nits a simple server running on 3000 port.\n\n2. Run command \"node ./app.js\" inside git bash.\n3. hit \"CTRL + c\" (2 times) to kill the process.\n4. If you look at taskmanager, then you will see a node.js process\nstill running. or if you try to restart the server it will say port\n300 already in use.\n\nNotes:\n\n1. This was working on first version of Git 2.13, it broke after the\nfirst version.\n\n\nThanks\n\n\nRegards,\n\nGyandeep Singh\n"},{"id":"323307","messageId":"CAGZ79kYR_Vw454RBw7A7ygJdiOauzepVZXBb_CvsCoN9AGE-sA@mail.gmail.com","threadId":"46264","inReplyTo":"CAHaNChecHzZqzafe4P85Kz4BtJuisO+krCvm=yPW9wGMXWJK_A@mail.gmail.com","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-06-27T02:55:30Z","receivedAt":"2017-06-27T02:55:35Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Which exact outputs of Git are invoked?\n\nDoes it change when giving slightly different options e.g. --no-pager?\n"},{"id":"323310","messageId":"CAHaNChdhg-nHv34-jgumeKw8iJXaXwfY2DAe797nRXPU1VzT3Q@mail.gmail.com","threadId":"46264","inReplyTo":"CAGZ79kYR_Vw454RBw7A7ygJdiOauzepVZXBb_CvsCoN9AGE-sA@mail.gmail.com","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","fromName":"Gyandeep Singh","fromEmail":"gyandeeps@gmail.com","sentAt":"2017-06-27T03:08:45Z","receivedAt":"2017-06-27T03:11:26Z","isPatch":false,"sender":{"key":"gyandeeps@gmail.com","avatar":"https://gravatar.com/avatar/a1dfdea756447e4fc11416147a714a24fca5128b29655f2c236abd1f9c9bb5a2?d=mp&s=160"},"body":"Not sure what you mean by output. But its just goes back to normal like  this\n\nGyandeep@Gyandeep MINGW64 ~\n\n$\n\n\n\nIt was working fine on first release of git 2.13. It broken with\nreleases after that.\n\nWill try with –no-pager flag and let you tomorrow.\n\n\n\nThanks\n\nGyandeep\nRegards,\n\nGyandeep Singh\nWebsite: http://gyandeeps.com\n\n\nOn Mon, Jun 26, 2017 at 9:55 PM, Stefan Beller <sbeller@google.com> wrote:\n> Which exact outputs of Git are invoked?\n>\n> Does it change when giving slightly different options e.g. --no-pager?\n"},{"id":"323312","messageId":"CAGZ79kZ94Qh4CzCUWNYQQU5EB+Oky13gcp09tBKSYoCaFvqOuA@mail.gmail.com","threadId":"46264","inReplyTo":"CAHaNChdhg-nHv34-jgumeKw8iJXaXwfY2DAe797nRXPU1VzT3Q@mail.gmail.com","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-06-27T03:15:39Z","receivedAt":"2017-06-27T03:15:45Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"I miss-read your email.\n\nSo you are not running Git, but only talk about the (Git-)bash that is\nconveniently bundled with Git for Windows?\nFor that I recommend https://github.com/git-for-windows/git/issues/new\n\nJohannes Schindelin the GfW maintainer is cc'd here as well, but\nAFAICT he prefers Github issues.\n\nOn Mon, Jun 26, 2017 at 8:08 PM, Gyandeep Singh <gyandeeps@gmail.com> wrote:\n> Not sure what you mean by output. But its just goes back to normal like  this\n>\n> Gyandeep@Gyandeep MINGW64 ~\n>\n> $\n>\n>\n>\n> It was working fine on first release of git 2.13. It broken with\n> releases after that.\n>\n> Will try with –no-pager flag and let you tomorrow.\n>\n>\n>\n> Thanks\n>\n> Gyandeep\n> Regards,\n>\n> Gyandeep Singh\n> Website: http://gyandeeps.com\n>\n>\n> On Mon, Jun 26, 2017 at 9:55 PM, Stefan Beller <sbeller@google.com> wrote:\n>> Which exact outputs of Git are invoked?\n>>\n>> Does it change when giving slightly different options e.g. --no-pager?\n"},{"id":"323313","messageId":"CAHaNCheiJkh85iqOwgrxx_S7OMW4a82LGRgvNc2FSS_cTdAczA@mail.gmail.com","threadId":"46264","inReplyTo":"CAGZ79kZ94Qh4CzCUWNYQQU5EB+Oky13gcp09tBKSYoCaFvqOuA@mail.gmail.com","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","fromName":"Gyandeep Singh","fromEmail":"gyandeeps@gmail.com","sentAt":"2017-06-27T03:17:22Z","receivedAt":"2017-06-27T03:17:28Z","isPatch":false,"sender":{"key":"gyandeeps@gmail.com","avatar":"https://gravatar.com/avatar/a1dfdea756447e4fc11416147a714a24fca5128b29655f2c236abd1f9c9bb5a2?d=mp&s=160"},"body":"Appreciate it. Thanks a lot.\nRegards,\n\nGyandeep Singh\nWebsite: http://gyandeeps.com\n\n\nOn Mon, Jun 26, 2017 at 10:15 PM, Stefan Beller <sbeller@google.com> wrote:\n> I miss-read your email.\n>\n> So you are not running Git, but only talk about the (Git-)bash that is\n> conveniently bundled with Git for Windows?\n> For that I recommend https://github.com/git-for-windows/git/issues/new\n>\n> Johannes Schindelin the GfW maintainer is cc'd here as well, but\n> AFAICT he prefers Github issues.\n>\n> On Mon, Jun 26, 2017 at 8:08 PM, Gyandeep Singh <gyandeeps@gmail.com> wrote:\n>> Not sure what you mean by output. But its just goes back to normal like  this\n>>\n>> Gyandeep@Gyandeep MINGW64 ~\n>>\n>> $\n>>\n>>\n>>\n>> It was working fine on first release of git 2.13. It broken with\n>> releases after that.\n>>\n>> Will try with –no-pager flag and let you tomorrow.\n>>\n>>\n>>\n>> Thanks\n>>\n>> Gyandeep\n>> Regards,\n>>\n>> Gyandeep Singh\n>> Website: http://gyandeeps.com\n>>\n>>\n>> On Mon, Jun 26, 2017 at 9:55 PM, Stefan Beller <sbeller@google.com> wrote:\n>>> Which exact outputs of Git are invoked?\n>>>\n>>> Does it change when giving slightly different options e.g. --no-pager?\n"},{"id":"323426","messageId":"alpine.DEB.2.21.1.1706281527120.84669@virtualbox","threadId":"46264","inReplyTo":"CAHaNChecHzZqzafe4P85Kz4BtJuisO+krCvm=yPW9wGMXWJK_A@mail.gmail.com","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-06-28T14:40:20Z","receivedAt":"2017-06-28T14:40:28Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 26 Jun 2017, Gyandeep Singh wrote:\n\n> 3. hit \"CTRL + c\" (2 times) to kill the process.\n> 4. If you look at taskmanager, then you will see a node.js process\n> still running. or if you try to restart the server it will say port\n> 300 already in use.\n\nThe way Ctrl+C is handled in Git for Windows changed recently, indeed.\n\nRemember: sending signals to processes to ask them to terminate is *POSIX*\nsemantics. Not Windows semantics.\n\nOn Windows you can terminate a process via the Win32 API. And I really\nmean \"terminate\". There is no chance for that process to, say, remove a\nnow-stale .git/index.lock.\n\nWe have to jump through hoops to accomodate Git's lack of non-POSIX\nunderstandings. In this particular case, we inject a remote thread into\nthe process, running ExitProcess() so that the atexit() handlers have a\nchance to perform the cleanup that Git so cleverly expects to be able to\ndo when being terminated.\n\nIt is probably that thread that is still trying to run when you hit Ctrl+C\nthe second time, and that second time it terminates *just* the shadow\nprocess: node.exe is a Console program, and since you run it in Git Bash\n(which does not have a Win32 Console, but emulates a Unix terminal\ninstead) the node shell alias runs node.exe through a helper called\nwinpty.exe that I suspect gets terminated without taking down its child\nprocesses.\n\nCiao,\nJohannes\n"},{"id":"323497","messageId":"alpine.DEB.2.21.1.1706292210230.84669@virtualbox","threadId":"46264","inReplyTo":"alpine.DEB.2.21.1.1706281527120.84669@virtualbox","subject":"Re: Bug: Cannot kill Nodejs process using ctrl + c","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-06-29T20:12:14Z","receivedAt":"2017-06-29T20:12:23Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 28 Jun 2017, Johannes Schindelin wrote:\n\n> On Mon, 26 Jun 2017, Gyandeep Singh wrote:\n> \n> [... a bug report ...]\n\nThis bug report was reposted as\n\n\thttps://github.com/git-for-windows/git/issues/1219\n\nIn my opinion, it is too Windows-specific for the discussion to continue\nanywhere but in that ticket.\n\nCiao,\nJohannes\n"}]}