Skip to content

Commit 3d18abc

Browse files
Sudan Landgepb8o
authored andcommitted
fix: intermittent vsock timeout in snapshot tests
Instead of creating a new socat process on every guest resume, create socat process in the 1st guest created so that the snap shotted guests just use the same process through. Suspend and resume socat process before taking snapshot and after resuming from snapshot respectively to make sure the process is in the right state for the snapshot. The socket connection is reset by Firecracker while creating a snapshot so it seems to leave socat in a weird state and without stop/cont 'ng socat before/after snapshot we end up in a vsock timeout when host tries to connect to guest in _vsock_connect_to_guest(). Signed-off-by: Sudan Landge <[email protected]>
1 parent 6be6cae commit 3d18abc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/integration_tests/functional/test_snapshot_basic.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def test_5_snapshots(
112112

113113
logger.info("Create %s #0.", snapshot_type)
114114
# Create a snapshot from a microvm.
115+
start_guest_echo_server(vm)
115116
snapshot = vm.make_snapshot(snapshot_type)
116117
base_snapshot = snapshot
117118

@@ -120,17 +121,23 @@ def test_5_snapshots(
120121
microvm = microvm_factory.build()
121122
microvm.spawn()
122123
microvm.restore_from_snapshot(snapshot, resume=True)
124+
# TODO: SIGCONT here and SIGSTOP later before creating snapshot
125+
# is a temporary fix to avoid vsock timeout in
126+
# _vsock_connect_to_guest(). This will be removed once we
127+
# find the right solution for the timeout.
128+
vm.ssh.run("pkill -SIGCONT socat")
123129
# Test vsock guest-initiated connections.
124130
path = os.path.join(
125131
microvm.path, make_host_port_path(VSOCK_UDS_PATH, ECHO_SERVER_PORT)
126132
)
127133
check_guest_connections(microvm, path, vm_blob_path, blob_hash)
128134
# Test vsock host-initiated connections.
129-
path = start_guest_echo_server(microvm)
135+
path = os.path.join(microvm.jailer.chroot_path(), VSOCK_UDS_PATH)
130136
check_host_connections(path, blob_path, blob_hash)
131137

132138
# Check that the root device is not corrupted.
133139
check_filesystem(microvm.ssh, "squashfs", "/dev/vda")
140+
vm.ssh.run("pkill -SIGSTOP socat")
134141

135142
logger.info("Create snapshot %s #%d.", snapshot_type, i + 1)
136143
snapshot = microvm.make_snapshot(snapshot_type)

0 commit comments

Comments
 (0)