Open jbvoelker opened 6 years ago
Further to jbvoelker report, I can confirm this is a problem and can add the following information:
I have simplified the code example to highlight the problem.
`#include
using namespace std;
int main() { InitQHYCCDResource(); std::out << ScanQHYCCD() << "\n"; return 0; }`
If I compile the above code using GCC-5.4 (Linux Mint), the example works as expected. Compiling on gcc-8.1 this code works as expected if there is a camera connected. However, it produces the output detailed below if there is no camera connected.
jbvoelker I am not sure if this is a compiler version or some other dependency problem, therefore, it might be useful if you would let QHY know what compiler, kernel version and Linux distribution you are using. I am using kernel 4.17.2 and gcc 8.1. (Fedora 28). As I stated above, this works perfectly on Linux Mint which uses older versions of core dependencies.
QHY: What Linux distribution do you use to build the SDK?
I have observed this problem in 2.0.6 and 2.0.7. It works perfectly in 1.0.2 but I have not tested any other versions.
The following output has been generated by linking against the debug SDK library. (Sorry, I have no idea why the font is large and bold.)
2018-07-02 20:32:00:077: qhyccd: ScanQHYCCD start... 2018-07-02 20:32:06:077: qhyccd: ScanQHYCCD - No QHYCCD cameras detected. double free or corruption (fasttop)
Hi all, yes, this function crashes if there is no camera connected, I will fix that asap. Sorry for that problem. Jan --
Jan Soldan - Astronomical Embedded Systems. QHYCCD - European Warranty, Repair, Warehouse and Software Center Fricova - 236, 251 65 Ondrejov, Czech Republic http://www.linkedin.com/in/jansoldan http://www.qhyccd.com Email : astrosoft@email.cz Skype : astrosoft_cz QQ: 2517730289 Mobile : +420 728 403 811
---------- Původní e-mail ---------- Od: Jannis_V notifications@github.com Komu: qhyccd-lzr/QHYCCD_Linux_New QHYCCD_Linux_New@noreply.github.com Datum: 2. 7. 2018 21:13:34 Předmět: [qhyccd-lzr/QHYCCD_Linux_New] Crash in ScanQHYCCD() if no camera is connected (#7) " Calling ScanQHYCCD() without a connected camera leads to a crash.
Steps to reproduce:
This is what happens: " SingleFrameMode, Version: 1.10 Press any key to start test application... SDK resources initialized. Error in `./SingleFrameMode': double free or corruption (fasttop): 0x 000000000238d390 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f52d70867e5] /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f52d708f37a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f52d709353c] /usr/local/lib/libqhyccd.so.2(ScanQHYCCD+0x12c)[0x7f52d77e549a] ./SingleFrameMode(main+0xc7)[0x40115d] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f52d702f830] ./SingleFrameMode(_start+0x29)[0x400fc9] ======= Memory map: ======== 00400000-00403000 r-xp 00000000 fc:01 3542721 /home/jannis/qhyccdsdk-v2.0.5- Linux-Debian-Ubuntu-x86_64/testapp/SingleFrameMode/build/SingleFrameMode 00602000-00603000 r--p 00002000 fc:01 3542721 /home/jannis/qhyccdsdk-v2.0.5- Linux-Debian-Ubuntu-x86_64/testapp/SingleFrameMode/build/SingleFrameMode 00603000-00604000 rw-p 00003000 fc:01 3542721 /home/jannis/qhyccdsdk-v2.0.5- Linux-Debian-Ubuntu-x86_64/testapp/SingleFrameMode/build/SingleFrameMode 0233c000-023a8000 rw-p 00000000 00:00 0 [heap] 7f52d0000000-7f52d0021000 rw-p 00000000 00:00 0 7f52d0021000-7f52d4000000 ---p 00000000 00:00 0 7f52d5cb2000-7f52d5cb3000 ---p 00000000 00:00 0 7f52d5cb3000-7f52d64b3000 rw-p 00000000 00:00 0 7f52d64b3000-7f52d64ba000 r-xp 00000000 fc:01 8388892 /lib/x86_64-linux-gnu/ librt-2.23.so 7f52d64ba000-7f52d66b9000 ---p 00007000 fc:01 8388892 /lib/x86_64-linux-gnu/ librt-2.23.so 7f52d66b9000-7f52d66ba000 r--p 00006000 fc:01 8388892 /lib/x86_64-linux-gnu/ librt-2.23.so 7f52d66ba000-7f52d66bb000 rw-p 00007000 fc:01 8388892 /lib/x86_64-linux-gnu/ librt-2.23.so 7f52d66bb000-7f52d66d3000 r-xp 00000000 fc:01 8388856 /lib/x86_64-linux-gnu/ libpthread-2.23.so 7f52d66d3000-7f52d68d2000 ---p 00018000 fc:01 8388856 /lib/x86_64-linux-gnu/ libpthread-2.23.so 7f52d68d2000-7f52d68d3000 r--p 00017000 fc:01 8388856 /lib/x86_64-linux-gnu/ libpthread-2.23.so 7f52d68d3000-7f52d68d4000 rw-p 00018000 fc:01 8388856 /lib/x86_64-linux-gnu/ libpthread-2.23.so 7f52d68d4000-7f52d68d8000 rw-p 00000000 00:00 0 7f52d68d8000-7f52d68ee000 r-xp 00000000 fc:01 8393156 /lib/x86_64-linux-gnu/ libgcc_s.so.1 7f52d68ee000-7f52d6aed000 ---p 00016000 fc:01 8393156 /lib/x86_64-linux-gnu/ libgcc_s.so.1 7f52d6aed000-7f52d6aee000 rw-p 00015000 fc:01 8393156 /lib/x86_64-linux-gnu/ libgcc_s.so.1 7f52d6aee000-7f52d6bf6000 r-xp 00000000 fc:01 8388850 /lib/x86_64-linux-gnu/ libm-2.23.so 7f52d6bf6000-7f52d6df5000 ---p 00108000 fc:01 8388850 /lib/x86_64-linux-gnu/ libm-2.23.so 7f52d6df5000-7f52d6df6000 r--p 00107000 fc:01 8388850 /lib/x86_64-linux-gnu/ libm-2.23.so 7f52d6df6000-7f52d6df7000 rw-p 00108000 fc:01 8388850 /lib/x86_64-linux-gnu/ libm-2.23.so 7f52d6df7000-7f52d6e0e000 r-xp 00000000 fc:01 8393298 /lib/x86_64-linux-gnu/ libusb-1.0.so.0.1.0 7f52d6e0e000-7f52d700d000 ---p 00017000 fc:01 8393298 /lib/x86_64-linux-gnu/ libusb-1.0.so.0.1.0 7f52d700d000-7f52d700e000 r--p 00016000 fc:01 8393298 /lib/x86_64-linux-gnu/ libusb-1.0.so.0.1.0 7f52d700e000-7f52d700f000 rw-p 00017000 fc:01 8393298 /lib/x86_64-linux-gnu/ libusb-1.0.so.0.1.0 7f52d700f000-7f52d71cf000 r-xp 00000000 fc:01 8388858 /lib/x86_64-linux-gnu/ libc-2.23.so 7f52d71cf000-7f52d73cf000 ---p 001c0000 fc:01 8388858 /lib/x86_64-linux-gnu/ libc-2.23.so 7f52d73cf000-7f52d73d3000 r--p 001c0000 fc:01 8388858 /lib/x86_64-linux-gnu/ libc-2.23.so 7f52d73d3000-7f52d73d5000 rw-p 001c4000 fc:01 8388858 /lib/x86_64-linux-gnu/ libc-2.23.so 7f52d73d5000-7f52d73d9000 rw-p 00000000 00:00 0 7f52d73d9000-7f52d754b000 r-xp 00000000 fc:01 13108318 /usr/lib/x86_64-linux -gnu/libstdc++.so.6.0.21 7f52d754b000-7f52d774b000 ---p 00172000 fc:01 13108318 /usr/lib/x86_64-linux -gnu/libstdc++.so.6.0.21 7f52d774b000-7f52d7755000 r--p 00172000 fc:01 13108318 /usr/lib/x86_64-linux -gnu/libstdc++.so.6.0.21 7f52d7755000-7f52d7757000 rw-p 0017c000 fc:01 13108318 /usr/lib/x86_64-linux -gnu/libstdc++.so.6.0.21 7f52d7757000-7f52d775b000 rw-p 00000000 00:00 0 7f52d775b000-7f52d78c4000 r-xp 00000000 fc:01 13376363 /usr/local/lib/ libqhyccd.so.2.0.5 7f52d78c4000-7f52d7ac4000 ---p 00169000 fc:01 13376363 /usr/local/lib/ libqhyccd.so.2.0.5 7f52d7ac4000-7f52d7ad9000 r--p 00169000 fc:01 13376363 /usr/local/lib/ libqhyccd.so.2.0.5 7f52d7ad9000-7f52d7af4000 rw-p 0017e000 fc:01 13376363 /usr/local/lib/ libqhyccd.so.2.0.5 7f52d7af4000-7f52d7b1a000 r-xp 00000000 fc:01 8388854 /lib/x86_64-linux-gnu/ ld-2.23.so 7f52d7ca8000-7f52d7cad000 rw-p 00000000 00:00 0 7f52d7cad000-7f52d7ccb000 r-xp 00000000 fc:01 8388652 /lib/x86_64-linux-gnu/ libudev.so.1.6.4 7f52d7ccb000-7f52d7ccc000 r--p 0001d000 fc:01 8388652 /lib/x86_64-linux-gnu/ libudev.so.1.6.4 7f52d7ccc000-7f52d7ccd000 rw-p 0001e000 fc:01 8388652 /lib/x86_64-linux-gnu/ libudev.so.1.6.4 7f52d7ccd000-7f52d7ccf000 rw-p 00000000 00:00 0 7f52d7d17000-7f52d7d19000 rw-p 00000000 00:00 0 7f52d7d19000-7f52d7d1a000 r--p 00025000 fc:01 8388854 /lib/x86_64-linux-gnu/ ld-2.23.so 7f52d7d1a000-7f52d7d1b000 rw-p 00026000 fc:01 8388854 /lib/x86_64-linux-gnu/ ld-2.23.so 7f52d7d1b000-7f52d7d1c000 rw-p 00000000 00:00 0 7ffd6e49d000-7ffd6e4be000 rw-p 00000000 00:00 0 [stack] 7ffd6e5b9000-7ffd6e5bc000 r--p 00000000 00:00 0 [vvar] 7ffd6e5bc000-7ffd6e5be000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] zsh: abort ./SingleFrameMode " — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/qhyccd-lzr/QHYCCD_Linux_New/issues/7), or mute the thread (https://github.com/notifications/unsubscribe-auth/AE-NVBtUkV8UVbhjNdxDhVCld-aqTDgvks5uCnDYgaJpZM4U_zon) . "
Thanks Jan,
I appreciate your efforts.
Regards Nikki
Please try a new 2.0.9 version of sdk driver. This should fix problem with ScanQHYCCD() function if no camera is attached to the usb bus.
It works on my site...
Jan
---------- Původní e-mail ---------- Od: Nikki notifications@github.com Komu: qhyccd-lzr/QHYCCD_Linux_New QHYCCD_Linux_New@noreply.github.com Datum: 2. 7. 2018 22:01:22 Předmět: Re: [qhyccd-lzr/QHYCCD_Linux_New] Crash in ScanQHYCCD() if no camera is connected (#7) " Further to jbvoelker report, I can confirm this is a problem and can add the following information:
I have simplified the code example to highlight the problem.
`#include
using namespace std;
int main() { InitQHYCCDResource(); std::out << ScanQHYCCD() << "\n"; return 0; }`
If I compile the above code using GCC-5.4 (Linux Mint), the example works as expected. Compiling on gcc-8.1 this code works as expected if there is a camera connected. However, it produces the output detailed below if there is no camera connected.
jbvoelker I am not sure if this is a compiler version or some other dependency problem, therefore, it might be useful if you would let QHY know what compiler, kernel version and Linux distribution you are using. I am using kernel 4.17.2 and gcc 8.1. (Fedora 28). As I stated above, this works perfectly on Linux Mint which uses older versions of core dependencies.
QHY: What Linux distribution do you use to build the SDK?
I have observed this problem in 2.0.6 and 2.0.7. It works perfectly in 1.0.2 but I have not tested any other versions.
The following output has been generated by linking against the debug SDK library. (Sorry, I have no idea why the font is large and bold.)
2018-07-02 20:31:50:122: qhyccd: pthread_mutexattr_init success. 2018-07-02 20:31:50:122: qhyccd: pthread_mutexattr_settype success. 2018-07-02 20:31:50:122: qhyccd: pthread_mutex_init success.
2018-07-02 20:31:50:122: cons()
idx : 7 dev : (nil) handle : (nil) vid : 0x0000 pid : 0x0000 is_open : 0 id : qcam : (nil) p_image_queue : (nil) image_queue_len : 0 thread_exit_flag : 0 event_count : 0 thread_id : 0 p_raw_data_cache : (nil) p_img_buffer : (nil) header_len : 0 frame_len : 0 ending_len : 0 sig_len : 0 header_type : 0 raw_frame_width : 0 raw_frame_height : 0 raw_frame_bpp : 0 received_raw_data_len: -1
2018-07-02 20:32:00:077: qhyccd: ScanQHYCCD start... 2018-07-02 20:32:06:077: qhyccd: ScanQHYCCD - No QHYCCD cameras detected. double free or corruption (fasttop)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/qhyccd-lzr/QHYCCD_Linux_New/issues/7#issuecomment-401916914) , or mute the thread (https://github.com/notifications/unsubscribe-auth/AE-NVOVzjlZv3u21E1c3WRiNW8GLwquuks5uCnwJgaJpZM4U_zon) . "
Many thanks for looking into it!
I have downloaded both 2.0.9 archives but they don't contain header files and libqhyccd.a/so.
Sorry for that mistake, I will release new version, just fixing one problem with qhy128c camera.
--
Jan Soldan - Astronomical Embedded Systems. QHYCCD - European Warranty, Repair, Warehouse and Software Center Fricova - 236, 251 65 Ondrejov, Czech Republic http://www.linkedin.com/in/jansoldan http://www.qhyccd.com Email : astrosoft@email.cz Skype : astrosoft_cz QQ: 2517730289 Mobile : +420 728 403 811
---------- Původní e-mail ---------- Od: Jannis_V notifications@github.com Komu: qhyccd-lzr/QHYCCD_Linux_New QHYCCD_Linux_New@noreply.github.com Datum: 3. 7. 2018 20:40:55 Předmět: Re: [qhyccd-lzr/QHYCCD_Linux_New] Crash in ScanQHYCCD() if no camera is connected (#7) " Many thanks for looking into it!
I have downloaded both 2.0.9 archives but they don't contain header files and libqhyccd.a/so.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/qhyccd-lzr/QHYCCD_Linux_New/issues/7#issuecomment-402255129) , or mute the thread (https://github.com/notifications/unsubscribe-auth/AE-NVE4MD95wHPufs2qljnISQffvNZuLks5uC7qvgaJpZM4U_zon) . "
Hi Jan
Is there an update on the fix for the ScanQHYCCD() crash problem?
Many thanks and I appreciate your hard work.
Regards Amanda
this should be solved in v 2.0.10. Jan ---------- Původní e-mail ---------- Od: Nikki notifications@github.com Komu: qhyccd-lzr/QHYCCD_Linux_New QHYCCD_Linux_New@noreply.github.com Datum: 13. 7. 2018 22:41:35 Předmět: Re: [qhyccd-lzr/QHYCCD_Linux_New] Crash in ScanQHYCCD() if no camera is connected (#7) " Hi Jan
Is there an update on the fix for the ScanQHYCCD() crash problem?
Many thanks and I appreciate your hard work.
Regards Amanda
— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/qhyccd-lzr/QHYCCD_Linux_New/issues/7#issuecomment-404948071) , or mute the thread (https://github.com/notifications/unsubscribe-auth/AE-NVPgPXc0QxDK8suHAh0ijIN1jNqGqks5uGQX3gaJpZM4U_zon) . "
Dear Jan,
I am sorry, I didn't see the new version because I was looking at the bottom of the list.
I'll test and then report back.
Many thanks Amanda
Dear Jan,
I'm afraid that 2.0.10 still does not work correctly. The crash problem in ScanQHYCCD() has been fixed. However, if there are no QHY cameras connected, then the function takes about six seconds and then returns -1. Previous versions of the SDK returned almost instantly and always returned zero.
Returning -1 is not a problem but a six second delay when calling ScanQHYCCD() is.
Hope you can fix this issue.
Kind Regards Amanda
if there is no camera attached to the system, we try it 3 times with progressive time delay, ie. 1x1000ms, then 2x1000 ms and finally 3x1000ms which gives 6 seconds of total delay.
I can decrease this values, of course, but sometimes when you check usb bus, it finds the camera on the second scan, so this was a reason, why we included three scannings instead of just one. In any case, I will change it, but there still will be some delays at least 1 second. Would that be acceptable ?
I think, we included return code -1, which is QHY_ERROR. I HAVE TO CHECK.
BTW, I have to work on a new sdk based on Windows one, which should support all qhyccd cameras under Windows, so it represents tons of rework , but at the end we would have source code working on windows, linux and macos.
So, this linux version you are using is just separate branch, I will mainain it until we switch to that new common one. So, I have no time to add support for qhy2020, 4020 or 6060. I am really pushed to adapt their original windows code to support multiple cameras, proper thread sync and adding linux code there.
Thanks,
Jan
Dear Jan,
Many thanks for such a quick response.
My software supports multiple camera manufacturers so a six second delay was really causing me a problem if a QHY camera was not connected. I have got around this problem by writing a libusb routine to find the iManufacturer parameter to see if a QHY camera is on the bus. If iManufacturer is equal to QHY-CCD then I pass control over to ScanQHYCCD() and the other QHY SDK functions. If not, then I simply clean up and continue checking for other camera makes.
Is it guaranteed that the iManufacturer parameter for QHY is always QHY-CCD or could it be something different?
I think having one code base for all platforms is a great idea and I look forward to seeing the SDK when it's ready. Once again, thanks for your hard work.
Kind Regards Amanda
Hi Jan, many thanks for the fix!
Calling ScanQHYCCD() without a connected camera leads to a crash.
Steps to reproduce:
This is what happens: