cfmlprojects / runwar

Other
11 stars 16 forks source link

Closing CommandBox CLI kills running background servers #86

Closed bdw429s closed 6 years ago

bdw429s commented 7 years ago

This has been happening for several releases now. When I start a background server in CommandBox and then close the original shell, the server dies. There must be some tie between the processes that's killing the server. Perhaps the operating system thinks the server is a child process? I'm on Windows 7.

bdw429s commented 6 years ago

@denuno This is the issue I mentioned in the CommandBox mailing list the other day.

cfvonner commented 6 years ago

I hadn't noticed that in the past (I'd specifically seen servers remain running), so that is definitely something that changed in a recent release.

I'm actually in favor of the new behavior personally, as I pretty much never want my CommandBox-spawned server running when I don't have my IDE open. So not having to remember to server stop before closing VSCode is good for me. :-)

elpete commented 6 years ago

I agree with @bdw429s in this case — don't shut down my servers until I say so.

But reading @cfvonner's comment made me think of this xkcd: https://xkcd.com/1172/

bdw429s commented 6 years ago

To be clear, there's no "shutdown" being sent per se. There's something about the processes that seems to have them tied together so far as the operating system is concerned. The other thing I see is if I type "exit" in the CLI in Windows, it usually sits there until I stop any running servers. There's something that's got the processes tied together. I've looked into it and I'm not sure where to start. From what I've seen on the interwebs using ProcessBuilder to kick off a process should create a totally separate process. I think this started happening after we changed the system tray libraries so I have a suspicion maybe there's something about the child processes that generate the tray icons that might be affecting the processes. I guess one thing I've never tired is to start a server without the tray icon hooked and see if it still does it.

https://ortus.gitbooks.io/commandbox-documentation/content/embedded_server/embedded_server.html#disable-the-tray-icon

denuno commented 6 years ago

Did disabling the tray have any effect for you? FWIW, the servers I start on Windows continue to run after I close the console window. Maybe it depends on if you start CommandBox from within a cmd shell versus like from a batch file-- somehow tying all the subprocesses.

Have you tried clicking on the box.exe, starting the server from the console that's opened, and then closing the console?

bdw429s commented 6 years ago

@denuno Dunno, I didn't try it yet. I keep CommandBox pinned to my taskbar so it's the equiv of just double clicking the exe.

denuno commented 6 years ago

We can close this out now, right? It was just a windows 7 issue?

bdw429s commented 6 years ago

As far as I know, nothing was ever done to fix this. I don't know what versions of Windows were affected. I just tried to reproduce it and oddly I can't, but I'm on a bleeding edge build of CommandBox 4.0 and Lucee 5 via JSR-223 so there's no telling. Perhaps someone else who is subscribed to this thread can give it a try and let me know if it's still happening for them.

denuno commented 6 years ago

As far as I recall, we'd determined it only happened on Windows 7, so there was nothing to do-- unless someone wants to sponsor a fix for it I'm fine with the odd win7 issue.

bdw429s commented 6 years ago

Oops, didn't mean to click close, but I guess that was where we were headed, lol. I guess we can re-open if this is still an issue. I'm not sure at what point it stopped happening on my machine :thinking:

denuno commented 6 years ago

So it's even working on Windows 7 now? Even better! :smiley: