docs: add contiv vpp
[vpp.git] / docs / usecases / contiv / CORE_FILES.md
1 # Capturing VPP core dumps
2 In order to debug a crash of VPP, it is required to provide a coredump file, which allows backtracing of the VPP issue. The following items are the requirements for capturing a coredump:
3
4 #### 1. Disable k8s Probes to Prevent k8s from Restarting the POD with a Crashed VPP
5 As described in [BUG_REPORTS.md](BUG_REPORTS.html#collecting-the-logs-in-case-of-crash-loop).
6
7 #### 2. Modify VPP Startup config file
8 In `/etc/vpp/contiv-vswitch.conf`, add the following lines into the `unix` section:
9
10 ```
11 unix {
12     ...
13     coredump-size unlimited
14     full-coredump
15 }
16 ```
17
18 #### 3. Turn on Coredumps in the Vswitch Container
19 After re-deploying Contiv-VPP networking, enter bash shell in the vswitch 
20 container (use actual name of the vswitch POD - `contiv-vswitch-7whk7` in this case):
21 ```
22 kubectl exec -it contiv-vswitch-7whk7 -n kube-system -c contiv-vswitch bash
23 ```
24
25 Enable coredumps:
26 ```
27 mkdir -p /tmp/dumps
28 sysctl -w debug.exception-trace=1 
29 sysctl -w kernel.core_pattern="/tmp/dumps/%e-%t"
30 ulimit -c unlimited
31 echo 2 > /proc/sys/fs/suid_dumpable
32 ```
33
34 #### 4. Let VPP Crash
35 Now repeat the steps that lead to the VPP crash. You can also force VPP to crash at the point where it is 
36 running (e.g., if it is stuck) by using the SIGQUIT signal:
37 ```
38 kill -3 `pidof vpp`
39 ```
40
41 #### 5. Locate and Inspect the Core File
42 The core file should appear in `/tmp/dumps` in the container:
43 ```
44 cd /tmp/dumps
45 ls
46 vpp_main-1524124440
47 ```
48
49 You can try to backtrace, after installing gdb:
50 ```
51 apt-get update && apt-get install gdb
52 gdb vpp vpp_main-1524124440
53 (gdb) bt
54 ```
55
56 #### 6. Copy the Core File Out of the Container
57 Finally, copy the core file out of the container. First, while still inside the container,
58 pack the core file into an archive:
59
60 ```
61 cd /tmp/dumps
62 tar cvzf vppdump.tar.gz vpp_main-1524124440
63 ```
64
65 Now, on the host, determine the docker ID of the container, and then copy the file out of the host:
66 ```
67 docker ps | grep vswitch_contiv
68 d7aceb2e4876        c43a70ac3d01                                             "/usr/bin/supervisor…"   25 minutes ago      Up 25 minutes                           k8s_contiv-vswitch_contiv-vswitch-zqzn6_kube-system_9923952f-43a6-11e8-be84-080027de08ea_0
69
70 docker cp d7aceb2e4876:/tmp/dumps/vppdump.tar.gz .
71 ```
72
73 Now you are ready to file a bug in [jira.fd.io](https://jira.fd.io/) and attach the core file.