aravis icon indicating copy to clipboard operation
aravis copied to clipboard

Access violation on Windows

Open Jean-PhilippeGoerke opened this issue 3 years ago • 6 comments

Describe the bug When handling frame packets from the camera an access violation occurs in aravis. As long as packets are blocked by the firewall nothing happens, but as soon as it is turned off the error occurs.

To Reproduce I build the library using the current MSYS2 version.

Here the meson logs:

$ meson build
The Meson build system
Version: 0.62.2
Source dir: ....../aravis
Build dir: ....../aravis/build
Build type: native build
Project name: aravis
Project version: 0.8.22
C compiler for the host machine: cc (gcc 12.1.0 "cc (Rev2, Built by MSYS2 project) 12.1.0")
C linker for the host machine: cc ld.bfd 2.38
C++ compiler for the host machine: c++ (gcc 12.1.0 "c++ (Rev2, Built by MSYS2 project) 12.1.0")
C++ linker for the host machine: c++ ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wduplicated-branches: YES
Compiler for C supports arguments -Wimplicit-fallthrough: YES
Compiler for C supports arguments -Wmisleading-indentation: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wunused: YES
Compiler for C supports arguments -Wunused-variable: YES
Compiler for C supports arguments -Wdeclaration-after-statement: YES
Compiler for C supports arguments -Wformat=2: YES
Compiler for C supports arguments -Wimplicit-function-declaration: YES
Compiler for C supports arguments -Winit-self: YES
Compiler for C supports arguments -Wmissing-include-dirs: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wformat-nonliteral: YES
Compiler for C supports arguments -Wenum-conversion: YES
Compiler for C supports arguments -Wmaybe-uninitialized: YES
Compiler for C supports arguments -fvisibility=hidden: YES
Found pkg-config: C:\msys64\mingw64\bin/pkg-config.EXE (1.8.0)
Run-time dependency glib-2.0 found: YES 2.72.2
Run-time dependency gobject-2.0 found: YES 2.72.2
Run-time dependency gio-2.0 found: YES 2.72.2
Run-time dependency libxml-2.0 found: YES 2.9.14
Run-time dependency zlib found: YES 1.2.12
Found CMake: C:\msys64\mingw64\bin/cmake.EXE (3.23.2)
Run-time dependency libusb-1.0 found: NO (tried pkgconfig and cmake)
Library m found: YES
Library ws2_32 found: YES
Library iphlpapi found: YES
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Found pkg-config: C:\msys64\mingw64\bin/pkg-config.EXE (1.8.0)
Program glib-compile-resources found: YES (C:\msys64\mingw64\bin/glib-compile-resources.EXE)
Configuring arvapi.h using configuration
Configuring arvfeatures.h using configuration
Configuring arvparamsprivate.h using configuration
Configuring arvversion.h using configuration
Program glib-compile-resources found: YES (C:\msys64\mingw64\bin/glib-compile-resources.EXE)
Program g-ir-scanner found: NO
Run-time dependency gobject-introspection-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency gtk+-3.0 found: NO (tried pkgconfig and cmake)
Run-time dependency gstreamer-base-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency gstreamer-app-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency gstreamer-video-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency gstreamer-base-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency gstreamer-app-1.0 found: NO (tried pkgconfig and cmake)
Dependency gi-docgen skipped: feature documentation disabled
Build targets in project: 35

aravis 0.8.22

  Directories
    prefix          : C:/msys64/mingw64
    bindir          : bin
    libdir          : lib
    datadir         : share

  Options
    Viewer          : False
    GStreamer plugin: False
    USB support     : False

Found ninja-1.11.0 at C:\msys64\mingw64\bin/ninja.EXE

Here the compilation log:

