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

Hang when invalid file format is specified #236

Closed
waveform80 opened this Issue Aug 27, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@waveform80
Owner

waveform80 commented Aug 27, 2015

When a format which has a valid MIME type but no associated encoder is specified, picamera hangs.

@waveform80 waveform80 added the bug label Aug 28, 2015

@waveform80 waveform80 added this to the 1.11 milestone Aug 28, 2015

@waveform80 waveform80 self-assigned this Aug 28, 2015

@waveform80

This comment has been minimized.

Show comment
Hide comment
@waveform80

waveform80 Aug 28, 2015

Owner

This occurs because the encoder lock in the camera class is non-re-entrant; the camera class acquires this lock when starting a capture / recording but once the encoder class encounters the unsupported encoding it raises an exception. In doing so, it calls the stop() method which attempts to re-acquire the lock within the same thread and the hang occurs.

This could be fixed by moved the lock acquisition down a line in the stop() method but I'm not sure if this introduces a race condition ... needs more testing.

Owner

waveform80 commented Aug 28, 2015

This occurs because the encoder lock in the camera class is non-re-entrant; the camera class acquires this lock when starting a capture / recording but once the encoder class encounters the unsupported encoding it raises an exception. In doing so, it calls the stop() method which attempts to re-acquire the lock within the same thread and the hang occurs.

This could be fixed by moved the lock acquisition down a line in the stop() method but I'm not sure if this introduces a race condition ... needs more testing.

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