Changes

Jump to navigation Jump to search
2,343 bytes added ,  19:40, 26 March 2013
created (based on xemul's CRIU post https://plus.google.com/b/103175467322423551911/103175467322423551911/posts/8yv9pBYJXF8)
This article explains the meaning of "external unix socket" log message, and the purpose of <code>--ext-unix-sk</code> option.

When dumping a process sub-tree, crtools checks that the resulting image is consistent and self-contained, meaning if an object A references another object B, and A goes into dump, then B should be dumped as well. For example, if there is a pipe, and crtools dumps its one end (object A) because it belongs to a process it dumps, it must also dump the other end of the pipe (object B), meaning it should take a process owning B into the image as well. Same is true for unix sockets: if there is a socket (A) that is <code>connect()</code>ed to another socket (B), and crtools dumps socket A (because it is opened by a process it dumps), it must also dump socket B and the task who owns it. Possibly socket B is dumped some time later in the dumping process, but it must be dumped.

This restriction is in place to make sure that upon restore applications will continue to work, rather than, say, receive SIGPIPE singals due to half-closed pipes or sockets.

With that said, "external unix socket" in log means crtools found a unix socket that is connected to another one, but that another one is not dumped, because it belongs to a process not going into the image.

However, sometimes it is possible to dump and restore only one end of a unix socket pair. One example is <code>logd</code> daemon. It opens a datagram unix socket and waits on it for messages to be put into a log file. Processes using logd also create datagram unix sockets and connect those to the logd socket. Such connections are thus uni-directional, meaning that the logd's socket remains unconnected. In this case it is possible to dump a program which is a logd client, we just have to connect its socket back to logd during restore using the logd's socket name.

This is when <code>--ext-unix-sk</code> option should be used. By providing this option (for both dump and restore commands), user states "I know there may be uni-directional unix connections, and I will make sure the server end will exist on restore". When this option is used, crtools dump puts unix sockets with information about the "external" socket it is connected to, and then crtools restore tries to re-connect such sockets back.

== See also ==

* [[Advanced usage]]

Navigation menu