2

I am trying to start a Process-A from systemd. Within Process-A, it starts another process-B using popen .

If Process-A is started from command line, then Process-B gets launched correctly.

When Process-A is launched from systemd, then the Process-B launched is crashing soon after it getting started from Process-A

systemd[1]: Received SIGCHLD from PID 770 (process-B).
systemd[1]: Child 770 (process-B) died (code=dumped, status=11/SEGV)

Any idea if any configuration needs to be added in systemd service file ? Currently only ExecStart is added with path of Process-A.

malioboro
  • 3,097
  • 4
  • 35
  • 55
DarkKnight
  • 597
  • 3
  • 15

2 Answers2

2

Any time something runs from the CLI and not from systemd, there are a couple of broad categories of possibilities.

  1. Different environment variables. You can have systemd-run service dump out the environment variables to see they match what you expect. Compare in particular the PATH variable to the path you expect.
  2. Resource restrictions. See man systemd.resource-control for configuration values which could restrict resource consumption. Use systemctl show your-unit-unit.service to check the full configuration values affecting the service you attempting to start.

In your case, you can also analyze the core dump to better understand what caused your program to crash.

It's a feature that system runs your code in a consistent environment with resource controls. This helps with reproducible, stable results in the long run without overwhelming the hardware.

Community
  • 1
  • 1
Mark Stosberg
  • 12,961
  • 6
  • 44
  • 49
1

Ok guys, the actual issue with my process-A was that it had some sort of dependency with another process-C during startup and took some inputs from another process-C which usually would be garbage during startup. This garbage input was reason for crash when launched through Systemd during startup. Later on manual start the input values used to be valid, thats why no crash.

Thanks for the help anyways. Also points mentioned by @Mark Stosberg are useful and valid for debugging systemd related bugs.

Let know in case of any questions. see ya.

DarkKnight
  • 597
  • 3
  • 15