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

explorer segfault #235

Closed
pat1 opened this issue Sep 2, 2020 · 3 comments · Fixed by #238
Closed

explorer segfault #235

pat1 opened this issue Sep 2, 2020 · 3 comments · Fixed by #238
Assignees

Comments

@pat1
Copy link
Contributor

pat1 commented Sep 2, 2020

python3 check.py 
None
arpae-aq
4390720
1240120
Errore di segmentazione (core dump creato)

check.zip

#!/usr/bin/python3
import dballe

with dballe.Explorer("report_fixed.json") as explorer:

    for cur in explorer.query_summary({'var': 'B12101'}):
        print (cur["ident"])
        print (cur["report"])
        print (cur.enqi("lat"))
        print (cur.enqi("lon"))
        print (cur["datetimemin"])
        print (cur["datetimemax"])
        print (cur["leveltype1"])
        print (cur["l1"])
        print (cur["leveltype2"])
        print (cur["l2"])
        print (cur["pindicator"])
        print (cur["p1"])
        print( cur["p2"])
        print( cur["var"])
@edigiacomo
Copy link
Member

I cannot reproduce the problem with a JSON summary created from a BUFR message. Could you please provide the original BUFR corresponding to report_fixed.json?

@edigiacomo
Copy link
Member

edigiacomo commented Sep 18, 2020

Ok, I think I have understood the problem. Debugging the program, I found that in https://github.com/ARPA-SIMC/dballe/blob/v8.12-1/dballe/db/summary-access.in.cc#L21 it seems that the items vector of station_entry is empty

      {<dballe::core::SmallSet<dballe::db::summary::VarEntry, dballe::db::summary::VarDesc, dballe::db::summary::station_entry_get_value>> = {items = std::vector of length 0, capacity 0, dirty = 0}, station = {report = "arpae-aq", coords = {lat = 4390720, lon = 1240120}, ident = {value = 0x0}}}

Then var_entry is equals to station_entry.end() and when the requested key is associated to var_entry, e.g. "datetimemax":

case "datetimemax": if (var_entry->dtrange.is_missing()) return; else enq.set_datetime(var_entry->dtrange.max.year);

And this causes the segmentation fault.

If I use an empty query, the problem doesn't occur because station_entry.items is always not empty.

@edigiacomo
Copy link
Member

I have created PR #238, but I'm waiting for a review by @spanezz

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

Successfully merging a pull request may close this issue.

3 participants