Repository navigation
Description
I was trying to reproduce the hang seen in oxidecomputer/propolis#322 today on my setup, but managed to panic the host machine instead!
WARNING: panicked at 'called `Result::unwrap()` on an `Err` value: MaxCapacity(8096)', /work/oxidecomputer/opte/opte/src/engine/port.rs:1890:17
panic[cpu26]/thread=fffffeb1da1177a0: panicked at 'called `Result::unwrap()` on an `Err` value: MaxCapacity(8096)', /work/oxidecomputer/opte/opte/src/engine/port.rs:1890:17
fffffe00f732ee40 xde:rust_begin_unwind+146 ()
fffffe00f732ee80 xde:_ZN4core9panicking9panic_fmt17hbd42276bcaa2dfd8E+2d ()
fffffe00f732ef00 xde:_ZN4core6result13unwrap_failed17h5b67be868f6dc91bE+6c ()
fffffe00f732f310 xde:_ZN4opte6engine4port13Port$LT$N$GT$7process17h9bca109443cf9deaE+2bdf ()
fffffe00f732fc40 xde:xde_mc_tx+32f ()
fffffe00f732fc70 mac:mac_ring_tx+43 ()
fffffe00f732fcc0 mac:mac_provider_tx+85 ()
fffffe00f732fd80 mac:mac_tx+295 ()
fffffe00f732fe40 viona:viona_tx+48c ()
fffffe00f732fea0 viona:viona_worker_tx+73 ()
fffffe00f732fef0 viona:viona_worker+126 ()
fffffe00f732ff00 unix:thread_start+b ()
dumping to /dev/zvol/dsk/rpool/dump, offset 65536, content: kernel
I did the following:
- use qemu to boot
alpine-virt-3.17.2-x86_64.isoand install it to an nvme drive:
truncate -s 2G install.raw
sudo qemu-system-x86_64 \
-enable-kvm \
-m 2g \
-bios /usr/share/OVMF/OVMF_CODE.fd \
-cdrom /home/jwm/Downloads/alpine-virt-3.17.2-x86_64.iso \
-drive file="install.raw",if=none,format=raw,id=nvme1 \
-device nvme,drive=nvme1,serial=nvme-1,addr=0x4
-
follow the
setup-alpinesteps in guest hung trying to build Go propolis#322 -
halt the VM, boot it again without the ISO
sudo qemu-system-x86_64 \
-enable-kvm \
-m 2g \
-bios /usr/share/OVMF/OVMF_CODE.fd \
-drive file="install.raw",if=none,format=raw,id=nvme1 \
-device nvme,drive=nvme1,serial=nvme-1,addr=0x4
- install packages:
# enable the community repo
vi /etc/apk/repositories
apk update
apk add cloud-init py3-pyserial py3-netifaces e2fsprogs e2fsprogs-extra vim git go bash build-base
- enable cloud init
setup-cloud-init
- set kernel serial console (alpine doesn't do this by default and I was hoping to see some Linux kernel messages during the hang)
vim /etc/default/grub:
GRUB_TERMINAL="serial console"
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200 modules=sd-mod,usb-storage,ext4,nvme quiet rootfstype=ext4"
grub-mkconfig -o /boot/grub/grub.cfg
- allow logging in on the serial console (to debug if the guest wasn't reachable by ssh):
vim /etc/inittab:
# Put a getty on the serial port
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
(comment out ttyS0 line on the bottom)
- disable ipv6:
echo 'net.ipv6.conf.all.disable_ipv6=1' >> /etc/sysctl.conf
-
power off the VM, upload install.raw as an image (I am running Nexus with the current "import to disk" PR)
-
boot an instance from this with 8 CPUs and 16G of RAM
-
in the serial console, I had to set a password for the "alpine" user that cloud-init created, otherwise SSH wouldn't work
-
ssh in as "alpine", then follow the repro steps in guest hung trying to build Go propolis#322:
$ git clone http://github.com/davepacheco/go.git
$ cd go
$ git checkout go1.19.2
$ cd src
$ cat repro.sh
#!/bin/bash
# the suffix "-alpine" is used to skip some tests
export GO_BUILDER_NAME="propolis-alpine"
bash ./make.bash
while bash ./run.bash -run='!(^cgo_test$)' > test.out 2>&1;
do
date;
done
echo "failed"
$ ./repro.sh
In another window, I was running tail -F test.out:
##### Building packages and commands.
##### Test execution environment.
# GOARCH: amd64
# CPU: AMD Ryzen 9 3950X 16-Core Processor
# GOOS: linux
# OS Version: Linux 5.15.96-0-virt #1-Alpine SMP Sat, 25 Feb 2023 21:02:54 +0000 x86_64
##### Testing packages.
ok archive/tar 0.239s
ok archive/zip 0.270s
ok bufio 0.088s
ok bytes 0.695s
ok compress/bzip2 0.068s
ok compress/flate 0.644s
ok compress/gzip 1.072s
ok compress/lzw 0.083s
ok compress/zlib 0.353s
ok container/heap 0.017s
ok container/list 0.001s
ok container/ring 0.013s
ok context 0.040s
ok crypto 0.002s
ok crypto/aes 0.026s
ok crypto/cipher 0.033s
ok crypto/des 0.014s
ok crypto/dsa 0.022s
ok crypto/ecdsa 0.004s
ok crypto/ed25519 0.052s
ok crypto/elliptic 0.013s
ok crypto/hmac 0.037s
ok crypto/internal/boring 0.029s
ok crypto/internal/boring/bcache 0.207s
ok crypto/internal/edwards25519 4.004s
ok crypto/internal/edwards25519/field 2.940s
ok crypto/internal/nistec 0.823s
ok crypto/internal/nistec/fiat 0.002s [no tests to run]
ok crypto/internal/subtle 0.023s
ok crypto/md5 0.008s
ok crypto/rand 0.033s
ok crypto/rc4 0.067s
ok crypto/rsa 0.068s
ok crypto/sha1 0.029s
ok crypto/sha256 0.025s
ok crypto/sha512 0.009s
ok crypto/subtle 0.028s
ok crypto/tls 0.475s
ok crypto/x509 0.513s
ok database/sql 0.275s
ok database/sql/driver 0.020s
ok debug/buildinfo 0.017s
ok debug/dwarf 0.009s
ok debug/elf 0.019s
ok debug/gosym 0.307s
ok debug/macho 0.006s
ok debug/pe 0.019s
ok debug/plan9obj 0.005s
ok embed 0.030s [no tests to run]
ok embed/internal/embedtest 0.002s
ok encoding/ascii85 0.017s
ok encoding/asn1 0.012s
ok encoding/base32 0.055s
ok encoding/base64 0.015s
ok encoding/binary 0.024s
ok encoding/csv 0.025s
ok encoding/gob 0.040s
ok encoding/hex 0.012s
ok encoding/json 0.164s
ok encoding/pem 0.358s
ok encoding/xml 0.066s
ok errors 0.011s
ok expvar 0.022s
ok flag 0.105s
ok fmt 0.043s
ok go/ast 0.009s
ok go/build 1.279s
ok go/build/constraint 0.008s
ok go/constant 0.005s
ok go/doc 0.069s
ok go/doc/comment 0.742s
ok go/format 0.024s
ok go/importer 0.083s
ok go/internal/gccgoimporter 0.030s
ok go/internal/gcimporter 11.476s
ok go/internal/srcimporter 9.951s
ok go/parser 0.191s
ok go/printer 0.221s
ok go/scanner 0.019s
ok go/token 0.030s
ok go/types 5.453s
ok hash 0.017s
ok hash/adler32 0.033s
ok hash/crc32 0.012s
ok hash/crc64 0.022s
ok hash/fnv 0.003s
ok hash/maphash 0.095s
ok html 0.007s
ok html/template 0.085s
ok image 0.067s
ok image/color 0.073s
ok image/draw 0.061s
ok image/gif 10.491s
ok image/jpeg 2.524s
ok image/png 0.136s
ok index/suffixarray 0.125s
ok internal/abi 0.092s
ok internal/buildcfg 0.023s
ok internal/cpu 0.006s
ok internal/diff 0.009s
ok internal/fmtsort 0.022s
ok internal/fuzz 0.006s
ok internal/godebug 0.009s
ok internal/intern 0.218s
ok internal/itoa 0.012s
ok internal/poll 0.223s
ok internal/profile 0.008s
ok internal/reflectlite 0.042s
ok internal/singleflight 0.020s
ok internal/trace 0.065s
ok internal/unsafeheader 0.043s
ok internal/xcoff 0.016s
ok io 0.070s
ok io/fs 0.260s
ok io/ioutil 0.016s
ok log 0.016s
ok log/syslog 1.235s
ok math 0.010s
ok math/big 1.158s
ok math/bits 0.015s
ok math/cmplx 0.036s
ok math/rand 0.178s
ok mime 0.012s
ok mime/multipart 0.131s
ok mime/quotedprintable 0.066s
- exit 255
I saw the panic on the physical host's serial console.
Activity
jmpesp commentedon Mar 3, 2023
jmpesp commentedon Mar 3, 2023
Digging into the crash dump:
jmpesp commentedon Mar 3, 2023
Reassembling this packet into a format wireshark can import:
It looks like a DNS query?
bnaecker commentedon Mar 3, 2023
jmpesp commentedon Mar 3, 2023
346.pcap.zip
jmpesp commentedon Mar 3, 2023
Relevant limits:
opte/xde/src/xde.rs
Lines 96 to 106 in b274cad
These seem a little low, no? Shouldn't they be 65536?
bnaecker commentedon Mar 3, 2023
rmustacc commentedon Mar 3, 2023
Regardless of the limit, we can't panic unwrap when we hit it.
bnaecker commentedon Mar 3, 2023
Agreed. There's a TODO on it and it's part of the issue around auditing panics.
bnaecker commentedon Mar 3, 2023
I'm going to improve this by limiting the flow tables to the number of ports we allocate the the guests. This is in the
VpcCfg. I'm not sure how this will shake out, since folks can have dual stack, which would double the flow-table sizes. That shouldn't matter until we actually support IPv6 guests, so it seems okay to me. It's also not clear the distinction between UFT flows and TCP flows. I think the former is a superset of the latter, but I've not been in this code for a while.luqmana commentedon Mar 6, 2023
Sort of, the TCP flow table is just for cleaning up entries in the main Unified Flow Table (UFT) on TCP close/reset.
opte/opte/src/engine/port.rs
Lines 615 to 642 in b274cad
bnaecker commentedon Apr 27, 2023
Closed by #347. But see #358 which tracks a better solution to the problem.