Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
I found out that reading one by one is a slow process, I found out that reading all Lof will in a rare instance _READ will not fire when only 1 byte arrives immediately after. I find it works correctly 100% when I read Lof()-1 and rely on _Read to fire again. for the one remaining and the new one arriving immediately after. Uh... Very strange! It would be cool if you could try your program with the latest Gambas 2 or Gambas 3 and see if you have to do the same trick. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini wrote: I found out that reading one by one is a slow process, I found out that reading all Lof will in a rare instance _READ will not fire when only 1 byte arrives immediately after. I find it works correctly 100% when I read Lof()-1 and rely on _Read to fire again. for the one remaining and the new one arriving immediately after. Uh... Very strange! It would be cool if you could try your program with the latest Gambas 2 or Gambas 3 and see if you have to do the same trick. Regards, Hi all, I'd just like to report that with revision 2459, the change events have been restored for my application. I tried flowcontrol none/hardware/software/both and couldn't pick any appreciable difference in CPU utilisation. The funny thing is that the anomoly reported in a previous email - The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal - appears to be fixed. Whilst I don't understand why this has been fixed, it would seem to be another plus. Regards, Tony. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: Benoit, Here is the output of valgrind as requested. I hope it helps. Regards, Tony.. $ valgrind --tool=memcheck --num-callers=50 gbx2 ==2404== Memcheck, a memory error detector ==2404== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==2404== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info ==2404== Command: gbx2 ==2404== /dev/ttyUSB0 19200 0 8 1 1 1 ==2404== Invalid read of size 4 ==2404==at 0x535C586: CSerialPort_CallBack (CSerialPort.c:120) ==2404==by 0x4663A21: CWatch::write(int) (CWatch.cpp:143) ==2404== by0x4663885:CWatch::qt_invoke(int, QUObject*) (CWatch_moc.cpp:91) ... Is it better with revision #2455? (Ron, you can try too!) I guess not... Program received signal SIGSEGV, Segmentation fault. GB_Raise (object=0xd, event_id=0, nparam=0) at gbx_api.c:528 528OBJECT_REF(object, GB_Raise); (gdb) bt #0 GB_Raise (object=0xd, event_id=0, nparam=0) at gbx_api.c:528 #1 0x00334cd5 in CSerialPort_ReadCallBack (_object=0xd) at CSerialPort.c:175 #2 0x08060997 in raise_callback (wait=value optimized out) at gbx_watch.c:425 #3 do_loop (wait=value optimized out) at gbx_watch.c:498 #4 0x08060b04 in WATCH_loop () at gbx_watch.c:530 #5 0x08061b72 in main (argc=134739040, argv=0xb4f4) at gbx.c:358 (gdb) ==5235== Memcheck, a memory error detector ==5235== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==5235== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info ==5235== Command: gbx2 -p ==5235== Parent PID: 16998 ==5235== ==5235== Invalid read of size 4 ==5235==at 0x805D8DA: GB_Raise (gbx_api.c:528) ==5235==by 0x460CCD4: CSerialPort_ReadCallBack (CSerialPort.c:175) ==5235==by 0x8060996: do_loop (gbx_watch.c:425) ==5235==by 0x8060B03: WATCH_loop (gbx_watch.c:530) ==5235==by 0x8061B71: main (gbx.c:358) ==5235== Address 0x10 is not stack'd, malloc'd or (recently) free'd ==5235== ==5235== ==5235== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==5235== Access not within mapped region at address 0x10 ==5235==at 0x805D8DA: GB_Raise (gbx_api.c:528) ==5235==by 0x460CCD4: CSerialPort_ReadCallBack (CSerialPort.c:175) ==5235==by 0x8060996: do_loop (gbx_watch.c:425) ==5235==by 0x8060B03: WATCH_loop (gbx_watch.c:530) ==5235==by 0x8061B71: main (gbx.c:358) ==5235== If you believe this happened as a result of a stack ==5235== overflow in your program's main thread (unlikely but ==5235== possible), you can try to increase the size of the ==5235== main thread stack using the --main-stacksize= flag. ==5235== The main thread stack size used in this run was 8388608. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. That would mean that the Read callback is called endlessly, as if there are always bytes to read on the serial port. Do you use the read event? Can you check that by implementing a Read event handler, check how much time it is called, and check what can be read on the serial port? If there is something to read on the serial port, if there are data to read, and if you don't read it, the Read callback will be called again and again. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. That would mean that the Read callback is called endlessly, as if there are always bytes to read on the serial port. Do you use the read event? Can you check that by implementing a Read event handler, check how much time it is called, and check what can be read on the serial port? If there is something to read on the serial port, if there are data to read, and if you don't read it, the Read callback will be called again and again. Regards, Almost all of them use a Read event handler. CRFXComRX receives the most number of bytes, as it receives data from all of my temp/energy sensors. I have this defined: PUBLIC SUB RFXComRXSer_Read() DIM sData AS Byte READ #hRFXComRXSer, sData ProcessReceivedChar(sData) END So it reads data byte by byte and process them. Sure a continues flow of data, but before the latest rev. everything works with very low cpuload (with even higher serial loads) . I don't want to loose that! My guess is that now the Read event is called even when there is no data, otherwise I couldn't have a much lower load without changes to my code. I remember having reported the same issue of high loads of serialport code, you fixed it here: Revision: 1796 http://gambas.svn.sourceforge.net/gambas/?rev=1796view=rev Author: gambas Date: 2009-01-12 21:24:47 + (Mon, 12 Jan 2009) Log Message: --- [GB.NET] * BUG: Serial port devices are now watched for reading, not for writing. So the callback will not be called permanently. Modified Paths: -- gambas/branches/2.0/gb.net/src/CSerialPort.c Is this related to the fix you have put in now? If you want I can run valgrind/kcachegrind, but I have to make some free time first. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Ron a écrit : ... runned valgrind tool for a while. And I got a rather strange winner, I got 3 milion calls of _add_char in gb_error.c Some debug code hanging around or something like that? See attached valgrind file. May be that's a source for what I noticed (Debian sid, XP2600+, 1.5GB RAM): if I start a GB project while there a CPU (or I/O) hungry process running, half the time GB says its running, but no window shows on screen. JY -- In which level of metalanguage are you now speaking? -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. That would mean that the Read callback is called endlessly, as if there are always bytes to read on the serial port. Do you use the read event? Can you check that by implementing a Read event handler, check how much time it is called, and check what can be read on the serial port? If there is something to read on the serial port, if there are data to read, and if you don't read it, the Read callback will be called again and again. Regards, Benoit, runned valgrind tool for a while. And I got a rather strange winner, I got 3 milion calls of _add_char in gb_error.c Some debug code hanging around or something like that? See attached valgrind file. Regards, Ron_2nd. The reason is a lot of one-byte reading that raises the EOF error. This should be logical if the read event handler is called whereas there is nothing to read, and then you read one byte. But why Linux tells me (the interpreter actually) that there is something to read on the serial port file descriptor, whereas there is nothing? Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
I found out that reading one by one is a slow process, I found out that reading all Lof will in a rare instance _READ will not fire when only 1 byte arrives immediately after. I find it works correctly 100% when I read Lof()-1 and rely on _Read to fire again. for the one remaining and the new one arriving immediately after. -- Original Message --- From: Benoît Minisini gam...@users.sourceforge.net To: nand...@nothingsimple.com, mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sat, 5 Dec 2009 21:56:41 +0100 Subject: Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic Benoit, Just to let you know, for your information only. My serial port applicationS that have been running 24 hours for 4 years on over 150 computers works much better when pull out All less 1 byte each _Read event as opposed to. I didn't understand the last sentence. Do you read bytes one by one or all at once? You should read all available bytes at once, by using the Lof() function. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Am Mittwoch, den 02.12.2009, 20:25 +1100 schrieb Tony: Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, Salut Tony, you will find how to work with gdb there : go to http://gambas.sourceforge.net/en/main.html click: Reporting a problem read : 3. Reporting a crash (a segmentation fault, or a signal #11) -- Amicalement Charlie -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini wrote: Am Mittwoch, den 02.12.2009, 20:25 +1100 schrieb Tony: Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, Salut Tony, you will find how to work with gdb there : go to http://gambas.sourceforge.net/en/main.html click: Reporting a problem read : 3. Reporting a crash (a segmentation fault, or a signal #11) And another often more interesting way of debugging is using 'valgrind': $ cd /path/to/my/project $ valgrind --tool=memcheck --num-callers=50 gbx2 ... And then you send me the output written by valgrind. Regards, Benoît, I updated to 2454 and have signal 11's too, right away while starting my program. This is the bt: Program received signal SIGSEGV, Segmentation fault. GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 528OBJECT_REF(object, GB_Raise); (gdb) bt #0 GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 #1 0x00b99cd5 in CSerialPort_ReadCallBack (_object=0x11) at CSerialPort.c:175 #2 0x08060997 in raise_callback (wait=value optimized out) at gbx_watch.c:425 #3 do_loop (wait=value optimized out) at gbx_watch.c:498 #4 0x08060b04 in WATCH_loop () at gbx_watch.c:530 #5 0x08061b72 in main (argc=134739040, argv=0xb4e4) at gbx.c:358 (gdb) I'm recompiling without optimizations at this moment, so better backtrace is coming... I only have Flowcontrol = 0 in all of my serial port code. Gambas 2.18.x gb.qt Ubuntu 9.10 Kind Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Ron wrote: Benoît Minisini wrote: Am Mittwoch, den 02.12.2009, 20:25 +1100 schrieb Tony: Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, Salut Tony, you will find how to work with gdb there : go to http://gambas.sourceforge.net/en/main.html click: Reporting a problem read : 3. Reporting a crash (a segmentation fault, or a signal #11) And another often more interesting way of debugging is using 'valgrind': $ cd /path/to/my/project $ valgrind --tool=memcheck --num-callers=50 gbx2 ... And then you send me the output written by valgrind. Regards, Benoît, I updated to 2454 and have signal 11's too, right away while starting my program. This is the bt: Program received signal SIGSEGV, Segmentation fault. GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 528OBJECT_REF(object, GB_Raise); (gdb) bt #0 GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 #1 0x00b99cd5 in CSerialPort_ReadCallBack (_object=0x11) at CSerialPort.c:175 #2 0x08060997 in raise_callback (wait=value optimized out) at gbx_watch.c:425 #3 do_loop (wait=value optimized out) at gbx_watch.c:498 #4 0x08060b04 in WATCH_loop () at gbx_watch.c:530 #5 0x08061b72 in main (argc=134739040, argv=0xb4e4) at gbx.c:358 (gdb) I'm recompiling without optimizations at this moment, so better backtrace is coming... I only have Flowcontrol = 0 in all of my serial port code. Gambas 2.18.x gb.qt Ubuntu 9.10 Kind Regards, Ron_2nd. Hmm... recompiling complete Gambas source without optimization flag didn't result in a more verbose output, and I don't want to recompile libqt or things like that. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoit, Here is the output of valgrind as requested. I hope it helps. Regards, Tony.. $ valgrind --tool=memcheck --num-callers=50 gbx2 ==2404== Memcheck, a memory error detector ==2404== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==2404== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info ==2404== Command: gbx2 ==2404== /dev/ttyUSB0 19200 0 8 1 1 1 ==2404== Invalid read of size 4 ==2404==at 0x535C586: CSerialPort_CallBack (CSerialPort.c:120) ==2404==by 0x4663A21: CWatch::write(int) (CWatch.cpp:143) ==2404== by0x4663885:CWatch::qt_invoke(int, QUObject*) (CWatch_moc.cpp:91) ==2404== by 0x493C359: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x493E1E3: QObject::activate_signal(int, int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x4C9BBFF: QSocketNotifier::activated(int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x495B166: QSocketNotifier::event(QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48D74B6: QApplication::internalNotify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D842A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A5E2: MyApplication::notify(QObject*, QEvent*) (main.cpp:354) ==2404== by 0x48CC1E3: QEventLoop::activateSocketNotifiers() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x488207D: QEventLoop::processEvents(unsigned int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A70B: MyEventLoop::processEvents(unsigned int) (main.cpp:247) ==2404== by 0x48F04AF: QEventLoop::enterLoop() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48F0355: QEventLoop::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D7B0E: QApplication::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x4639D57: hook_loop() (main.cpp:542) ==2404==by 0x8061B71: main (gbx.c:358) ==2404== Address 0x31 is not stack'd, malloc'd or (recently) free'd ==2404== ==2404== ==2404== Process terminating with default action of signal 11 (SIGSEGV) ==2404== Access not within mapped region at address 0x31 ==2404==at 0x535C586: CSerialPort_CallBack (CSerialPort.c:120) ==2404==by 0x4663A21: CWatch::write(int) (CWatch.cpp:143) ==2404== by0x4663885:CWatch::qt_invoke(int, QUObject*) (CWatch_moc.cpp:91) ==2404== by 0x493C359: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x493E1E3: QObject::activate_signal(int, int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x4C9BBFF: QSocketNotifier::activated(int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x495B166: QSocketNotifier::event(QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48D74B6: QApplication::internalNotify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D842A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A5E2: MyApplication::notify(QObject*, QEvent*) (main.cpp:354) ==2404== by 0x48CC1E3: QEventLoop::activateSocketNotifiers() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x488207D: QEventLoop::processEvents(unsigned int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A70B: MyEventLoop::processEvents(unsigned int) (main.cpp:247) ==2404== by 0x48F04AF: QEventLoop::enterLoop() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48F0355: QEventLoop::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D7B0E: QApplication::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x4639D57: hook_loop() (main.cpp:542) ==2404==by 0x8061B71: main (gbx.c:358) ==2404== If you believe this happened as a result of a stack ==2404== overflow in your program's main thread (unlikely but ==2404== possible), you can try to increase the size of the ==2404== main thread stack using the --main-stacksize= flag. ==2404== The main thread stack size used in this run was 8388608. ==2404== ==2404== HEAP SUMMARY: ==2404== in use at exit: 1,958,423 bytes in 15,402 blocks ==2404== total heap usage: 102,525 allocs, 87,123 frees, 7,712,919 bytes allocated ==2404== ==2404== LEAK SUMMARY: ==2404==definitely lost: 6,916 bytes in 28 blocks ==2404==indirectly lost: 12,892 bytes in 633 blocks ==2404== possibly lost: 175,810 bytes in 721 blocks ==2404==still reachable: 1,762,805 bytes in 14,020 blocks ==2404== suppressed: 0 bytes in 0 blocks ==2404== Rerun with --leak-check=full to see details of leaked memory ==2404==
[Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Hi, I have a Gambas2 application (gb.qt) checking for status change events on the CTS, RI and DSR signals (SerialPort-gb.net class) of a USB to serial converter (Prolific pl2303) which works fine on Ubuntu 9.04 (Gambas2 2.8 and kernel 2.6.28-16-generic 32bit). After upgrade to Ubuntu 9.10 (Gambas2 2.13 and kernel 2.6.31-15-generic 32bit) the status changes are no longer working. The serial port opens without error but no status change events are flagged. The problem is also evident in the serial port example on Ubuntu 9.10. I have compiled Gambas2 2.18 onto Ubuntu 9.04 but it still fails so my guess is that somewhere between Gambas2 2.8 and 2.13 this functionality stopped working. Any assistance would be appreciated, thanks.. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Tony, Try to compile gambas2 again. I got similar problem with apps after upgrade ubuntu from 9.04 yo 9.10 and it was necessary to do this: sudo apt-get install build-essential autoconf libbz2-dev libfbclient2 libmysqlclient15-dev unixodbc-dev libpq-dev libsqlite0-dev libsqlite3-dev libgtk2.0-dev libldap2-dev libcurl4-gnutls-dev libgtkglext1-dev libpcre3-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsage-dev libxml2-dev libxslt1-dev libbonobo2-dev libcos4-dev libomniorb4-dev librsvg2-dev libpoppler-dev libpoppler-glib-dev libasound2-dev libesd0-dev libesd-alsa0 libdirectfb-dev libaa1-dev libxtst-dev libffi-dev kdelibs4-dev firebird2.1-dev libqt4-dev and after I downloaded gambas from source and compile again. Hope this works for you. Regards, Ricardo Díaz 2009/12/1 Tony ajw...@optusnet.com.au Hi, I have a Gambas2 application (gb.qt) checking for status change events on the CTS, RI and DSR signals (SerialPort-gb.net class) of a USB to serial converter (Prolific pl2303) which works fine on Ubuntu 9.04 (Gambas2 2.8 and kernel 2.6.28-16-generic 32bit). After upgrade to Ubuntu 9.10 (Gambas2 2.13 and kernel 2.6.31-15-generic 32bit) the status changes are no longer working. The serial port opens without error but no status change events are flagged. The problem is also evident in the serial port example on Ubuntu 9.10. I have compiled Gambas2 2.18 onto Ubuntu 9.04 but it still fails so my guess is that somewhere between Gambas2 2.8 and 2.13 this functionality stopped working. Any assistance would be appreciated, thanks.. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Thanks for the suggestion Ricardo. I have already compiled G2.18 from source onto Ubuntu 9.04. The application was working fine on Ubuntu 9.04 with G2.8 but fails with G2.18, so this makes me think that there is a problem which may have been introduced between G2.8 and G2.13 (the binary on Ubuntu 9.10 which doesn't work). Regards, Tony.. Ricardo DÃaz MartÃn wrote: Tony, Try to compile gambas2 again. I got similar problem with apps after upgrade ubuntu from 9.04 yo 9.10 and it was necessary to do this: sudo apt-get install build-essential autoconf libbz2-dev libfbclient2 libmysqlclient15-dev unixodbc-dev libpq-dev libsqlite0-dev libsqlite3-dev libgtk2.0-dev libldap2-dev libcurl4-gnutls-dev libgtkglext1-dev libpcre3-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsage-dev libxml2-dev libxslt1-dev libbonobo2-dev libcos4-dev libomniorb4-dev librsvg2-dev libpoppler-dev libpoppler-glib-dev libasound2-dev libesd0-dev libesd-alsa0 libdirectfb-dev libaa1-dev libxtst-dev libffi-dev kdelibs4-dev firebird2.1-dev libqt4-dev and after I downloaded gambas from source and compile again. Hope this works for you. Regards, Ricardo DÃaz 2009/12/1 Tony [1]ajw...@optusnet.com.au Hi, I have a Gambas2 application (gb.qt) checking for status change events on the CTS, RI and DSR signals (SerialPort-gb.net class) of a USB to serial converter (Prolific pl2303) which works fine on Ubuntu 9.04 (Gambas2 2.8 and kernel 2.6.28-16-generic 32bit). After upgrade to Ubuntu 9.10 (Gambas2 2.13 and kernel 2.6.31-15-generic 32bit) the status changes are no longer working. The serial port opens without error but no status change events are flagged. The problem is also evident in the serial port example on Ubuntu 9.10. I have compiled Gambas2 2.18 onto Ubuntu 9.04 but it still fails so my guess is that somewhere between Gambas2 2.8 and 2.13 this functionality stopped working. Any assistance would be appreciated, thanks.. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. [2]http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list [3]gambas-u...@lists.sourceforge.net [4]https://lists.sourceforge.net/lists/listinfo/gambas-user -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. [5]http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list [6]gambas-u...@lists.sourceforge.net [7]https://lists.sourceforge.net/lists/listinfo/gambas-user References 1. mailto:ajw...@optusnet.com.au 2. http://p.sf.net/sfu/redhat-sfdev2dev 3. mailto:Gambas-user@lists.sourceforge.net 4. https://lists.sourceforge.net/lists/listinfo/gambas-user 5. http://p.sf.net/sfu/redhat-sfdev2dev 6. mailto:Gambas-user@lists.sourceforge.net 7. https://lists.sourceforge.net/lists/listinfo/gambas-user -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Benoît Minisini wrote: Thanks for the suggestion Ricardo. I have already compiled G2.18 from source onto Ubuntu 9.04. The application was working fine on Ubuntu 9.04 with G2.8 but fails with G2.18, so this makes me think that there is a problem which may have been introduced between G2.8 and G2.13 (the binary on Ubuntu 9.10 which doesn't work). Regards, Tony.. You are right, and I think I understand what happens: I have noticed that SerialPort callback took too much CPU, because it was using polling on the serial port file descriptor. So I fixed it by awaken it only when there is some data to read... Mistake! I didn't understand that all DTRChange, DSRChange... events are not detected by the kernel. So Daniel (who wrote the code) had to use polling to be able to detect the changes. By removing the polling, I was able to raise the Read event without burning CPU, but all *Change events were not raised anymore! Now I have to find a good fix, but I have never used a serial port, so I need some enlightenment (no, I won't run E17...) - Why do you need detecting DTR,DSR... changes? - How are these events related to flow control and the FlowControl property? The last question is not innocent. the FlowControl property takes three different values: Hardware, Software, Both. I'm thinking adding a fourth value, None, that means the user does not care. In that specific case, I will not poll, and *Change events won't be raised. So you will be able to decide: - Setting FlowControl to None. You will get the Read event only, but you won't burn CPU power. - Setting FlowControl to any other value. You will get all events, but you will have to poll. This change would be compatible with the current SerialPort interface. Otherwise, for Gambas 3, maybe I will add a new property to define how much polling is needed. What do serial port people think about that? -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user