| Summary: | cannot open camera with OpenCV/v4l under valgrind | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | João M. S. Silva <joao.m.santos.silva> |
| Component: | memcheck | Assignee: | Julian Seward <jseward> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | philippe.waroquiers |
| Priority: | NOR | ||
| Version First Reported In: | 3.8.0 | ||
| Target Milestone: | --- | ||
| Platform: | Mint (Ubuntu based) | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
testcase
Valgrind's trace-syscalls log strace's log |
||
Any quick hints on this case? (In reply to comment #1) > Any quick hints on this case? I guess special library and/or hardware to reproduce that, even with your small reproducer. maybe valgrind --trace-syscalls=yes your_test_case (or when running the real application) can help to see what is going wrong ? You might compare the syscall done under valgrind with the syscalls done when running natively (i.e. use strace your_test_case) As to valgrind --trace-syscalls=yes, the relevant lines seem:
(...)
SYSCALL[10524,1]( 2) sys_open ( 0x7fefffea0(/dev/video0), 0 ) --> [async] ...
SYSCALL[10524,1]( 2) ... [async] --> Success(0x0:0x7)
SYSCALL[10524,1]( 3) sys_close ( 7 )[sync] --> Success(0x0:0x0)
(...)
SYSCALL[10524,1](257) sys_openat ( 4294967196, 0x7fefffea0(/dev/video0), 2050 )==10524== Warning: invalid file descriptor -100 in syscall openat()
--> [pre-fail] Failure(0x9)
SYSCALL[10524,1]( 16) sys_ioctl ( 4294967295, 0xffffffff80685600, 0x12d762d8 ) --> [async] ...
SYSCALL[10524,1]( 16) ... [async] --> Failure(0x9)
SYSCALL[10524,1](257) sys_openat ( 4294967196, 0x7fefffea0(/dev/video0), 2 )==10524== Warning: invalid file descriptor -100 in syscall openat()
--> [pre-fail] Failure(0x9)
SYSCALL[10524,1]( 16) sys_ioctl ( 4294967295, 0x803c7601, 0x12d7608c ) --> [async] ...
SYSCALL[10524,1]( 16) ... [async] --> Failure(0x9)
As for strace:
open("/dev/video0", O_RDONLY) = 7
close(7) = 0
(...)
openat(AT_FDCWD, "/dev/video0", O_RDWR|O_NONBLOCK) = 7
I attach the logs.
It looks like open/close run OK under Valgrind, but openat doesn't. Does this help in identifying the problem or hinting at a workaround? Thanks.
Created attachment 85946 [details]
Valgrind's trace-syscalls log
Created attachment 85947 [details]
strace's log
(In reply to comment #3) > It looks like open/close run OK under Valgrind, but openat doesn't. Does > this help in identifying the problem or hinting at a workaround? Thanks. Yes, it helps. I believe this is bug 307103, which has been fixed in valgrind 3.9.0. Please upgrade to 3.9.0 (or the SVN version), and see if that solves the problem. Thanks, I compiled version 3.9.0, since it is not yet available from Mint and it solves the problem. There are some errors in V4L functions, but I think this has to be reported to V4L which I did but there seems to be no easy follow up (they use a mailing list which is hard to follow). Thanks for the feedback, closing as duplicate *** This bug has been marked as a duplicate of bug 307103 *** |
Created attachment 85416 [details] testcase Under valgrind, opening a camera device with OpenCV (which uses v4l) does not work: ==1031== Warning: invalid file descriptor -100 in syscall openat() ==1031== Warning: invalid file descriptor -100 in syscall openat() I'm adding a testcase which replicates the problem.