Let me add that I agree about the buffer size, it should clearly be large enough to handle whats coming in. I also agree that the IP2 modules are often problematic. Many times modules written by the same person use completely different techniques for parsing.
Lately I have found modules that have multiple S+ modules receiving the same RX$ and each module is performing parsing on it. Using multiple instances of those modules causes major grief. Some of them are pretty key pieces of gear too and I've gone so far as re-authoring to combine those multiple parsing modules. Fixed up most of my problems. But as Crestron likes to say, 'modules are for demonstration purposes only'.
JP
toggle quoted message
Show quoted text
--- In Crestron@..., "josephporter2020" <ttbtssav@...> wrote:
Unless your parsing code has delays in it that would allow the buffer to fill up, I find that using destructive functions on the buffer does not ever require the use of a clearbuffer.
Remove() and Gather() are destructive and using them to pick off the buffer has never given me trouble to where I thought I needed to use clearbuffer. They only time I've ever used clearbuffer in the past was when I didn't get destructive functions or it was really late at night and I didn't have time to figure out where bugs were so I used it as a band aide.
JP
--- In Crestron@..., Tray Schaeffer <trayschaeffer@> wrote:
With respect, I have to disagree.
1. Sizing the input buffer to match the expected string length is half of the solution for this problem and good coding practice. This is not just a hack or workaround, it is essential.
If the expected string is 300 bytes long, but the input buffer is only 255 wide, an error will be returned.
However, if the buffer is sized to 350 and the same 300 characters comes in, no error is returned. Both statements above assume that the Buffer_Input is empty when the data is received which brings me to #2.
2. Since a Buffer_Input constantly appends new data to any that was received before, it is easy to see how data that is already processed but not removed could cause the buffer to be full (or full enough that an incoming data frame wont fit completely in the remaining space) when new data arrives.
Wiping the slate clean after each complete frame of data is received is not merely a workaround, it is good practice that will improve reliability.
This is why I do not parse against the Buffer_Input directly. Instead, I make a copy of a complete data frame into a temp variable and immediately clear the Buffer_Input.
Again, clearing the input buffer is not just some sort of hack or work around, it?€?s the right thing to do.
3. If, for some reason, there is an aversion to clearing buffers then use a String_Input instead. Disadvantage here is that this cannot be larger than 255 chars.
Upside is that you never have to remember to clear the input as it will clear itself each time data is received.
All of that aside, you all are right that I2P modules should not suffer from these issues.
Tray
From: Stig
Sent: Friday, August 10, 2012 6:14 AM
To: Crestron@...
Subject: [Crestron] Re: Error msg. Buffer Input overflow in S+ for Panasonic PT-AE4000U
Maybe I'm overlooking something here, but I really can't see how increasing the buffer can make the overflow msg. disappear.
A Clearbuffer can accomplish it, if it is placed right, but this is suggested only as a workaround on the real issue.
If you take a look at the code in the simpl+ module, it will Remove characters from the buffer ONLY if: Lamp_Requested is 1 AND ETX("\x03") is found. ie. The buffer will still be filled up with replies from other polls!
This is excactly the same issue I experienced today with the I2P "BenQ SP920 v1.0.umc with BenQ SP920 v1.0 Processor.usp"
This module will also start Removing chr's from buffer ONLY if delimter+Lampresponse is present,
otherwise buffer get filled up to maxbufsize then gulping out overflow messages...
Had to rewrite both pollroutine + simpl+, and this really annoyes me.... (especially on a Friday afternoon. Grrr)
Back to the OP's question "What should I do?" the answer is: Rewrite both the pollroutine & the lamp hours module.
IMHO We should expect I2P modules to be better written than this.
-Stig
--- In mailto:Crestron%40yahoogroups.com, Rafael Costa <rafaelg.costa@> wrote:
Hello,
I??m controlling a Panasonic projector PT-AE4000U with CresDB module
for PT-AE1000U (Panansonic Lamp Hours v1.0) and it??s working fine.
Even so, I am receiving this error message -> "Error:
splusmanagerapp.exe [App 1] # 21:01:28 8-08-2012 # Module
S-5.1.1:S-2.4 : Panansonic_Lamp_Hours_v1_1 at line 136: Buffer Input
overflow. New = 260, Max = 255"
What should I do, change the "BUFFER_INPUT From_Device$[255];"
parameter to [260], is it possible?
Here is the S+ part:
LINE 44 DIGITAL_INPUT Lamp_Requested;
LINE 47 BUFFER_INPUT From_Device$[255];
LINE 133 change From_Device$
LINE 134 {
LINE 135 // Lamp hours are of the form "\x02####\x03"
LINE 136 if(iBusyFlag = 0 && Lamp_Requested = 1) // if not busy
processing and it is a valid lamp request
LINE 137 {
LINE 138 iBusyFlag = 1; // set busy to avoid re-entry into parser
LINE 139 while(find("\x03", From_Device$) > 0 ) // look for the
ETX during a Lamp Request
LINE 140 {
LINE 141 sTemp$ = remove("\x03", From_Device$); // build the
string
LINE 142 if (find ("ER401", sTemp$) = 0 && Len(sTemp$) = 6)
// Skip errors and unwanted strings
LINE 143 {
LINE 144 Lamp_Hours = ATOI(mid(sTemp$,2,4)); // set
lamp hours
LINE 145 }
LINE 146 }
LINE 147 iBusyFlag = 0; // clear busy
LINE 148 }
LINE 149 }
PMC3+ with firmware 1.005.0008 and all programs and database up to date.
Thank??s in advance,
Rafael Costa
[Non-text portions of this message have been removed]