genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System
Apache License 2.0
500 stars 86 forks source link

Buffer__get__buffer truncated 64-bit address information cause _get_raw_buffer Windows fatal exception: access violation #458

Open JYLEE2017 opened 1 month ago

JYLEE2017 commented 1 month ago

Describe the Issue When I try to access raw_buffer in Buffer, an access violation error will be reported.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Sample Code I can show a piece of code that demonstrates the reported phenomenon:

If yes, please provide a sample code:

def acquire(device, features):
    global TRIGGER_SOFTWARE, POINTCLOUD_DATA_INDEX, MONO_DATA_INDEX, CONVERSION_FACTOR
    buffer = device.fetch_buffer(timeout=10)

    # Grab component data
    components = buffer.payload.components
    print("Got the following components")
    print(components)
    print("End of components")
    pointcloud_data = components[POINTCLOUD_DATA_INDEX].data
    mono_texture_data = components[MONO_DATA_INDEX].data

CTI_FILE = "F:\\software\\GenICam3D\\ProducerGEV\\x64\\Release\\ProducerGEV.dll"
SERIAL_NUMBER = "xxxx-L (xxxx)"
TRIGGER_SOFTWARE = "TriggerFrame"

POINTCLOUD_DATA_INDEX = 0
MONO_DATA_INDEX = 1
CONVERSION_FACTOR = 0.001

def main(args=None):
    from harvesters.core import Harvester
    harvester = Harvester()
    harvester.add_file(CTI_FILE,check_existence=True,check_validity=True)
    harvester.update()
    device = harvester.create()
        #{'serial_number': SERIAL_NUMBER})

    features = device.remote_device.node_map
    #SetSettings(features)

    device.start()
    print("Starting acqusition")
    #while (True):
    for i in range(1):
        print("--------------------",i,"-----------------------------")
        acquire(device,features)

    device.stop()

if __name__ == '__main__':
    main()

If applicable, please paste the actual output (its whole traceback, etc) here:

>>>buffer = device.fetch_buffer(timeout=10)
  Base Addr: 18e9c44c060
Windows fatal exception: access violation

Thread 0x00005884 (most recent call first):
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 327 in wait
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 629 in wait
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_timeout.py", line 43 in _on_run
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1045 in _bootstrap_inner
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1002 in _bootstrap
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydev_bundle\pydev_monkey.py", line 1118 in __call__

Thread 0x00006e28 (most recent call first):
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 331 in wait
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 629 in wait
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\pydevd.py", line 261 in _on_run
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1045 in _bootstrap_inner
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1002 in _bootstrap

Thread 0x00006ebc (most recent call first):
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 331 in wait
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 629 in wait
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\pydevd.py", line 215 in _on_run
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1045 in _bootstrap_inner
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1002 in _bootstrap

Thread 0x00007bc4 (most recent call first):
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 204 in _read_line
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 222 in _on_run
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1045 in _bootstrap_inner
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1002 in _bootstrap

Thread 0x00000d04 (most recent call first):
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 331 in wait
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\queue.py", line 180 in get
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 368 in _on_run
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_daemon_thread.py", line 49 in run
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1045 in _bootstrap_inner
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\threading.py", line 1002 in _bootstrap

Current thread 0x00007b3c (most recent call first):
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\genicam\gentl.py", line 4151 in _get_raw_buffer
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 969 in _to_np_array
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 927 in __init__
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 1382 in _build_component
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 1537 in __init__
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 1312 in _build_payload
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 1181 in __init__
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 2494 in _finalize_fetching_process
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 2565 in fetch
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\site-packages\harvesters\core.py", line 2516 in fetch_buffer
  File "F:\software\Genicam acquistion script\genicamTester.py", line 82 in acquire
  File "F:\software\Genicam acquistion script\genicamTester.py", line 30 in timeit_wrapper
  File "F:\software\Genicam acquistion script\genicamTester.py", line 160 in main
  File "F:\software\Genicam acquistion script\genicamTester.py", line 166 in <module>
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124 in _run_code
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135 in _run_module_code
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321 in run_path
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284 in run_file
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430 in main
  File "c:\Users\wwh\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39 in <module>
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\runpy.py", line 88 in _run_code
  File "g:\ProgramData_\anaconda3\envs\genicam2\Lib\runpy.py", line 198 in _run_module_as_main

Expected Behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem; Note that it is not necessary to put everything as a screenshot! If the source is a text just paste the text because that is much helpful for us. image

Configuration

Reproducibility

This phenomenon can be stably reproduced:

If applicable, please provide your observation about the reproducibility.

Actions You Have Taken

Additional context Add any other context about the problem here.

JYLEE2017 commented 1 month ago

gentl.Buffergetbase return 32bit address,Truncated 64-bit address information;This caused the above problem, but I don’t know why the _get_base interface is truncated.