BGP event cancellation synchronization problem
donaldsharp opened this issue · comments
Description
--enable-thread-sanitizer is reporting this:
==================
WARNING: ThreadSanitizer: data race (pid=2729825)
Read of size 8 at 0x7b4800003060 by main thread:
#0 event_cancel_async lib/event.c:1534 (libfrr.so.0+0x58c8fd)
#1 bgp_writes_off bgpd/bgp_io.c:70 (bgpd+0x606986)
#2 bgp_stop bgpd/bgp_fsm.c:1474 (bgpd+0x5f4484)
#3 bgp_stop_with_error bgpd/bgp_fsm.c:1587 (bgpd+0x5f6a60)
#4 bgp_event_update bgpd/bgp_fsm.c:2632 (bgpd+0x601f32)
#5 bgp_process_packet bgpd/bgp_packet.c:4104 (bgpd+0x6c9ade)
#6 event_call lib/event.c:2011 (libfrr.so.0+0x5917b2)
#7 frr_run lib/libfrr.c:1217 (libfrr.so.0+0x3b0437)
#8 main bgpd/bgp_main.c:548 (bgpd+0x499a3d)
Previous write of size 8 at 0x7b4800003060 by thread T2 (mutexes: write M75):
#0 event_fetch lib/event.c:1796 (libfrr.so.0+0x58fe68)
#1 fpt_run lib/frr_pthread.c:368 (libfrr.so.0+0x35151f)
#2 frr_pthread_inner lib/frr_pthread.c:178 (libfrr.so.0+0x34fedb)
Location is heap block of size 336 at 0x7b4800003000 allocated by main thread:
#0 calloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:672 (libtsan.so.0+0x31edc)
#1 qcalloc lib/memory.c:105 (libfrr.so.0+0x3f2819)
#2 bgp_peer_connection_new bgpd/bgpd.c:1204 (bgpd+0x9509bd)
#3 peer_new bgpd/bgpd.c:1520 (bgpd+0x954e07)
#4 peer_create bgpd/bgpd.c:1941 (bgpd+0x95c6c9)
#5 peer_remote_as bgpd/bgpd.c:2211 (bgpd+0x961267)
#6 peer_remote_as_vty bgpd/bgp_vty.c:4788 (bgpd+0x88100c)
#7 neighbor_remote_as bgpd/bgp_vty.c:4869 (bgpd+0x8817fb)
#8 cmd_execute_command_real lib/command.c:1002 (libfrr.so.0+0x2b52fc)
#9 cmd_execute_command_strict lib/command.c:1111 (libfrr.so.0+0x2b5d65)
#10 command_config_read_one_line lib/command.c:1271 (libfrr.so.0+0x2b68cc)
#11 config_from_file lib/command.c:1324 (libfrr.so.0+0x2b6f8f)
#12 vty_read_file lib/vty.c:2607 (libfrr.so.0+0x5c0e3c)
#13 vty_read_config lib/vty.c:2853 (libfrr.so.0+0x5c205a)
#14 frr_config_read_in lib/libfrr.c:981 (libfrr.so.0+0x3ae6f8)
#15 event_call lib/event.c:2011 (libfrr.so.0+0x5917b2)
#16 frr_run lib/libfrr.c:1217 (libfrr.so.0+0x3b0437)
#17 main bgpd/bgp_main.c:548 (bgpd+0x499a3d)
Mutex M75 (0x7b4800002e10) created at:
#0 pthread_mutex_init ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1227 (libtsan.so.0+0x4bee1)
#1 event_master_create lib/event.c:557 (libfrr.so.0+0x582b50)
#2 frr_pthread_new lib/frr_pthread.c:81 (libfrr.so.0+0x34eab5)
#3 bgp_pthreads_init bgpd/bgpd.c:8484 (bgpd+0x9d7495)
#4 bgp_init bgpd/bgpd.c:8536 (bgpd+0x9d7fd6)
#5 main bgpd/bgp_main.c:529 (bgpd+0x4993fc)
Thread T2 'bgpd_io' (tid=2729829, running) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x605b8)
#1 frr_pthread_run lib/frr_pthread.c:197 (libfrr.so.0+0x3500bf)
#2 bgp_pthreads_run bgpd/bgpd.c:8490 (bgpd+0x9d753b)
#3 main bgpd/bgp_main.c:547 (bgpd+0x4999c8)
SUMMARY: ThreadSanitizer: data race lib/event.c:1534 in event_cancel_async
Version
master
How to reproduce
Run topotests with the above configure option and a whole bunch of tests have this issue:
static_routing_with_ebgp
bgp_minimum_holdtime
bgp_aigp
bgp_roles_capability
bgp_prefix_list_any
bgp_local_asn
bgp_default_originate
to name a few
Expected behavior
No issues found by ThreadSanitizer
Actual behavior
See above
Additional context
No response
Checklist
- I have searched the open issues for this bug.
- I have not included sensitive information in this report.