Describe the bug
I start a Printer Application, in my case my PostScript Printer Application using debug mode:
ps-printer-app -o log-level=debug server
Then I add a printer via the web interface (see screenshot below). My HP OfficeJet 8730 (DNS-SD record below) is discovered as network printer via DNS-SD and vis SNMP. I have selected the entry resulting from the DNS-SD discovery of the printer. I select the correct model under "Driver".
Creating the printer, setting the media and other default options works.
Now I try to print. To do so I run
ps-printer-app -d test2 PDF-FILE
The Printer Application processes the job data correctly and according to my option settings (via USB connection the printer actually prints) but is not able to resolve my network printer's host name or IP from the device URI it created during printer setup.
See the console output below (it is the debug output of the Printer Application running as server, which I started in the same terminal), especially it shows
D [2020-10-27T11:09:05.522Z] papplSystemFindPrinter: printer 'test2' - resource="/ipp/print/test2", printer_id=2, device_uri="socket://HP%5C032OfficeJet%5C032Pro%5C0328730%5C032%5C09108C229%5C093._pdl-datastream._tcp.local/"
[...]
E [2020-10-27T11:09:05.523Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
E [2020-10-27T11:09:05.523Z] [Printer test2] Unable to open device 'socket://HP%5C032OfficeJet%5C032Pro%5C0328730%5C032%5C09108C229%5C093._pdl-datastream._tcp.local/', pausing queue until printer becomes available.
There is probably some problem with the parsing/quoting/ecoding/decoding of the DNS-SD service name in the device URI to extract the correct network host name (or IP address) of the printer, needed to send the job to the printer's port 9100.
In addition, even that it is told that the queue got paused by this, the job is retried infinitelt by the Printer Application and there is no way to stop it.
I tried
from another terminal and
from the same terminal. This did not terminate ps-printer-app
nor the job repetition. I had to enter
killall -9 ps-printer-app
to stop it.
The problem must be in PAPPL as PAPPL provides the functionality of discovering printers, assign device URIs to them, and resolving these device URIs to hostname or IP when a job is about to be printed. PAPPL also handles job failures.
I also observed the same with hp-printer-app
, but this Printer Application is currently not working, so I cannot use it for reproducing the problem currently.
To Reproduce
You need a printer which advertises itself via DNS-SD and uses a PAPPL-supported network protocol, like socket printing on port 9100. The command
avahi-browse -t _pdl-datastream._tcp
must list the printer.
Fire up a Printer Application using PAPPL as a server, I used ps-printer-app
any other, like hp-printer-app
should also work.
ps-printer-app -o log-level=debug server
In the web interface click the "Add Printer" button. Then fill in the fields. Enter a queue name, then select your printer from the discovered devices, the entry containing "DNS-SD". Select a suitable driver. Confirm and then set the media which you have in your printer's trays and additional options, like Duplex.
Now print a job, using the command
Observe the debug output, you get repeated messages about a hostname/URI resolution problem.
From another terminal window try to stop the mess. Run
and see the error flooding in the fiurst terminal going on.
Also
does not help. The only solution is
killall -9 ps-printer-app
Expected behavior
- Jobs can also be printed on network printers and should not fail on URI/hostname/IP resolution.
- A failing job should actually pause, at least after some attempts (ideally configurable)
- It must be possible to shut down the server with the standard command even if a failing job is still repeating
System Information:
- Ubuntu 20.10 Groovy Gorilla
- Snap built with Ubuntu 20.04 Focal Fossa, snap base is core18, but also manual "quick and dirty" build of ps-printer-app shows the problem.
- PAPPL is current GIT snapshot
My printer:
HP OfficeJet 8730
$ avahi-browse -t -r _pdl-datastream._tcp
+ enx00e04c043270 IPv4 HP OfficeJet Pro 8730 [08C229] PDL Printer local
= enx00e04c043270 IPv4 HP OfficeJet Pro 8730 [08C229] PDL Printer local
hostname = [HP18602408C229.local]
address = [10.0.0.3]
port = [9100]
txt = ["Scan=T" "Duplex=T" "Color=T" "UUID=dbcc4b58-fc4c-f6fd-b4d6-2b00d554ad47" "mopria-certified=1.3" "note=" "adminurl=http://HP18602408C229.local." "mac=18:60:24:08:c2:29" "priority=40" "usb_MDL=OfficeJet Pro 8730" "usb_MFG=HP" "product=(HP OfficeJet Pro 8730)" "ty=HP OfficeJet Pro 8730" "kind=document,envelope,photo,postcard" "PaperMax=legal-A4" "pdl=application/vnd.hp-PCL,application/vnd.hp-PCLXL,application/postscript,application/pdf,image/jpeg,application/PCLm,image/urf,image/pwg-raster" "qtotal=1" "txtvers=1"]
Additional context
Screen shot of printer setup:
Console output when printing:
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ ps-printer-app -d test2 ~/ghostscript/testfiles/CityMap.pdf
I [2020-10-27T11:09:05.522Z] [Client 36] Accepted connection from 'localhost'.
I [2020-10-27T11:09:05.522Z] [Client 36] POST http://localhost:0/ipp/print/test2 HTTP/1.1
I [2020-10-27T11:09:05.522Z] [Client 36] Continue
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: IPP/2.0 request-id=1
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: operation-attributes-tag
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: attributes-charset charset utf-8
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: attributes-natural-language naturalLanguage en-us
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: printer-uri uri ipp://localhost/ipp/print/test2
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: requesting-user-name nameWithoutLanguage till
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: job-name nameWithoutLanguage CityMap.pdf
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job request: document-name nameWithoutLanguage CityMap.pdf
D [2020-10-27T11:09:05.522Z] papplSystemFindPrinter(system, resource="/ipp/print/test2", printer_id=0, device_uri="(null)")
D [2020-10-27T11:09:05.522Z] papplSystemFindPrinter: printer 'test' - resource="/ipp/print/test", printer_id=1, device_uri="usb://HP/HP%20OfficeJet%20Pro%208730?serial=CN783F60W1"
D [2020-10-27T11:09:05.522Z] papplSystemFindPrinter: printer 'test2' - resource="/ipp/print/test2", printer_id=2, device_uri="socket://HP%5C032OfficeJet%5C032Pro%5C0328730%5C032%5C09108C229%5C093._pdl-datastream._tcp.local/"
D [2020-10-27T11:09:05.522Z] papplSystemFindPrinter: Returning 0x7fe0d40153e0(test2)
D [2020-10-27T11:09:05.522Z] [Client 36] Auto-type header: 255044462D312E34... format: application/pdf
D [2020-10-27T11:09:05.522Z] [Client 36] Print-Job Auto-typed "document-format"='application/pdf'.
D [2020-10-27T11:09:05.522Z] [Job 1] Created job file "/tmp/pappl366365.d/p00002j000000001-citymap_pdf.pdf", format "application/pdf".
D [2020-10-27T11:09:05.522Z] [Printer test2] Checking for new jobs to process.
D [2020-10-27T11:09:05.523Z] [Printer test2] Starting job 1.
I [2020-10-27T11:09:05.523Z] [Client 36] Print-Job successful-ok
I [2020-10-27T11:09:05.523Z] [Client 36] OK application/ipp 214
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: IPP/2.0 request-id=1, status-code=successful-ok
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: operation-attributes-tag
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: attributes-charset charset utf-8
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: attributes-natural-language naturalLanguage en-us
I [2020-10-27T11:09:05.523Z] [Job 1] Starting print job.
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: job-attributes-tag
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: job-id integer 1
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: job-uri uri ipp://localhost/ipp/print/test2/1
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: job-state enum pending
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: job-state-message textWithoutLanguage Job pending.
D [2020-10-27T11:09:05.523Z] [Client 36] Print-Job response: job-state-reasons keyword none
test2-1
I [2020-10-27T11:09:05.523Z] [Client 36] Closing connection from 'localhost'.
E [2020-10-27T11:09:05.523Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
E [2020-10-27T11:09:05.523Z] [Printer test2] Unable to open device 'socket://HP%5C032OfficeJet%5C032Pro%5C0328730%5C032%5C09108C229%5C093._pdl-datastream._tcp.local/', pausing queue until printer becomes available.
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ I [2020-10-27T11:09:06.523Z] Saving system state to '/tmp/ps_printer_app.state'.
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ E [2020-10-27T11:09:10.523Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ E [2020-10-27T11:09:15.523Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
E [2020-10-27T11:09:20.523Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
I [2020-10-27T11:09:22.094Z] [Client 37] Accepted connection from 'localhost'.
I [2020-10-27T11:09:22.094Z] [Client 37] POST http://localhost:0/ipp/system HTTP/1.1
I [2020-10-27T11:09:22.094Z] [Client 37] Continue
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 request: IPP/2.0 request-id=1
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 request: operation-attributes-tag
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 request: attributes-charset charset utf-8
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 request: attributes-natural-language naturalLanguage en-us
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 request: system-uri uri ipp://localhost/ipp/system
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 request: requesting-user-name nameWithoutLanguage till
D [2020-10-27T11:09:22.094Z] papplSystemFindPrinter(system, resource="(null)", printer_id=0, device_uri="(null)")
D [2020-10-27T11:09:22.094Z] papplSystemFindPrinter: printer 'test' - resource="/ipp/print/test", printer_id=1, device_uri="usb://HP/HP%20OfficeJet%20Pro%208730?serial=CN783F60W1"
D [2020-10-27T11:09:22.094Z] papplSystemFindPrinter: printer 'test2' - resource="/ipp/print/test2", printer_id=2, device_uri="socket://HP%5C032OfficeJet%5C032Pro%5C0328730%5C032%5C09108C229%5C093._pdl-datastream._tcp.local/"
D [2020-10-27T11:09:22.094Z] papplSystemFindPrinter: Returning (nil)(none)
I [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 successful-ok
I [2020-10-27T11:09:22.094Z] [Client 37] OK application/ipp 75
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 response: IPP/2.0 request-id=1, status-code=successful-ok
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 response: operation-attributes-tag
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 response: attributes-charset charset utf-8
D [2020-10-27T11:09:22.094Z] [Client 37] 0x0063 response: attributes-natural-language naturalLanguage en-us
I [2020-10-27T11:09:22.095Z] [Client 37] Closing connection from 'localhost'.
E [2020-10-27T11:09:25.524Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ E [2020-10-27T11:09:30.524Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ E [2020-10-27T11:09:35.524Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ killall E [2020-10-27T11:09:40.524Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
pE [2020-10-27T11:09:45.525Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ killall ps-printer-app
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ killall ps-printer-appE [2020-10-27T11:09:50.525Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not known
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$ killall -9E [2020-10-27T11:09:55.525Z] [Device] Unable to lookup \'HP\\032OfficeJet\\032Pro\\0328730\\032\\09108C229\\093._pdl-datastream._tcp.local:9100\': Name or service not knowtill@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
ps-printer-app
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
[1]+ Killed ps-printer-app -o log-level=debug server
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$
till@till-x1yoga:~/printing/openprinting/ps-printer-app/x$