[comp.protocols.appletalk] CAP bug report 14

cck@CUNIXC.COLUMBIA.EDU (Charlie C. Kim) (02/02/88)

Hopefully, this will help with the papif -1101 errors.  By the way,
people have talked me into making papif handle banner pages.  The next
release will include this support: papof will write out the banner
page in postscript so all papif will have to do is download it.
(papof is an output filter for papif.  lnof was an output filter that
I had written for an ln03 spooler and distributed because I knew I
could.).

CAP Pre-Release Distribution 4.00 with Patches 5,6,7
Bug Report: 0014

 Date: 11/23/87
 Problem: When spooling jobs to a LaserWriter, you sometimes get -1101
(no release received) timeouts.  This wouldn't be a problem except
that a -1101 error is grounds for immediate termination of a
connection because you cannot be sure that there (a) the printer
hasn't been turned off or (b) there are problems in the communications
path.  However, it often occurs when neither (a) nor (b) are the case.
 Reported by: many people, but the best report came from Adobe's Tom
Malloy and Mike Byron who actually diagnosed the problem in detail
(and convinced me that they were right!)
 Priority: Medium to High
 Diagnosis: Without getting into too much detail, we can simply state
that the main problem is a time dialation effect that occurs on the
LaserWriter whenever protocol is suspended - for instance when it is
printing, etc.  (e.g. what should have occurred at 20 seconds may
occur at 30 seconds, etc).  Hopefully, this is undoubtably not the
only culprit: for instance massive network distruptions should be
expected to cause same problem.
 Solution: The solution is to make the Reponse cache timeout value
larger to account for possible time compression.  The best
implementation would be to have a "pap" level call that would call an
"atp" level routine to reset the response cache timeout on a
connection.  This is overkill and besides I'm lazy: it's enought to
add a routine at the "atp" level to modify the response cache timeout
because the only "atp" connection that a printing process generally
has is the one to the LaserWriter.
 This only requires modifications to atp and papif.  Since PAPIF only
has a single ATP transaction outstanding at any time, the overhead on
this is small.  Here they are.  (Warning: papif has undergone
extensive modification since it was last distributed - the patch may
fail via "patch" - it is a simple enough patch to apply by hand
though).  Note: the timeout value of 2 minutes was picked arbitrarily
- the justification is that 2 minutes is acceptable time to wait and
if nothing happens, then something probably is busted.  Just for a
range of values (for pap): 30 seconds is the minimum and 5 minutes is
getting a tad bit large (but you might need a timeout this large or
larger if you tend to print multiple copies, etc.)
 Note: we've been running with this patch for a while and have found
the -1101 errors have only been reduced and not eliminated.  It's hard
to say if the 2 minutes is too low or if there are other factors
coming into play (for example our ethernet has some problems..).

#START OF PATCH TO ABATP.C####################################################
*** /tmp/,RCSt1003362	Mon Nov 23 10:28:02 1987
--- abatp.c	Tue Nov 10 09:39:16 1987
***************
*** 62,67
  OSErr ATPRspCancel();
  OSErr ATPSndRsp();
  OSErr cbATPSndRsp();
  /* OSErr ATPAddRsp(); */
  private void listener();
  private void tcb_timeout();

--- 62,68 -----
  OSErr ATPRspCancel();
  OSErr ATPSndRsp();
  OSErr cbATPSndRsp();
+ void ATPSetResponseTimeout();
  /* OSErr ATPAddRsp(); */
  private void listener();
  private void tcb_timeout();
***************
*** 75,80
  
  private int atpreqskt = -1;
  private int atpreqsktpid = 1;	/* pid 1 is init - hope it never runs this */
  
  /*
   * ATPSndRequest

--- 76,83 -----
  
  private int atpreqskt = -1;
  private int atpreqsktpid = 1;	/* pid 1 is init - hope it never runs this */
+ /* baseline value */
+ private u_long atpresptimeout = RESPONSE_CACHE_TIMEOUT;
  
  /*
   * ATPSndRequest
***************
*** 358,364
      rspcb->callback = callback;
      rspcb->cbarg = cbarg;
      remTimeout(rsptimeout, rspcb);
!     Timeout(rsptimeout, rspcb, RESPONSE_CACHE_TIMEOUT);
      abr->abResult = 1;
    } else abr->abResult = noErr;	/* if we are at least once.... */
  

--- 361,367 -----
      rspcb->callback = callback;
      rspcb->cbarg = cbarg;
      remTimeout(rsptimeout, rspcb);
!     Timeout(rsptimeout, rspcb, atpresptimeout);
      abr->abResult = 1;
    } else abr->abResult = noErr;	/* if we are at least once.... */
  
***************
*** 368,373
    if (err < 0)
      return(badATPSkt);
    return(noErr);
  }
  
  

--- 371,388 -----
    if (err < 0)
      return(badATPSkt);
    return(noErr);
+ }
+ 
+ 
+ /*
+  * Set the atp response cache timeout value
+  *
+ */
+ void
+ ATPSetResponseTimeout(value)
+ u_long value;
+ {
+   atpresptimeout = value;
  }
  
  
#END OF PATCH TO ABATP.C######################################################
#START OF PATCH TO PAPIF.C####################################################
*** /tmp/,RCSt1003432	Mon Nov 23 10:28:57 1987
--- papif.c	Tue Nov 10 09:40:28 1987
***************
*** 171,176
    abInit(xdebug);		/* initialize appletalk driver */
    nbpInit();
    PAPInit();			/* init PAP printer routines */
  
    /* log message */
    fprintf(stderr,"PAPIF: Starting job for %s@%s at %s on printer %s\n",

--- 171,177 -----
    abInit(xdebug);		/* initialize appletalk driver */
    nbpInit();
    PAPInit();			/* init PAP printer routines */
+   ATPSetResponseTimeout(sectotick(60*2)); /* set to 2 minutes */
  
    /* log message */
    fprintf(stderr,"PAPIF: Starting job for %s@%s at %s on printer %s\n",
#END OF PATCH TO PAPIF.C######################################################