Photometrics / PyVCAM

Python3.X wrapper for Photometrics and QImaging PVCAM based cameras
MIT License
36 stars 17 forks source link

Several functions cause driver crash #1

Closed Stuermer closed 5 years ago

Stuermer commented 5 years ago

Hi, several functions seem to cause a driver crash. In particular the cam.close() function: Here is my minimal example showing the issue:

import os
os.environ["PVCAM_UMD_PATH"] = "/opt/pvcam/drivers/user-mode"
from pyvcam import pvc
from pyvcam.camera import Camera

init = pvc.init_pvcam()
cam = next(Camera.detect_camera())
cam.open()
cam.speed_table_index=1
frame = cam.get_frame(20)
print(frame)

cam.close()

The last line causes the script to crash and it seems also the driver with the following error message: *** stack smashing detected ***: /home/xxxxxxxxx/anaconda3/bin/python terminated

The corresponding logfiles can be found here: PVCAM_USB: http://paste.ubuntu.com/p/7pP6nD9HPc/ PVCAM_CORE: http://paste.ubuntu.com/p/Fs7wc9kZbj/ PVCAM_DDI: http://paste.ubuntu.com/p/JZTprCRGqR/

Similar problems occur with cam.stop_live().

HerrZiffer commented 5 years ago

This should be fixed in the latest commit. Python passes arguments to “extension functions” as a string that must be converted to the corresponding c-type. It was told to parse the camera handle as a 32 bit integer, while the variable holding the handle was only 16-bit. On Linux, GCC's smash checking was triggered by the error in several places.

Stuermer commented 5 years ago

I can confirm that the latest commit fixes the problems (at least for all the functions I tried so far).