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.
You use an old dotMemory console version which runs via mono. kill -SIGINT [dotMemory process ID]
command doesn't work properly with it.
However, ##dotMemory["disconnect"]
can be sent to stdin via file:
--service-input
argument:dotMemory.sh start-net-core --service-input=<Path to service messages file>/dotMemoryInput.txt
echo '##dotMemory["disconnect"]' >> <Path to service messages file>/dotMemoryInput.txt
Profiling session will be finished and workspace will be saved in this case.
The other way is to update dotMemory clt version to 2021.1.5. Since 2021.1 dotMemory runs via dotnet and kill -SIGINT [dotMemory process ID]
works properly with this version, workspace is saved successfully.