Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when using cache and rib period filter with some specific inputs #223

Open
phenschke opened this issue Jan 10, 2022 · 1 comment

Comments

@phenschke
Copy link

Hello,
I've observed some odd behavior (Segmentation fault) for the route-views.isc collector when the cache is enabled and a RIB period filter is used (with the goal of obtaining just the first RIB in the time window) with specific time window starting times around January 15th, 2009. The time window end time does not seem to matter, as long as it's longer than ~2hrs (long enough to contain more than 1 RIB?).

Cache enabled:

debian@ba-henschke:/srv/ba-henschke$ bgpreader -w '2009-01-14 03:50:00','2010-01-14 11:50:00' -P 9999999 -c route-views.isc -o cache-dir=./bgpstream_cache -t ribs
Segmentation fault
debian@ba-henschke:/srv/ba-henschke$ bgpreader -w '2009-01-15 00:00:00','2009-01-15 23:59:00' -P 9999999 -c route-views.isc -o cache-dir=./bgpstream_cache -t ribs
Segmentation fault

For the second command here, changing the start time down to 23:49:00 of the previous day or up to 00:04:00 makes it run without issues.

When caching is not used, the commands work just fine:

debian@ba-henschke:/srv/ba-henschke$ bgpreader -w '2009-01-14 03:50:00','2010-01-14 11:50:00' -P 9999999 -c route-views.isc -t ribs -n 3
INFO: Processing at most 3 records
R|B|1231911817.000000|routeviews|route-views.isc|||V|1231911780
R|R|1231911817.000000|routeviews|route-views.isc|||11608|198.32.176.19|3.0.0.0/8|198.32.176.137|11608 15412 9304 80|80|11608:444 11608:801 11608:1008 11608:6601 15412:603 15412:621 15412:703 15412:1311 15412:4550||
R|R|1231911817.000000|routeviews|route-views.isc|||6079|198.32.176.126|3.0.0.0/8|198.32.176.126|6079 2914 9304 80|80|||
R|R|1231911817.000000|routeviews|route-views.isc|||2914|198.32.176.14|3.0.0.0/8|198.32.176.14|2914 9304 80|80|2914:410 2914:2403 2914:3400||

debian@ba-henschke:/srv/ba-henschke$ bgpreader -w '2009-01-15 00:00:00','2009-01-15 23:59:00' -P 9999999 -c route-views.isc -t ribs -n 3
INFO: Processing at most 3 records
R|B|1231984177.000000|routeviews|route-views.isc|||V|1231984140
R|R|1231984177.000000|routeviews|route-views.isc|||11608|198.32.176.19|3.0.0.0/8|198.32.176.137|11608 15412 9304 80|80|11608:444 11608:801 11608:1008 11608:6601 15412:603 15412:621 15412:703 15412:1311 15412:4550||
R|R|1231984177.000000|routeviews|route-views.isc|||6079|198.32.176.126|3.0.0.0/8|198.32.176.126|6079 15412 9304 80|80|||
R|R|1231984177.000000|routeviews|route-views.isc|||2914|198.32.176.14|3.0.0.0/8|198.32.176.14|2914 9304 80|80|2914:410 2914:2403 2914:3400||

Valgrind output for the seg fault:

debian@ba-henschke:/srv/ba-henschke$ valgrind bgpreader -w '2009-01-14 03:50:00','2010-01-14 11:50:00' -P 9999999 -c route-views.isc -o cache-dir=./bgpstream_cache -t ribs
==563515== Memcheck, a memory error detector
==563515== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==563515== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==563515== Command: bgpreader -w 2009-01-14\ 03:50:00,2010-01-14\ 11:50:00 -P 9999999 -c route-views.isc -o cache-dir=./bgpstream_cache -t ribs
==563515== 
==563515== Invalid read of size 8
==563515==    at 0x48613F4: bgpstream_resource_set_attr (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x4864E7C: ??? (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x48656F2: bsdi_broker_update_resources (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x485D37C: bgpstream_di_mgr_get_next_record (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x10AACF: ??? (in /usr/bin/bgpreader)
==563515==    by 0x4A8DD09: (below main) (libc-start.c:308)
==563515==  Address 0x48 is not stack'd, malloc'd or (recently) free'd
==563515== 
==563515== 
==563515== Process terminating with default action of signal 11 (SIGSEGV)
==563515==  Access not within mapped region at address 0x48
==563515==    at 0x48613F4: bgpstream_resource_set_attr (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x4864E7C: ??? (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x48656F2: bsdi_broker_update_resources (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x485D37C: bgpstream_di_mgr_get_next_record (in /usr/lib/x86_64-linux-gnu/libbgpstream.so.3.0.0)
==563515==    by 0x10AACF: ??? (in /usr/bin/bgpreader)
==563515==    by 0x4A8DD09: (below main) (libc-start.c:308)
[...]

I found the time windows here randomly; there might be similar behavior for other time periods and also on other collectors.

Using libbgpstream v2.2.0.

@phenschke
Copy link
Author

Encountered this issue again for a current time window on route-views4. Reproducible example:

debian@ba-henschke:/srv$ bgpreader -w '2022-02-01 00:00:00','2022-02-01 10:00:00' -P 9999999 -c route-views4 -o cache-dir=bgpstream_cache -t ribs
[... lots of output ...]
R|R|1643673646.000000|routeviews|route-views4|||34288|2001:4b27:ffff::32|fdaa:54:2::/64|2001:4b27:ffff::32|34288 12703 20712 20712 20712 20712|20712|65500:50000 65500:59000 65500:59120||
R|E|1643673646.000000|routeviews|route-views4|||V|1643673600
Segmentation fault

Same command without cache option works fine.
I don't need the caching option for my purposes; just reporting this issue so it's out there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant