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

Fix playback destructor crash #9299

Merged
merged 3 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/media/playback/playback_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ rs2_extrinsics playback_device::calc_extrinsic(const rs2_extrinsics& from, const

playback_device::~playback_device()
{
(*m_read_thread)->invoke([this](dispatcher::cancellable_timer c)
{
std::lock_guard<std::mutex> locker(_active_sensors_mutex);
for (auto&& sensor : m_active_sensors)
Expand All @@ -161,12 +160,6 @@ playback_device::~playback_device()
sensor.second->stop();
}
}
});

if((*m_read_thread)->flush() == false)
{
LOG_ERROR("Error - timeout waiting for flush, possible deadlock detected");
assert(0); //Detect this immediately in debug
}

(*m_read_thread)->stop();
Expand Down Expand Up @@ -454,8 +447,8 @@ void playback_device::start()
catch_up();
try_looping();
LOG_INFO("Playback started");

}

void playback_device::stop()
{
LOG_DEBUG("playback stop called");
Expand All @@ -469,8 +462,8 @@ void playback_device::stop()
LOG_ERROR("Error - timeout waiting for flush, possible deadlock detected");
assert(0); //Detect this immediately in debug
}
LOG_INFO("Playback stoped");

LOG_INFO("Playback stopped");
}

void playback_device::stop_internal()
Expand All @@ -482,10 +475,7 @@ void playback_device::stop_internal()

m_is_started = false;
m_is_paused = false;
for (auto sensor : m_sensors)
{
//sensor.second->flush_pending_frames();
}

m_reader->reset();
m_prev_timestamp = std::chrono::nanoseconds(0);
catch_up();
Expand Down Expand Up @@ -524,7 +514,6 @@ void playback_device::do_loop(T action)
{
if( psc )
{
psc->flush_pending_frames();
psc->stop( false );
}
}
Expand Down
20 changes: 8 additions & 12 deletions unit-tests/live/rec-play/test-got-playback-frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,14 @@ def stop_sensor( sensor ):
except Exception:
test.unexpected_exception()
finally: # we must remove all references to the file so we can use it again in the next test
if recorder:
recorder.pause()
recorder = None
if playback:
playback.pause()
playback = None
stop_sensor( depth_sensor )
depth_sensor = None
stop_sensor( color_sensor )
color_sensor = None
if recorder:
recorder = None
if playback:
playback = None

test.finish()

Expand Down Expand Up @@ -240,16 +238,14 @@ def stop_sensor( sensor ):
except Exception:
test.unexpected_exception()
finally: # we must remove all references to the file so the temporary folder can be deleted
if recorder:
recorder.pause()
recorder = None
if playback:
playback.pause()
playback = None
stop_sensor( depth_sensor )
depth_sensor = None
stop_sensor( color_sensor )
color_sensor = None
if recorder:
recorder = None
if playback:
playback = None

test.finish()

Expand Down
3 changes: 3 additions & 0 deletions unit-tests/py/rspy/libci.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ def command( self ):
# -S : don't imply 'import site' on initialization
# NOTE: exit() is defined in site.py and works only if the site module is imported!
cmd += ['-S']
# '-u' --> Force stdin, stdout and stderr to be totally unbuffered
# We saw that with stdout buffing, it a test would exit on an access violation, no log can be found since it was buffered.
maloel marked this conversation as resolved.
Show resolved Hide resolved
cmd += ['-u']
if sys.flags.verbose:
cmd += ["-v"]
cmd += [self.path_to_script]
Expand Down