New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InvalidHandleException at the first fetch #71
Comments
Hi Alexander, Thank you for the report. Could you tell me the GenTL Producer that you use? Regards, |
Thanks, it's from the latest of pylon5 for USB3: |
Cool! I didn't know that they had started providing GenTL Producer! |
When the
And the GenTL Standard says as follows regarding
If the GenTL Producer follows the standard document, then we have the four options above and if we want to make sure if Harvester can release the resources we should log the behavior. To log the behavior of Harvester please go through the following steps:
Oh, perhaps it's also worth trying to run with another GenTL Producer. Maybe bringing our the GenTL Producer from Matrix Vision? |
Thank you for both suggestions! I will follow through asap. It will likely take a few days to get to the system. |
Hi Alexander, I have written an advice for you at the chat room. Please take a look when you can. Best regards, |
The first method didn't leave any file unfortunately.
To have more verbose output, I passed our own logger to Even if details are missing, maybe the sequence of events provide insight. Exceptions reoccur every 5 to 20 frames after restarting the image acquisition. Also, is there another way to probe what's causing |
Hi Alexander. Thank you for the update. Regarding the logging based on the environment variable, perhaps it might work just adding the Well, I found something interesting in the log. Please look at the following block first.
And I would like to get your attention to the following line: 2018-12-17 20:21:59,805 [DEBUG] (Thread-2 ) Acquired Buffer module #11 containing frame #0 from DataStream module Stream0 of Device module Basler daA2500-14uc (22841742). See, even though your Harvester object had already acquired frame #0 at Having that log, I assume one or more stream packets that compose (probably) frame #11 were corrupted. Of course, it should be proven from the transport layer level using Wireshark though. The reason I assume this possibility is that I had faced the similar phenomenon with one of their USB3 cameras. In my case, it delivered an image with a chunk data but the chunk data had been corrupted (it's revealed because the GenICam reference implementation refused the corrupted data throwing a defined exception). Interestingly, when I get such a corrupted chunk data, then the image was completely black and such images were occasionally delivered. If I wanted to investigate this issue, I would check if the camera occasionally transmits a corrupted frame having help from Wireshark anyway because it will expose a corrupted packet if the camera really transmits a corrupted one; you'll be able to check the frame ID field (sorry, I've forgotten the correct name) in the Wireshark log. If it tells you the packet incorrectly reports you that's frame #0, then its GenTL Producer will have to report Harvester that it's frame #0 anyway. Neither Harvester or GenTL Producers are willing to intentionally alter the information in general excepting a case where they have a bug. Anyway, please don't worry I think I can keep working with you on this issue for a while. Best regards, |
Besides the Wireshark way I introduced above, you may have the following trials:
Please note that the Wireshark ways are the most important. Other ways are counted as workaround candidates. |
Acquiring frame #0 again is indeed always precededing the exceptions. I tried to eliminate some conflating following factors:
Unfortunately, the issue reproduced under all circumstances. I noticed that the frequency of exceptions, at least most often, gradually increases over some hours until no more images come through (with a restart delay of 0.4 seconds). We didn't try with a dedicated USB hub yet. Black images were not ever transferred. I think an exception is always raised before. Instead of restarting the image acquisition thread, would it be worthwhile to fetch buffers with The wireshark logs were done by capturing 1944x1600 BGR8 frames. Frame No.
If helpful, a raw dump from wireshark is also available. Any further guidance is highly appreciated. |
Hi Alexander, Thank you for taking your time. To be honest I wish I could test with you having the idetical setup. I'm sorry about that.
It's indeed unfortunate but I see a light in such a high reproducibility: We can think that you have caught the root cause in the environment!
Yes, please. I would like to have the Wireshark file (*.pcap) and check the stream packets in detail. It's not only the
Unfortunately, it doesn't help you. Technically speaking perhaps it could be possible to parse the content of a buffer by yourself but it means you will have to know everything happening in the transport layer level but in most cases required information would be encapsulated by the GenTL Producer in a place where you can't reach out.
Thank you for the confirmation but it's okay because that was just a case I had.
Could you describe the test you had more precisely? Regards, |
At his point, I think I can attribute the issue to docker. Apparently, two factors lead to the same result. First, an exception occurred after ~400 frames in the Ubuntu 16.04 environment. This led to the conclusions before. Running a second time, an exception occurred only after 39996 frames. Second, exceptions occur frequently within the docker container. I can hardly reproduce the aggravation mentioned above on my local setup, but the 2h video files saved on the remote system drop from 1.1GB to 148MB to 0. Accordingly, the application logs not a single image acquired image before or in between a retry ( Now, we also know that many or in fact all drivers I know of (Basler, Point Grey, Ximea, MV) demand to be scheduled with high priority. For that, I made the docker container as close as I know to the host system's capabilities: How is scheduling priority handled in the Core -> GenTL Binding -> GenTL Producer stack? Would it use or benefit from a realtime scheduler? In addition to a *.pcapng dump from the first run, I did a new
If helpful, I'm also more than willing to get an image into the wild for direct reproduction on your side. |
Hi Alexander, Thank you for the update. I have found something strange in the Wireshark log that you provided at this time: Please take a look at an image that was tagged As long as I read the Wireshark log, a concern which is relevant to the driver software comes to the top of my head. Would you get any idea from this impression? Best regards, |
Good catch. I think both anomalies Thus, I grepped the frame numbers for both.
It follows, that Left Frame Number : (Frame Length: 68 bytes)
|
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, |
I'll have some updates by the end of the week which should close the issue. |
Okay, I'll be waiting for the update. Thanks. |
A discussion with Basler's support team yielded two suggestions and one explanation for the non-recoverability of the error. The second suggestion is sufficient to have the camera run stable up to a few fps and thus resolves the issue. Suggestion 1: Set
Suggestion 2: Set
For our case, 32000000 proved to be stable yet fast enough. Explanation for non-recoverability of underruns Before actually testing the long-term effect of these suggestions we switched to an |
Hi Alexander, Thank you for the update.
I would like to know who is holding 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, |
ia = h.create_image_acquirer(0) using baumer camera and gentlproducer from baumer "bgapi2_gige.cti ". I get above error |
Hi Rahul828086. Are you sure that any other program is not holding the target camera? Please make a try terminating other image acquisition programs. -Kazunari |
@kazunarikudo , ya there is no other software using the camera. |
Too bad. Hm, the error is telling an obvious fact that the device can't be controlled due to a reason. It typically happens if a device is controlled by another process. (1) Can you open the device using Bumer's viwer application? (2) Have you ever tried another GenTL Producer or (3) a camera so far? |
@kazunarikudo , Yes i m able to open camera using baumer GAPI application. I haven't tried with other GenTL Producer.. I m not able to get the .CTI file which is mentioned in document in harvesters. but with baumer .CTI file i got return value for h.device_info_list.. but when i go for ia =h.create_image_acquirer(0) it gives above mentioned error.. |
Okay, so you mean their software works with the camera but Harvester can't control the camera even though it uses their GenTL Producer, right? Are you really sure that no other applications is running beside Harvester? |
@kazunarikudo Yes.. I did close baumer application and there was no application open which uses the camera. |
Which model are you trying to control? Is that from Baumer, too? |
@kazunarikudo , ya.. baumer model itself |
Hmm... I can swear that I have ever tried USB3 version but never tried GEV version. To be honest I have no idea on your current case but... can Baumer software control the camera immediately after Harvetser failed to control the camera? |
yes |
You can find this parameter under the Data Stream Module's nodemap (all modules have nodemaps). In most uses of the GenTL spec, we only need to use the remote device's nodemap, which we get by first getting a GenTL::PORT_HANDLE using DevGetPort(). But you can also pass in other handles to get the nodemaps of other modules (TL_HANDLE, DS_HANDLE, etc). If you get a nodemap using the DS_HANDLE in the same manner as a remote device's nodemap (ie using GCGetNumPortURLs(), GCGetPortURLInfo(), GCGetPortInfo(), and GCReadPort()) you will see that This is mentioned throughout the documentation subtly but more specifically in GenTL spec v1.5, in sections 2.3, 4.1.1, and 7.1 |
Describe the bug
Sometimes
fetch_buffer()
throwsInvalidHandleException
at the first fetch. This exception is not caught within harvesters.To Reproduce
We use a Basler USB3 camera and which is listed correctly:
First
fetch_buffer()
:Stacktrace:
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.
The text was updated successfully, but these errors were encountered: