linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bugreport] v4l-utils/libv4lconvert/ov511-decomp does not shutdown on SIGTERM
@ 2014-04-21 13:11 Andrey Volkov
  2014-04-21 18:35 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Volkov @ 2014-04-21 13:11 UTC (permalink / raw)
  To: linux-media; +Cc: volkov.am

Guys,

I use motion for my old web camera (v4l1) with
export LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l2convert.so

v4l2convert.so run decompress helper ov511-decomp.

Processes look like:
/usr/bin/motion
\_ /usr/lib/i386-linux-gnu/libv4lconvert0/ov511-decomp

(motion - http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome)
Everything works fine, but when I stop motion daemon I have to wait for a minute.

strace prints that ov511-decomp got SIGTERM, wait for the minute and then got SIGKILL.

When I do "killall -TERM ov511-decomp" ov511-decomp ignores it and continue to decomress.
"killall -INT ov511-decomp" ov511-decomp shut down as expected.

As a workaround I made this patch to lib/libv4lconvert/helper.c

--- v4l-utils-1.0.1.orig/lib/libv4lconvert/helper.c
+++ v4l-utils-1.0.1/lib/libv4lconvert/helper.c
@@ -212,7 +212,7 @@ void v4lconvert_helper_cleanup(struct v4
void v4lconvert_helper_cleanup(struct v4lconvert_data *data)
{
	int status;

	if (data->decompress_pid != -1) {
-		kill(data->decompress_pid, SIGTERM);
+		kill(data->decompress_pid, SIGINT);
		waitpid(data->decompress_pid, &status, 0);

		close(data->decompress_out_pipe[WRITE_END]);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bugreport] v4l-utils/libv4lconvert/ov511-decomp does not shutdown on SIGTERM
  2014-04-21 13:11 [Bugreport] v4l-utils/libv4lconvert/ov511-decomp does not shutdown on SIGTERM Andrey Volkov
@ 2014-04-21 18:35 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2014-04-21 18:35 UTC (permalink / raw)
  To: Andrey Volkov, linux-media; +Cc: Gregor Jasny

Hi,

Thanks for the bug report. I must say I don't really
like the suggested fix. Can you try removing the kill
altogether and moving the 2 close calls to above
the waitpid call and see if that helps, I think that
is a cleaner solution.

Thanks & Regards,

Hans


On 04/21/2014 03:11 PM, Andrey Volkov wrote:
> Guys,
> 
> I use motion for my old web camera (v4l1) with
> export LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l2convert.so
> 
> v4l2convert.so run decompress helper ov511-decomp.
> 
> Processes look like:
> /usr/bin/motion
> \_ /usr/lib/i386-linux-gnu/libv4lconvert0/ov511-decomp
> 
> (motion - http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome)
> Everything works fine, but when I stop motion daemon I have to wait for a minute.
> 
> strace prints that ov511-decomp got SIGTERM, wait for the minute and then got SIGKILL.
> 
> When I do "killall -TERM ov511-decomp" ov511-decomp ignores it and continue to decomress.
> "killall -INT ov511-decomp" ov511-decomp shut down as expected.
> 
> As a workaround I made this patch to lib/libv4lconvert/helper.c
> 
> --- v4l-utils-1.0.1.orig/lib/libv4lconvert/helper.c
> +++ v4l-utils-1.0.1/lib/libv4lconvert/helper.c
> @@ -212,7 +212,7 @@ void v4lconvert_helper_cleanup(struct v4
> void v4lconvert_helper_cleanup(struct v4lconvert_data *data)
> {
> 	int status;
> 
> 	if (data->decompress_pid != -1) {
> -		kill(data->decompress_pid, SIGTERM);
> +		kill(data->decompress_pid, SIGINT);
> 		waitpid(data->decompress_pid, &status, 0);
> 
> 		close(data->decompress_out_pipe[WRITE_END]);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-21 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 13:11 [Bugreport] v4l-utils/libv4lconvert/ov511-decomp does not shutdown on SIGTERM Andrey Volkov
2014-04-21 18:35 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).