Mr. Lim gets the highly covetted 'Extraordinary LPRng Code Hacker'
award, and a ream of (used) A4 paper. Also an LPRng T-shirt
if he shows up at LISA in New Orleans...
I think the problem that he has described is fixed in ifhp-3.4.2
Please try this version and tell me if it works.
> From [EMAIL PROTECTED] Thu Oct 26 09:09:03 2000
> Date: Thu, 26 Oct 2000 10:43:21 -0400
> From: Edwin Lim <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Cc: Edwin Lim <[EMAIL PROTECTED]>
> Subject: LPRng: waitend_interval weirdness?
>
> I have encountered a strange problem, I think... 8^)
>
>
>
> If I understand the "waitend" and "waitend_interval" directives:
>
> 1) "waitend" makes ifhp wait for the printer to signal that the job has
> finished printing. For JetDirect PJL, it sends a PJL code and wait
> for the printer to reply favorably.
>
> 2) "waitend_interval" specifies how long in between sending the PJL code,
> default to 300s on a fresh ifhp install.
>
>
>
> For me, I see that this is not the behavior:
>
> Large PS job to HP5M, using the JetDirect protocol, ifhp, and PJL for
> job status. The problem is that ifhp seems to exit (code 32) before
> the job is done printing, and LPRng thinks that something is wrong,
> and retries the job. The printer completely prints the job, however.
>
> This repeats until the job is lprm'ed (I have send_try=300 :-).
>
>
>
> After digging, I think what is happening is this:
>
> 1) LPRng invokes ifhp to send job (JetDirect 9100, PJL status).
>
> 2) ifhp sends jobs, and as soon as the whole file is completely sent,
> ifhp goes into Do_waitend()
>
> 3) Now, this is a relatively small file, but the print time is some what
> long, so after the last byte is sent to the printer, it will still
> take about 10 minutes for the printer to finish printing the job.
>
> 4) In the mean time, ifhp (Do_waitend) is getting the PJL status back.
> At the same time, "timeout" ( interval_t - current_t ) is being counted
> down, starting from the "waitend_interval" directive (default to 300s).
>
> 5) However, once "timeout" gets close to 0, Do_waitend() terminates
> with "JFAIL Do_waitend: no response from printer".
>
> But there IS response from printer--it has been sending back the number of
> pages printed every few seconds, and Do_waitend() is collecting the pagecount.
>
ARGH! ARGH! ARGH!!! Right... This model of printer does this...
Some do not... In fact, MOST do not...
>
>
> After poking around some more in ifhp.c:Do_waitend(), I narrow things
> down to
>
> len = Read_status_timeout( timeout );
>
> And Read_status_timeout() set up a blockng read, with a timer alarm hooked
> up to setjmp/sigsetjmp. When there is stuff to read, which is every few
> seconds while the printing is going on (PJL pagecount from printer),
> it is OK. But at the same time, "timeout" is being down-counted, and
> it will come to a time when "timeout" is small (a few seconds), and
> Read_status_timeout() will not have anything to read from the printer
> before the timer alarm triggers the jump to setjmp(). When that happens,
> Read_status_timeout returns -1 to variable "len".
>
> Following that, the "while ( !waitend )" loop is "break"ed. And execution
> ends with "JFAIL Do_waitend: no response from printer".
>
Right...
>
>
> So, in bad ascii time-line diagrams:
>
>
> A) The way it should be with "waitend" and "waitend_interval=300"
> --------------------------------------------------------------
>
> ifhp push out job Do_waitend() waits Do_waitend() waits Do_waitend waits
> | | | |
> |----------------->|-----300 sec------>|-----300 sec------>|-----300 sec-...
> | | | | | | | |
> V V V V V V V V
> Do_waitend() JSUCC if job end detected
>
>
> B) The behavior I see
> ------------------
>
> ifhp push out job Do_waitend() waits Do_waitend() JFAIL
> | | |
> |----------------->|-----300 sec------>|
> | | |
> V V V
> Do_waitend() JSUCC if job end detected
>
>
> This problem happens only if it is a long print job with a relatively
> small file, since "timeout" starts counting only when Do_waitend() is
> called, and Do_waitend() is called only after the last byte is sent.
> This problem is made worse if the receiving buffer on the printer is
> increased. If the receiving buffer is made very small, the problem
> disappears pretty much.
>
>
> I dunno how to fix this without knowing:
>
> 1) if my understanding of "waitend" and "waitend_interval" is correct
Absolutely correct. Sigh...
>
> 2) should Do_waitend() be kludged, or should Read_status_timeout() be kludged
Do_waitend...
Here is the change:
DEBUG3("Do_waitend: Outlen %d", Outlen );
if( Outlen ){
len = Write_read_timeout( Outlen, Outbuf, timeout );
Init_outbuf();
} else {
len = Read_status_timeout( timeout );
}
DEBUG3("Do_waitend: len %d", len );
if( len < 0 ) break; <<<<<---- Only if we get a 'real' timeout...
>
> 3) how kludging Read_status_timeout() will affect a few other places that
> call it
>
> Looking at the code, I _think_
>
> if( len ) break;
>
> should be changed to
>
> if( len ) goto again;
Actually, you want to check the status EVEN if there was no input
(i.e. - zero length read).
>
> However, that means that it is entirely possible that, for some
> misbehaving printers, Do_waitend() can loop forever. So perhaps a master
> timeout is needed ("waitend_timeout" ?), but the value to set for the
> master timeout is going to be either blackmagic or hand-waving... :-(
>
> Anyone with any idea? Tell me that I just missed a clue the size of
> Manhattan somewhere, and I can fix that and go back to my other more
> mundane sys admin stuffs. 8^)
Patrick Powell Astart Technologies,
[EMAIL PROTECTED] 9475 Chesapeake Drive, Suite D,
Network and System San Diego, CA 92123
Consulting 858-874-6543 FAX 858-279-8424
LPRng - Print Spooler (http://www.astart.com)
-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body. For the impatient,
to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED]
with: | example:
subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED]
If you have major problems, send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------