# reproducible segfault in master branch

**URL:** <https://community.zeek.org/t/reproducible-segfault-in-master-branch/5413>\
**Category:** Development\
**Tags:** development\
**Created:** [August 15, 2018, 3:19am UTC](https://community.zeek.org/t/reproducible-segfault-in-master-branch/5413 "2018-08-15T03:19:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Dopheide](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Michael\_Dopheide](https://community.zeek.org/u/Michael_Dopheide)\
**Post date:** [August 15, 2018, 3:19am UTC](https://community.zeek.org/t/reproducible-segfault-in-master-branch/5413/1 "2018-08-15T03:19:59Z")

</div>



---

<div class="post-metadata">

**Author:** ![Jon\_Siwek](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@Jon\_Siwek](https://community.zeek.org/u/Jon_Siwek)\
**Post date:** [August 15, 2018, 4:18pm UTC](https://community.zeek.org/t/reproducible-segfault-in-master-branch/5413/2 "2018-08-15T16:18:45Z")

</div>

You'll get a better error message/behavior now using:

[https://github.com/bro/bro/commit/f336c8c710bdeb41eb0aba88967ee90da24848b2](https://github.com/bro/bro/commit/f336c8c710bdeb41eb0aba88967ee90da24848b2)

But ultimately, you likely want to do something like this patch:

```auto
--- known-hosts-with-dns.bro.orig 2018-08-15 11:07:41.000000000 -0500
+++ known-hosts-with-dns.bro 2018-08-15 10:44:03.000000000 -0500
@@ -113,7 +113,7 @@
  for (ip in r$result as addr_set){
  when ( local res = Broker::get(Known::host_store$store,ip)){

- if(res?$result){
+ if(res$status == Broker::SUCCESS){
  @if ( ! Cluster::is_enabled() )
  Known::hosts[ip] = fmt("%s",res$result as string);
  @else

```

As for why some keys no longer exist in those lookups immediately  
after retrieving the full key set: my guess is they simply expired  
between those two points in time, but I didn't dig into it. The main  
point would be to never assume the Broker::get() call succeeds, which  
was likely your intent, except "res?$result" is always true (another  
form of checking the data exists would be "res$result?$data").

- Jon

---

<div class="post-metadata">

**Author:** ![Michael\_Dopheide](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Michael\_Dopheide](https://community.zeek.org/u/Michael_Dopheide)\
**Post date:** [August 15, 2018, 4:39pm UTC](https://community.zeek.org/t/reproducible-segfault-in-master-branch/5413/3 "2018-08-15T16:39:52Z")

</div>

Excellent, thanks Jon!

-Dop

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:45pm UTC](https://community.zeek.org/t/reproducible-segfault-in-master-branch/5413/4 "2022-05-06T15:45:59Z")

</div>


