systemd / pystemd

A thin Cython-based wrapper on top of libsystemd, focused on exposing the dbus API via sd-bus in an automated and easy to consume way.
GNU Lesser General Public License v2.1
411 stars 36 forks source link

validate pystemd.run functionality on systemd 241 #19

Closed davide125 closed 5 years ago

davide125 commented 5 years ago

pystemd.run is currently broken on 240 and 241 if we use the pty option. Details in https://lists.freedesktop.org/archives/systemd-devel/2019-February/042175.html

aleivag commented 5 years ago

ok so this is my working theory, i will actually check thing tomorrow... but the issue is that when using the pty=True option in pystemd.run we create master and slave pty, but since the unit goes from dead to alive... as soon as we see that the unit is dead, we close the master, causing a pipe error in the newly created unit, crashing it, before it can come alive...

ideas to fix this:

1.- wait till the unit is alive, before waiting for the unit to be dead 2.- dont close the fd right away... 3.- wait for MainPID to be 0 before closing the unit 4.- try to replicate more closely what systemd-run does (what ever that may be), keep in mind that this is what we are doing now, and this is why it "break"

aleivag commented 5 years ago

actually new plan, and this is way better (will ask in mailing list)

when i call StartTransientUnit systemd schedule a /org/freedesktop/systemd1/job/jobid, i just wait for that job to finish to call the unit loaded and running... and then is business as usual.

aleivag commented 5 years ago

done!