On 2/1/24 04:33, Huangzhidong via discuss wrote:
> Hi
> 
> I have two bridges, vds1-br and vds1-br-ex, connected by patch ports
> with OVS 3.2. When I configure RSTP on both bridges, it causes the
> OVS process to crash and restart repeatedly.
> 
> [root@localhost ~]# ovs-vsctl set Bridge vds1-br-ex rstp_enable=true
> [root@localhost ~]# ovs-vsctl set Bridge vds1-br rstp_enable=true ->at this 
> time, ovs crash and ovsdb poll
> 
> 2024-02-01T02:35:00Z|00002|fatal_signal|WARN|terminating with signal 2 
> (Interrupt)
> 
> [root@localhost ~]# ps aux | grep ovs
> root     4173731  0.0  0.0  13712  2572 ?        S<s  10:07   0:00 
> ovsdb-server: monitoring pid 4173732 (healthy)
> root     4173732  0.0  0.0  14844  8080 ?        S<   10:07   0:00 
> ovsdb-server /usr/local/etc/openvswitch/conf.db -vconsole:emer -vsyslog:err 
> -vfile:info --remote=punix:/usr/local/var/run/openvswitch/db.sock 
> --private-key=db:Open_vSwitch,SSL,private_key 
> --certificate=db:Open_vSwitch,SSL,certificate 
> --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir 
> --log-file=/usr/local/var/log/openvswitch/ovsdb-server.log 
> --pidfile=/usr/local/var/run/openvswitch/ovsdb-server.pid --detach --monitor
> root     4173747  0.0  0.0  50476 10240 ?        S<s  10:07   0:00 
> ovs-vswitchd: monitoring pid 4176348 (7 crashes: pid 4176261 died, killed 
> (Aborted), core dumped)
> root     4176348  103  0.0 286086580 184520 ?    D<Ll 10:29   0:17 
> ovs-vswitchd unix:/usr/local/var/run/openvswitch/db.sock -vconsole:emer 
> -vsyslog:err -vfile:info --mlockall --no-chdir 
> --log-file=/usr/local/var/log/openvswitch/ovs-vswitchd.log 
> --pidfile=/usr/local/var/run/openvswitch/ovs-vswitchd.pid --detach –monitor
> 
> From core , I can get:
> #0  rstp_port_received_bpdu (rp=0x562c718d0ed0, bpdu=0x562c718dbaa1, 
> bpdu_size=36) at lib/rstp.c:238
> #1  0x0000562c703aa415 in rstp_process_packet (packet=<optimized out>, 
> xport=<optimized out>) at ./lib/dp-packet.h:619
> #2  0x0000562c703aad22 in process_special (ctx=ctx@entry=0x7fff448169c0, 
> xport=xport@entry=0x562c719192f0) at ofproto/ofproto-dpif-xlate.c:3443
> #3  0x0000562c703ad4b3 in patch_port_output (ctx=ctx@entry=0x7fff448169c0, 
> in_dev=in_dev@entry=0x562c7191c190, out_dev=0x562c719192f0,
>     is_last_action=is_last_action@entry=true) at 
> ofproto/ofproto-dpif-xlate.c:3951
> #4  0x0000562c703af17a in compose_output_action__ 
> (ctx=ctx@entry=0x7fff448169c0, ofp_port=1, xr=xr@entry=0x0, 
> check_stp=check_stp@entry=true,
>     is_last_action=<optimized out>, truncate=truncate@entry=false) at 
> ofproto/ofproto-dpif-xlate.c:4274
> #5  0x0000562c703b0f61 in compose_output_action (truncate=false, 
> is_last_action=<optimized out>, xr=0x0, ofp_port=<optimized out>, 
> ctx=0x7fff448169c0)
>     at ofproto/ofproto-dpif-xlate.c:5374
> #17 0x0000562c704d27ae in rstp_port_set_mac_operational (p=0x562c718df850, 
> new_mac_operational=<optimized out>) at lib/rstp.c:1042
> #18 0x0000562c703778d7 in ofproto_port_set_rstp (ofproto=0x562c718974c0, 
> ofp_port=1, s=s@entry=0x7fff44818450) at ofproto/ofproto.c:1271
> 
> It caused by rstp_mutex set to PTHREAD_MUTEX_INITIALIZER, it does not allow 
> RECURSIVE.
> 
> From stp_mutex, it says:
> 
>         /* We need a recursive mutex because stp_send_bpdu() could loop back
>          * into the stp module through a patch port.  This happens
>          * intentionally as part of the unit tests.  Ideally we'd ditch
>          * the call back function, but for now this is what we have. */
>         ovs_mutex_init_recursive(&mutex);
>  
> 
> And the early version of RSTP also used recursive mutex locks.
> 
> With commit * lib/rstp: Remove lock recursion.( 
> SHA-1:6b90bc57e7a23b89a594ceb857f8267c8b4026df ,
> Change the RSTP send_bpdu interface so that a recursive mutex is not 
> needed.), RECURSIVE lock
> has been canceled.
> 
> May I still need a RECURSIVE lock for rstp?

Thanks for the report!

Indeed, the mutex has to be recursive in the current version of the code
for the same reason STP mutex is recursive.

I can prepare a patch to fix this.

Best regards, Ilya Maximets.

_______________________________________________
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to