$ ninja
The Meson build system
Version: 0.62.2
Source dir: ........../aravis
Build dir: ........./aravis/build
Build type: native build
Project name: aravis
Project version: 0.8.22
C compiler for the host machine: cc (gcc 12.1.0 "cc (Rev2, Built by MSYS2 project) 12.1.0")
C linker for the host machine: cc ld.bfd 2.38
C++ compiler for the host machine: c++ (gcc 12.1.0 "c++ (Rev2, Built by MSYS2 project) 12.1.0")
C++ linker for the host machine: c++ ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wduplicated-branches: YES (cached)
Compiler for C supports arguments -Wimplicit-fallthrough: YES (cached)
Compiler for C supports arguments -Wmisleading-indentation: YES (cached)
Compiler for C supports arguments -Wstrict-prototypes: YES (cached)
Compiler for C supports arguments -Wunused: YES (cached)
Compiler for C supports arguments -Wunused-variable: YES (cached)
Compiler for C supports arguments -Wdeclaration-after-statement: YES (cached)
Compiler for C supports arguments -Wformat=2: YES (cached)
Compiler for C supports arguments -Wimplicit-function-declaration: YES (cached)
Compiler for C supports arguments -Winit-self: YES (cached)
Compiler for C supports arguments -Wmissing-include-dirs: YES (cached)
Compiler for C supports arguments -Wmissing-prototypes: YES (cached)
Compiler for C supports arguments -Wpointer-arith: YES (cached)
Compiler for C supports arguments -Wformat-nonliteral: YES (cached)
Compiler for C supports arguments -Wenum-conversion: YES (cached)
Compiler for C supports arguments -Wmaybe-uninitialized: YES (cached)
Compiler for C supports arguments -fvisibility=hidden: YES (cached)
Dependency glib-2.0 found: YES 2.72.2 (cached)
Dependency gobject-2.0 found: YES 2.72.2 (cached)
Dependency gio-2.0 found: YES 2.72.2 (cached)
Dependency libxml-2.0 found: YES 2.9.14 (cached)
Dependency zlib found: YES 1.2.12 (cached)
Dependency libusb-1.0 skipped: feature usb disabled
Library m found: YES
Library ws2_32 found: YES
Library iphlpapi found: YES
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Program glib-mkenums found: YES (C:\msys64\mingw64\bin/glib-mkenums.EXE)
Found pkg-config: C:\msys64\mingw64\bin/pkg-config.EXE (1.8.0)
Program glib-compile-resources found: YES (C:\msys64\mingw64\bin/glib-compile-resources.EXE)
Configuring arvapi.h using configuration
Configuring arvfeatures.h using configuration
Configuring arvparamsprivate.h using configuration
Configuring arvversion.h using configuration
Program glib-compile-resources found: YES (C:\msys64\mingw64\bin/glib-compile-resources.EXE)
Dependency gtk+-3.0 skipped: feature viewer disabled
Dependency gstreamer-base-1.0 skipped: feature viewer disabled
Dependency gstreamer-app-1.0 skipped: feature viewer disabled
Dependency gstreamer-video-1.0 skipped: feature viewer disabled
Dependency gstreamer-base-1.0 skipped: feature gst-plugin disabled
Dependency gstreamer-app-1.0 skipped: feature gst-plugin disabled
Dependency gi-docgen skipped: feature documentation disabled
Build targets in project: 13

aravis 0.8.22

  Directories
    prefix          : C:/msys64/mingw64
    bindir          : bin
    libdir          : lib
    datadir         : share

  Options
    Viewer          : False
    GStreamer plugin: False
    USB support     : False

  User defined options
    backend         : ninja
    buildtype       : release
    debug           : false
    optimization    : 3
    documentation   : disabled
    gst-plugin      : disabled
    gv-n-buffers    : 32
    introspection   : disabled
    packet-socket   : disabled
    tests           : false
    usb             : disabled
    viewer          : disabled

Found ninja-1.11.0 at C:\msys64\mingw64\bin/ninja.EXE
[0/1] Regenerating build files.
[1/97] Generating src/arvresources_c with a custom command
[2/97] Generating src/arvresources_h with a custom command
[...]
[91/97] Compiling C object src/libaravis-0.8-0.dll.p/arvgvdevice.c.obj
[92/97] Linking target src/libaravis-0.8-0.dll
[93/97] Generating symbol file src/libaravis-0.8-0.dll.p/libaravis-0.8-0.dll.symbols
[94/97] Linking target src/arv-tool-0.8.exe
[95/97] Linking target src/arv-test-0.8.exe
[96/97] Linking target src/arv-camera-test-0.8.exe
[97/97] Linking target src/arv-fake-gv-camera-0.8.exe

Expected behavior A version I build using version 0.8.21 is working fine (~15.03.2022). But this build was also based on an older version of MSYS2 and the dependend libraries like glib.

Camera description: Self build in memory camera. It is working fine with old aravis and Pleora eBus Player, so I think this is not causing the issue.

Platform description:

  • Aravis version: Current state of the main branch
  • OS: Windows 10 21H2
  • Hardware: Dell Laptop / Intel i9-9980HK

