sdnfv / openNetVM

A high performance container-based NFV platform from GW and UCR.
http://sdnfv.github.io/onvm/
Other
263 stars 135 forks source link

Segmentation Fault From ONVM Web #210

Open kevindweb opened 4 years ago

kevindweb commented 4 years ago

Bug Report

Due to my own code, there is a segfault only when running manager with -s web.

Current Behavior When we run any configuration of manager with -s web, I can get it to segfault every time. The issue is caused by #82 . Key points:

Expected behavior/code We should not have segmentation faults.

Steps to reproduce

  1. Run manager with ./go.sh 0,1,2,3 1 0xF0 -s web
  2. Run any NF, multiple is fine. I tested with:
    • Speed_tester ./go.sh 1 -d 1
    • Basic_monitor ./go.sh 1
  3. Once NF is running, ^C on the manager
  4. Watch segfault

Environment

Possible Solution I think I found the solution, but might want to wait on it until the release is complete to add more PRs. Instead of:

cJSON_Delete(onvm_json_root);
cJSON_Delete(onvm_json_events_arr);

We want:

cJSON_Delete(onvm_json_events_arr);
cJSON_Delete(onvm_json_root);

My thought is that there are shared members between the two cJSON objects, and when root is deleted first, cJSON faults out on line https://github.com/sdnfv/openNetVM/blob/master/onvm/lib/cJSON.c#L1877