Bug Description
mirrord's VSCode extension fails to debug the local process.
Steps to Reproduce
- Add this configuration to your launch.json:
{
"type": "lldb",
"request": "launch",
"name": "ops.py: Debug file ops",
"program": "python3",
"args": ["${workspaceFolder}/tests/python-e2e/ops.py"],
"cwd": "${workspaceFolder}",
"sourceMap": {},
"env": {
"DYLD_INSERT_LIBRARIES": "${workspaceFolder}/target/debug/libmirrord_layer.dylib",
"LD_PRELOAD": "${workspaceFolder}/target/debug/libmirrord_layer.so",
"RUST_LOG": "warn,mirrord=debug",
"MIRRORD_AGENT_IMPERSONATED_POD_NAME": "http-echo-deployment-64887f7cdb-4lwrs",
"MIRRORD_AGENT_RUST_LOG": "warn,mirrord=debug",
"MIRRORD_FILE_OPS": "true",
"RUST_BACKTRACE": "short",
"MIRRORD_ACCEPT_INVALID_CERTIFICATES": "true",
"MIRRORD_AGENT_IMAGE": "runtime"
}
}
- Start debugging and choose the impersonated pod
Backtrace
2022-06-20T17:26:58.258050Z INFO mirrord_layer: Initializing mirrord-layer!
2022-06-20T17:26:58.259302Z WARN mirrord_layer::pod_api: Accepting invalid certificates
2022-06-20T17:26:59.597035Z DEBUG mirrord_layer::sockets: getpeername hooked
2022-06-20T17:26:59.597069Z DEBUG mirrord_layer::sockets: getsockname hooked
2022-06-20T17:26:59.597090Z DEBUG mirrord_layer::sockets: accept4 hooked
2022-06-20T17:26:59.597106Z DEBUG mirrord_layer::sockets: dup3 hooked
2022-06-20T17:26:59.597122Z DEBUG mirrord_layer::sockets: accept hooked
FFF
======================================================================
FAIL: test_lseek (__main__.FileOpsTest)
Seeks character by character in a file with Lorem Ipsum text in "/tmp" and verifies the concatenation of the text.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mehula/mirrord/tests/python-e2e/ops.py", line 27, in test_lseek
self.assertFalse(self._check_path_exists_on_host(file_path))
AssertionError: True is not false
======================================================================
FAIL: test_openat (__main__.FileOpsTest)
Opens a directory i.e. "/tmp", then opens a file in temp using openat give the directory file desciptor for "/tmp".
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mehula/mirrord/tests/python-e2e/ops.py", line 43, in test_openat
self.assertFalse(self._check_path_exists_on_host(file_path))
AssertionError: True is not false
======================================================================
FAIL: test_read_write_family (__main__.FileOpsTest)
Reads data from a file in "/tmp" and verifies the text expected is the same as the text written.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mehula/mirrord/tests/python-e2e/ops.py", line 14, in test_read_write_family
self.assertFalse(self._check_path_exists_on_host(file_path))
AssertionError: True is not false
----------------------------------------------------------------------
Ran 3 tests in 0.001s
FAILED (failures=3)
[email protected]:~/mirrord$ kubectl get pods
NAME READY STATUS RESTARTS AGE
http-echo-deployment-64887f7cdb-4lwrs 1/1 Running 7 (6d ago) 6d4h
mirrord-agent-kpjldmsafe-2zrr4 1/1 Running 0 3s
mirrord-agent-ykgeipboyw-2g4tj 1/1 Running 0 4s
[email protected]:~/mirrord$ kubectl logs mirrord-agent-kpjldmsafe-2zrr4
2022-06-20T17:27:00.470051Z DEBUG mirrord_agent: main -> Initializing mirrord-agent.
2022-06-20T17:27:00.470269Z DEBUG mirrord_agent::sniffer: packet_worker -> setting namespace
2022-06-20T17:27:00.470333Z DEBUG mirrord_agent::file: file_worker -> Setting namespace
2022-06-20T17:27:00.471149Z DEBUG mirrord_agent::runtime: set_namespace -> fd 12
2022-06-20T17:27:00.471166Z DEBUG mirrord_agent::sniffer: preparing sniffer
2022-06-20T17:27:00.471169Z DEBUG mirrord_agent::sniffer: prepare_sniffer -> Preparing interface.
2022-06-20T17:27:00.594518Z DEBUG mirrord_agent: start -> Connection accepted from 127.0.0.1:51646
2022-06-20T17:27:01.597675Z DEBUG mirrord_agent: peer_handler -> daemon_stream.next received a message None
2022-06-20T17:27:01.597730Z DEBUG mirrord_agent: start_agent -> Peer 0 closed
2022-06-20T17:27:01.597750Z DEBUG mirrord_agent: ClientMessage::Close -> peer id 0 sent close
2022-06-20T17:27:01.597779Z DEBUG mirrord_agent::sniffer: packet_worker -> setting ports []
2022-06-20T17:27:01.597783Z DEBUG mirrord_agent::sniffer: packet_worker -> empty ports, setting dummy bpf
[email protected]:~/mirrord$ kubectl logs mirrord-agent-ykgeipboyw-2g4tj
2022-06-20T17:26:59.111089Z DEBUG mirrord_agent: main -> Initializing mirrord-agent.
2022-06-20T17:26:59.111252Z DEBUG mirrord_agent::sniffer: packet_worker -> setting namespace
2022-06-20T17:26:59.111253Z DEBUG mirrord_agent::file: file_worker -> Setting namespace
2022-06-20T17:26:59.112627Z DEBUG mirrord_agent::runtime: set_namespace -> fd 12
2022-06-20T17:26:59.112638Z DEBUG mirrord_agent::sniffer: preparing sniffer
2022-06-20T17:26:59.112641Z DEBUG mirrord_agent::sniffer: prepare_sniffer -> Preparing interface.
2022-06-20T17:26:59.593772Z DEBUG mirrord_agent: start -> Connection accepted from 127.0.0.1:51642
2022-06-20T17:27:01.634394Z DEBUG mirrord_agent: peer_handler -> daemon_stream.next received a message None
2022-06-20T17:27:01.634527Z DEBUG mirrord_agent: ClientMessage::Close -> peer id 0 sent close
2022-06-20T17:27:01.634581Z DEBUG mirrord_agent::sniffer: packet_worker -> setting ports []
2022-06-20T17:27:01.634591Z DEBUG mirrord_agent::sniffer: packet_worker -> empty ports, setting dummy bpf
2022-06-20T17:27:01.634536Z DEBUG mirrord_agent: start_agent -> Peer 0 closed
### Relevant Logs
_No response_
### Your operating system and version
[email protected]:~/mirrord$ uname -a Linux mehul-machine 5.13.0-1029-azure #34~20.04.1-Ubuntu SMP Thu Jun 9 12:37:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
### Local process
python3 tests/python-e2e/ops.py
### Local process version
[email protected]:~/mirrord$ python3 -V Python 3.8.10
### Additional Info
_No response_