-
Notifications
You must be signed in to change notification settings - Fork 498
Race condition in time reset for sensors #236
Comments
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). I've found a workaround by editing Sensor::Update to not update if the world is paused (see commit to my dev branch) (a9f8370). With this change, you can get consistent behavior by resetting the world while paused, though resetting while unpaused is still unpredictable. I haven't done a pull request because I'm not sure how this change would impact other sensor behavior and possibly rendering while paused. |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). I've added a failing test to branch issue_236 to illustrate the problem. On my desktop in an xterm, it fails every time that I run it. If I ssh to my own machine, so that I don't have X windows, it fails between 10% and 50% of the time. |
Original comment by Nate Koenig (Bitbucket: Nathan Koenig).
|
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). I merged branch issue_236 with default to resolve a conflict. |
Original comment by Nate Koenig (Bitbucket: Nathan Koenig). |
Original comment by Nate Koenig (Bitbucket: Nathan Koenig).
Fixed in pull request #332 |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
I just noticed a regression and modified Sensor_TEST.cc in 15c9e12 (branch issue_236_regression) to illustrate the failure. The test on that branches gives the following console output:
|
Original comment by Nate Koenig (Bitbucket: Nathan Koenig).
On hold until after June 2013. |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
|
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
this is broken for ImuSensor since lastMeasurementTime is not reset after world resets |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). Added failing test in branch |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). The following kinda works:
but is not a true fix because mutexLastUpdateTime is a private member of the Sensor class and does not protect against the modification of |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters). Even better fix in pull request #1448 |
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
|
Original comment by Nate Koenig (Bitbucket: Nathan Koenig).
|
Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
Sensors may not be successfully reset by a world_control message. There is a race condition between the Sensor::OnControl and World::OnControl functions since they are in different threads. If Sensor::OnControl executes first, then each sensor's lastUpdateTime will be reset to 0. However, a Sensor::Update may run before World::OnControl executes, which may increase the value of lastUpdateTime to the current sim time.
Basically, the sensors shouldn't be reset until the World has been reset, and these OnControl callbacks don't guarantee that.
The text was updated successfully, but these errors were encountered: