Laserjet 1220 hangs on the second job - possible cause

Tomasz Malesinski <tmal-Gjw6HIo5MuQjxOWg3n2A5GZHpeb/A1Y/@public.gmane.org>
Newsgroups gmane.linux.drivers.hpofficejet.devel
Message-ID <[email protected]>
I have the same problem as the one mentioned at the end of the
message:

http://sourceforge.net/mailarchive/message.php?msg_id=2306606

The difference is that the problem happens almost always on my
system. After I print one job and I send another one, the printer
usually hangs as described in the mentioned message. I suspect that
this is caused by a race condition, so whether the printer hangs or
not may depend on computer speed, CPU load etc.

I have Intel Pentium III 800 MHz CPU running Debian Woody. I use CUPS
as a spooler. I have HP Laserjet 1220 connected via USB.

When I investigated the problem, I was using sources from CVS.
I was printing files using ptal-print this way:

ptal-print <test.prn

where test.prn was a CUPS output for some postscript file. I tried it
also with Windows drivers output.

The suspected race condition goes as follows:

- ptal-print sends the job, job data are buffered waiting for ptal-mlcd
  to receive them
- after sending all the data, ptal-print closes a socket and exits
- ptal-mlcd receives part of the job data
- as ptal-mlcd has some reverse data from the previous job (it ended
  with @PJL ECHO EOJ), it tries to send it to ptal-print
- the connection to ptal-print is broken, so ptal-mlcd receives
  SIGPIPE, write failes and (in ExMgr::sessionServiceOutput) it
  duplicates the /dev/null file descriptor in place of the session
  socket
- ptal-mlcd hits EOF on /dev/null when trying to receive the rest of
  the job and the printer does not receive the entire job

I have been redirecting data read in ExMgr::pullForwardData to a file
and the second job was in fact truncated there.

I commented out nullDup call in ExMgr::sessionServiceOutput and
everything started to work fine. I have not yet written a more elegant
solution, but it seems that after a failed write to a session socket,
ptal-mlcd should continue to read from the socket, but drop buffers
waiting to be written to it and all the buffers that will be added to
pReverseBdrQueue later.

Tomasz Malesinski


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.