harvesters: InvalidHandleException at the first fetch

Describe the bug Sometimes fetch_buffer() throws InvalidHandleException at the first fetch. This exception is not caught within harvesters.

To Reproduce We use a Basler USB3 camera and which is listed correctly:

h = Harvester()
h.add_cti_file(<USB3 cti file>)
h.update_device_info_list()
print(h.device_info_list)
[(id_='Basler daA2500-14uc (22841742)', vendor='Basler', model='daA2500-14uc', tl_type='U3V', user_defined_name=None, serial_number='22841742', version='Unknown')]

First fetch_buffer():

ia = h.create_image_acquirer(0)
ia.start_image_acquisition()
with ia.fetch_buffer() as ia_buffer:
    <...>

Stacktrace:

Dec 12 07:43:44 localhost start.sh[23607]:     with ia.fetch_buffer() as ia_buffer:
Dec 12 07:43:44 localhost start.sh[23607]:   File "/usr/local/lib/python3.6/site-packages/harvesters/core.py", line 1785, in fetch_buffer
Dec 12 07:43:44 localhost start.sh[23607]:     self._update_chunk_data(buffer=_buffer)
Dec 12 07:43:44 localhost start.sh[23607]:   File "/usr/local/lib/python3.6/site-packages/harvesters/core.py", line 1713, in _update_chunk_data
Dec 12 07:43:44 localhost start.sh[23607]:     if buffer.num_chunks == 0:
Dec 12 07:43:44 localhost start.sh[23607]:   File "/usr/local/lib/python3.6/site-packages/genicam2/gentl.py", line 4346, in _get_num_chunks
Dec 12 07:43:44 localhost start.sh[23607]:     return _gentl.Buffer__get_num_chunks(self)
Dec 12 07:43:44 localhost start.sh[23607]: _gentl.InvalidHandleException: GenTL exception: Given handle does not support the operation. (Message from the source: Given handle does not support the operation) (ID: -1006)

Expected behavior The exception doesn’t occur, is handled in _update_chunk_handler (https://github.com/genicam/harvesters/blob/master/src/harvesters/core.py#L1739) or can be traced back to an invalid initialization.

Linux: CoreOS within docker container and shared /dev/bus/usb.

Additional context The problem occurs frequently after restarting our container and an extended period of time (>4h) without problems. It’s possible that a deinitialization routine wasn’t called properly upon program exit, which might be the root cause if some resources aren’t released by harvesters.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 31 (16 by maintainers)

Most upvoted comments

Hi Alexander,

Thank you for the update.

MaxTransferSize ought to be a GeniCam node too, but _genapi said it’s not. Is there another way to set StreamGrabberParams?

I would like to know who is holding StreamGrabberParams (and even MaxTransferSize; however, I infer MaxTransferSize is a GenICam feature node but not sure for StreamGrabberParams because it looks like a kind of category which holds some parameters). If they are GenICam feature nodes that the camera holds, then you should be able to manipulate them. If the genicam module says they can’t be found then it would just mean they are not in its XML file.

One concern that I have is they might be parameters that another entity holds such as a driver. I don’t mind who holds them but if they are GenICam feature nodes of any of the modules that are defined by the GenTL standard.

Could you ask Basler people if those parameters can be manipulated through their GenTL Producer? I will take my time (yeah, maybe German people would say “gerne” but I don’t know how to say in English) to make it with Harvester if they are avaialbe through the GenTL Producer.

Regards, Kazunari

Hi again,

As far as I know, this kind of issue can be triggered by a USB host controller even if it has the root cause or not. Do you have another USB3 interface card which has a USB3 host controller from another manufacturer?

If a USB3 host controller was buggy then it would be able to corrupt the behavior of both/either of the GenTL Producer or the U3V camera. They, a GenTL Producer or a camera, might be able to automatically recover from such a state but it’d obviously be a specialized implementation for the host controller.

Perhaps updating the driver software of the USB host controller could resolve this but not really sure if it works. It’s just one of general troubleshooting.

Best regards, Kazunari

Thank you for both suggestions! I will follow through asap. It will likely take a few days to get to the system.

Cool! I didn’t know that they had started providing GenTL Producer!