Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send Ctrl-C to dotMemory command line CLI when it runs in background with supervisord? #1451

Open
blakeex opened this issue Jul 27, 2021 · 0 comments
Labels

Comments

@blakeex
Copy link

blakeex commented Jul 27, 2021

I have multiple .NET Core programs running in a Ubuntu background using supervisord (see below). That supervisord.conf is located in the Hello-World folder.

[program:hello-world-1]
command = /all-hello-worlds/dotMemory-Cli-Linux/tools/dotMemory.sh start-net-core --service-input=null --trigger-max-snapshots=5 --trigger-delay=2m --trigger-timer=00:01:00 Hello-World-1.dll
directory = /all-hello-worlds/Hello-World-1
autostart = true
autorestart = unexpected
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0

In each supervisord.conf, I use:
dotMemory.sh start-net-core --trigger-delay=1m --trigger-timer=00:00:10 ./HelloWorld.dll

When the supervisord runs the .NET Core programs in the background, I could see the dotMemory printing message saying about "Press Ctrl+C to end the profiling"

Those .NET Core programmes are bundled in a Dorker container, which runs /usr/bin/supervisord -c /all-hello-worlds/supervisord.conf

Here is another supervisord.conf called supervisord.conf which is located in the all-hello-worlds folder

; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)
nodaemon = true   ; run in the background aka daemonizing

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.
[include]
files = /all-hello-worlds/*/supervisord.conf

You can visualise the folder structure in Ubuntu as followed:

all-hello-worlds (root folder)
| --- dotMemory-Cli-Linux
| --- supervisord.conf
| --- Hello-World-1
   | --- Hello-World-1.dll
   | --- supervisord.conf
| --- Hello-World-2
   | --- Hello-World-2.dll
   | --- supervisord.conf

Now I struggle sending Ctrl-C command to supervisord Hello-World processes. If I use supervisorctl stop Hello-World-1, the dotMemory does not save the DMW file properly & I need to use dotMemory recover method to get the DMW file (which is troublesome)

If I use kill -SIGINT [dotMemory process ID], the supervisord restarts the process & does not save the DMW file properly.

Is there anyway to send Ctrl-C command to dotMemory running in the background with supervisord?
I have attached 2 supervisord.conf files here.

Let me know if you need more information from me.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants