Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage1: reorder iomux service #3830

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

iaguis
Copy link
Member

@iaguis iaguis commented Oct 17, 2017

This changes the start order of the iomux service so it starts before
the app service instead of after (in the diff, "before" and "after" are
swapped because this code refers to the app service).

If the app has a pre-start hook that fails, iomux will never start and
we won't get any logs of the pre-start hook so users will have a hard
time debugging. With this change, iomux will be started before the app
service starts, capturing all the relevant logs.

This changes the start order of the iomux service so it starts before
the app service instead of after (in the diff, "before" and "after" are
swapped because this code refers to the app service).

If the app has a pre-start hook that fails, iomux will never start and
we won't get any logs of the pre-start hook so users will have a hard
time debugging. With this change, iomux will be started before the app
service starts, capturing all the relevant logs.
It might happen that the iomux service starts before the socket unit is
started. This means that the file specified in ListenFIFO (e.g.
`/rkt/iottymux/0-myapp-container/stage2-stdin`) won't exist and iomux
will fail with something like this:

    Listening on stderr socket for 0-myapp-container.
    Listening on stdout socket for 0-myapp-container.
    iottymux: runtime failure
      └─invalid stdin FIFO: open /rkt/iottymux/0-myapp-container/stage2-stdin: no such file or directory
    Starting Create /etc/passwd and /etc/group...
    Listening on stdin socket for 0-myapp-container.
    iomux@0-myapp-container.service: Main process exited, code=exited, status=254/n/a
    iomux@0-myapp-container.service: Unit entered failed state.
    iomux@0-myapp-container.service: Failed with result 'exit-code'.

This adds a Before=iomux.service dependency to the socket units so they
start before it, making sure the FIFO exists by the time iomux starts.
@iaguis
Copy link
Member Author

iaguis commented Oct 17, 2017

Added another commit.

It might happen that the iomux service starts before the socket unit is started. This means that the file specified in ListenFIFO (e.g. /rkt/iottymux/0-myapp-container/stage2-stdin) won't exist and iomux will fail with something like this:

Listening on stderr socket for 0-myapp-container.
Listening on stdout socket for 0-myapp-container.
iottymux: runtime failure
  └─invalid stdin FIFO: open /rkt/iottymux/0-myapp-container/stage2-stdin: no such file or directory
Starting Create /etc/passwd and /etc/group...
Listening on stdin socket for 0-myapp-container.
iomux@0-myapp-container.service: Main process exited, code=exited, status=254/n/a
iomux@0-myapp-container.service: Unit entered failed state.
iomux@0-myapp-container.service: Failed with result 'exit-code'.

So I added a Before=iomux.service dependency to the socket units so they start before it, making sure the FIFO exists by the time iomux starts.

@iaguis
Copy link
Member Author

iaguis commented Nov 22, 2017

Even with this PR, iottymux with pre-start hooks won't work unless #3861 is resolved. In any case, this shouldn't hurt.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants