[ovs-discuss] When the controller is disconnected, if you update the port immediately, the ovs will crash.

贾乘 jiacheng at bytedance.com
Tue Mar 12 12:34:39 UTC 2019

Hi All,

This is  my bridge configuration:

Bridge br-int
        Controller "tcp:"
            is_connected: true
        fail_mode: secure
        Port br-int
            Interface br-int
                type: internal
        Port vxlan-vtp
            Interface vxlan-vtp
                type: vxlan
                options: {dst_port="4789", key=flow, local_ip="", remote_ip=flow}
        Port br-ex-patch
            Interface br-ex-patch
                type: patch
                options: {peer=br-int-patch} 
I do something as the following steps:
1.  Disconnect  the controller 
2.  Change the vxlan port interface , the local_ip is set to be "flow”.

The ovs-vswitchd is crashed, then I got the ovs-vswitchd core dump:

#0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007f855f89542a in __GI_abort () at abort.c:89
#2  0x000055e14c6f7fae in ofputil_protocol_to_ofp_version (protocol=<optimized out>) at lib/ofp-protocol.c:123
#3  0x000055e14c6f32ce in ofputil_encode_port_status (ps=ps at entry=0x7ffdfceab670, protocol=<optimized out>) at lib/ofp-port.c:938
#4  0x000055e14c662dcb in connmgr_send_port_status (mgr=0x55e14da54370, source=source at entry=0x0, pp=pp at entry=0x55e14db9af50, reason=reason at entry=2 '\002')
    at ofproto/connmgr.c:1654
#5  0x000055e14c62bf26 in update_port (ofproto=ofproto at entry=0x55e14db778e0, name=name at entry=0x55e14dbe01a0 "vxlan-vtp") at ofproto/ofproto.c:2652
#6  0x000055e14c62c477 in ofproto_run (p=0x55e14db778e0) at ofproto/ofproto.c:1818
#7  0x000055e14c61a8bc in bridge_run__ () at vswitchd/bridge.c:2944
#8  0x000055e14c61bc71 in bridge_reconfigure (ovs_cfg=ovs_cfg at entry=0x55e14da5ab10) at vswitchd/bridge.c:721
#9  0x000055e14c61fba9 in bridge_run () at vswitchd/bridge.c:3023
#10 0x000055e14c2bdbdd in main (argc=<optimized out>, argv=<optimized out>) at vswitchd/ovs-vswitchd.c:125

From the code ,  the function connmgr_send_port_status try to send the message of the port status update to every controller connection, but since I disconnect the controller , the rconn state is S_BACKOFF.  So based on the function 
ofconn_get_protocol, the protocol will be OFPUTIL_P_NONE. When calling ofputil_encode_port_status with none protocol, the ovs-vswitchd is crashed.

connmgr_send_port_status. —>  ofconn_get_protocol (conn disconnected, it return none protocol)
                                             —> ofputil_encode_port_status. (With None protocol , ovs-vswitchd crash)

So I suggest to check if the protocol is null before calling ofputil_encode_port_status.

Jia Cheng.

More information about the discuss mailing list