HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: faxq maxing out CPU - let's crack this!!!!!



On Sun, 19 Mar 2000, Robert Colquhoun wrote:

> It is looping continuously in the for loop starting at line 341 to 359
> 
> Somehow: TabEnt->State = S_MakeUpB, a0 = 0, RunLength = 0 and TabEnt->Param = 0
> 
> (section of code starting at line 341)
>          for (;;) {                                                      \
>              LOOKUP16(13, TIFFFaxBlackTable, eof1d);                     \
>              switch (TabEnt->State) {                                    \
>              case S_EOL:                                                 \
>                  EOLcnt = 1;                                             \
>                  goto done1d;                                            \
>              case S_TermB:                                               \
>                  SETVAL(TabEnt->Param);                                  \
>                  goto doneBlack1d;                                       \
>              case S_MakeUpB:                                             \
>              case S_MakeUp:                                              \
>                  a0 += TabEnt->Param;                                    \
>                  RunLength += TabEnt->Param;                             \
>                  break;                                                  \
>              default:                                                    \
>                  unexpected("BlackTable", a0);                           \
>                  goto done1d;                                            \
>              }                                                           \
>          }
> 
> Possibly something funny is happening in the LOOKUP16 function, or perhaps 
> earlier there is an error that leads to this situation.
> 
> PS I am having trouble debugging this - nested defines which expand to 
> hundreds of lines of code, many variables, goto's all over the place...its 
> as if the author saw hell in a dream, then woke up and had to write about 
> it and the result is this code!

I've been in this hell before... and printf's are your friend...  I'd add
printf's to the different cases (and to the LOOKUP16 function/macro) until
I found the problem.  I'd also add a limit to that loop (abort() when a
counter reached a certain value), so I didn't have to keep hunting down
the process and killing it.
							- Tom




Project hosted by iFAX Solutions