Additional context Here the stack trace from Visual Studio:

libaravis-0.8-0.dll!00007fff45aff5b4() unknown (I assume it to be _process_packet) libaravis-0.8-0.dll!00007fff45b00029() unknown (I assume it to be _loop) libglib-2.0-0.dll!00007fff45866ce1() unknown libglib-2.0-0.dll!00007fff458952b7() unknown msvcrt.dll!00007ff859e6af5a() unknown msvcrt.dll!00007ff859e6b02c() unknown kernel32.dll!00007ff858d27034() unknown ntdll.dll!00007ff859fa2651() unknown

I assume that error is caused in the _process_packet method (arvgvstream.c), but I cannot debug the code.

Side question: Is there a way to generate a .pdb file on windows so that debugging would be possible in Visual Studio?

Jean-PhilippeGoerke avatar Jun 22 '22 06:06 Jean-PhilippeGoerke

Is there a way to generate a .pdb file on windows so that debugging would be possible in Visual Studio?

Try to change the buildtype to debugoptimized:

meson configure -Dbuildtype=debugoptimized

EmmanuelP avatar Jul 07 '22 09:07 EmmanuelP

I also tried 0.8.22 last week, and it crashed in arv_camera_start_acquisition (multi example). 0.8.20 did not,. (camera: AVT manta 125g).

Not just own code, arv-camera-test-0.8.exe also crashes.

marcovtje avatar Aug 05 '22 14:08 marcovtje

If you are building aravis using the git repository, could you try to find the faulty commit using git bissect ?

EmmanuelP avatar Aug 05 '22 14:08 EmmanuelP

No, not yet. I'm a Delphi/Lazarus user, not MSYS.

marcovtje avatar Aug 05 '22 15:08 marcovtje

I tried my luck with msys and built aravis 8.20, 8.21 and 8.22 for x86_64-mingw64 and 21 and 22 have segmentation fault in arv-camera-test and 20 not, all built with the same msys environment.

If you have detailed instructions for the bissecting, I'll give it a go

marcovtje avatar Aug 10 '22 15:08 marcovtje

Traceback of gdb for camera test for 0.8.21:

odel name = Manta_G-125B device serial number = 50-0503319299 image width = 1292 image height = 964 horizontal binning = 1 vertical binning = 1 exposure = 15000 µs gain = 0 dB payload = 1245488 bytes gv n_stream channels = 1 gv current channel = 0 gv packet delay = 0 ns [New Thread 12560.0x3134] gv packet size = 8228 bytes

Thread 12 received signal SIGSEGV, Segmentation fault. [Switching to Thread 12560.0x3134] _loop (thread_data=thread_data@entry=0x1cf1b6924b0) at ../src/arvgvstream.c:855 855 frame = _process_packet (thread_data, (gdb) bt #0 _loop (thread_data=thread_data@entry=0x1cf1b6924b0) at ../src/arvgvstream.c:855 #1 0x00007ffb647ff666 in arv_gv_stream_thread (data=0x1cf1b6924b0) at ../src/arvgvstream.c:1111 #2 0x00007ffb67696ce1 in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll #3 0x00007ffb676c52b7 in ?? () from C:\msys64\mingw64\bin\libglib-2.0-0.dll #4 0x00007ffba46daf5a in msvcrt!_beginthreadex () from C:\Windows\System32\msvcrt.dll #5 0x00007ffba46db02c in msvcrt!_endthreadex () from C:\Windows\System32\msvcrt.dll #6 0x00007ffba42d7034 in KERNEL32!BaseThreadInitThunk () from C:\Windows\System32\kernel32.dll #7 0x00007ffba5562651 in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll #8 0x0000000000000000 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) (gdb)

marcovtje avatar Aug 11 '22 12:08 marcovtje

Any updates regarding this? I have the same segmentation fault on windows 11 on Aravis version 8.21 and 8.22, but not on 8.20.

mikkellars avatar Jan 23 '23 12:01 mikkellars

Hi @mikkellars

I don't have a development environment on Windows, so, as I said to @marcovtje , finding the commit that introduced the issue using git bisect would help. It is quite straightforward to use: https://git-scm.com/docs/git-bisect

EmmanuelP avatar Jan 27 '23 17:01 EmmanuelP

Long time, no news. I'm closing this issue. Don't hesitate to reopen when you have the requested informations.

Cheers.

EmmanuelP avatar May 19 '23 05:05 EmmanuelP