Bug 1216 - RvBatteryModel segfalts if the update event happens before load changes
RvBatteryModel segfalts if the update event happens before load changes
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: energy
ns-3-dev
All All
: P5 normal
Assigned To: Cristiano Tapparello
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-13 11:10 EDT by Claudio
Modified: 2015-04-30 18:32 EDT (History)
2 users (show)

See Also:


Attachments
Mercurial patchset. Import with "hg import <patchfile>" (1.47 KB, patch)
2011-07-13 11:10 EDT, Claudio
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Claudio 2011-07-13 11:10:05 EDT
Created attachment 1198 [details]
Mercurial patchset. Import with "hg import <patchfile>"

Fix RvBatteryModel: it could cause segfaults at some times, if somehow Discharge() was called with an empty m_timeStamps (ie, if the energy model update event happened before load changes)

I found this condition when running benchmarks (repeated execution of tests), so it's not an impossible path.

The modified logic, also, is independent of at what timestamp the simulator starts processing model changes (ie, a model that is assigned in the middle of the simulation would have its DoStart method called at non-zero time).
Comment 1 Cristiano Tapparello 2015-04-30 18:32:50 EDT
Used the patch for updating the RV Battery Model behavior.