gsd-print-notifications polls remote print server every minute even when a user is not logged in
My company recently started to use GDM, and looks like it spawns gsd-print-notifications binary even before anyone logs in.
Looks like gsd-print-notifications immediately starts polling for notifications every minute when there is a /etc/cups/client.conf
pointing to a remote print server.
This behavior seems to be unnecessary, because
- No one is logged in yet to see any notifications
- Server doesn't give any reasonable reply, because the g-s-d doesn't provide any authentication details
- There are no changes in the situation that would require polling again in 1 minute.
In the environment like mine where 50K+ Linux workstations poll a central CUPS server, it generates thousands of connections, and a huge load on CUPS server just to receive a 'client-error-not-found' error.
I suggest a few potential improvements that would hopefully stop my CUPS server from overloading:
- Don't start gsd-print-notifications at all until the user logs in. Or do nothing until the user logs in.
- Don't start polling remote print server until the user actually prints anything. Maybe poll just once for toner/paper alerts if needed. Stop polling after the job was successfully printed.
- Provide a configurable option for CHECK_INTERVAL and CUPS_CONNECTION_TEST_INTERVAL so that sysadmin could control this behavior without recompiling the package.
- Stop polling if 'client-error-not-found' error or any other non-treatable error was received from CUPS.
Typical logs from CUPS (ipv6 addresses redacted), no user is logged into [v1.2222:aaaa::fdad] client machine.
$ grep Client.13860 /var/log/cups/error_log
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Server address is "[v1.2222:fffff:84]".
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Accepted from [v1.2222:aaaa::fdad]:49524 (IPv6)
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Waiting for request.
D [05/Jun/2020:19:16:10 +0000] [Client 13860] OPTIONS * HTTP/1.1
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Read: status=200, state=0
D [05/Jun/2020:19:16:10 +0000] [Client 13860] No authentication data provided.
D [05/Jun/2020:19:16:10 +0000] [Client 13860] cupsdSendHeader: code=101, type="(null)", auth_type=0
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Connection now encrypted.
D [05/Jun/2020:19:16:10 +0000] [Client 13860] cupsdSendHeader: code=200, type="(null)", auth_type=0
D [05/Jun/2020:19:16:10 +0000] [Client 13860] POST / HTTP/1.1
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Read: status=200, state=6
D [05/Jun/2020:19:16:10 +0000] [Client 13860] No authentication data provided.
D [05/Jun/2020:19:16:10 +0000] [Client 13860] 2.0 Get-Notifications 1256
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Returning IPP client-error-not-found for Get-Notifications (/printers/) from [v1.2222:aaaa::fdad].
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Content-Length: 126
D [05/Jun/2020:19:16:10 +0000] [Client 13860] cupsdSendHeader: code=200, type="application/ipp", auth_type=0
D [05/Jun/2020:19:16:10 +0000] [Client 13860] con->http=0x563496e0bae0
D [05/Jun/2020:19:16:10 +0000] [Client 13860] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_LENGTH, data_remaining=126, response=0x563496d4e190(IPP_STATE_DATA), pipe_pid=0, file=-1
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Writing IPP response, ipp_state=IPP_STATE_DATA, old wused=0, new wused=0
D [05/Jun/2020:19:16:10 +0000] [Client 13860] bytes=0, http_state=0, data_remaining=126
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Flushing write buffer.
D [05/Jun/2020:19:16:10 +0000] [Client 13860] New state is HTTP_STATE_WAITING
D [05/Jun/2020:19:16:10 +0000] [Client 13860] Waiting for request.
D [05/Jun/2020:19:17:10 +0000] [Client 13860] POST / HTTP/1.1
D [05/Jun/2020:19:17:10 +0000] [Client 13860] Read: status=200, state=6
D [05/Jun/2020:19:17:10 +0000] [Client 13860] No authentication data provided.
D [05/Jun/2020:19:17:10 +0000] [Client 13860] 2.0 Get-Notifications 1257
D [05/Jun/2020:19:17:10 +0000] [Client 13860] Returning IPP client-error-not-found for Get-Notifications (/printers/) from [v1.2222:aaaa::fdad].
D [05/Jun/2020:19:17:10 +0000] [Client 13860] Content-Length: 126
D [05/Jun/2020:19:17:10 +0000] [Client 13860] cupsdSendHeader: code=200, type="application/ipp", auth_type=0
D [05/Jun/2020:19:17:10 +0000] [Client 13860] con->http=0x563496e0bae0
D [05/Jun/2020:19:17:10 +0000] [Client 13860] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_LENGTH, data_remaining=126, response=0x563496afbbd0(IPP_STATE_DATA), pipe_pid=0, file=-1
D [05/Jun/2020:19:17:10 +0000] [Client 13860] Writing IPP response, ipp_state=IPP_STATE_DATA, old wused=0, new wused=0
D [05/Jun/2020:19:17:10 +0000] [Client 13860] bytes=0, http_state=0, data_remaining=126
D [05/Jun/2020:19:17:10 +0000] [Client 13860] Flushing write buffer.
D [05/Jun/2020:19:17:10 +0000] [Client 13860] New state is HTTP_STATE_WAITING
D [05/Jun/2020:19:17:10 +0000] [Client 13860] Waiting for request.
It goes on every minute:
$ grep Client.13860.*2.0.Get-Notif /var/log/cups/error_log
D [05/Jun/2020:19:16:10 +0000] [Client 13860] 2.0 Get-Notifications 1256
D [05/Jun/2020:19:17:10 +0000] [Client 13860] 2.0 Get-Notifications 1257
D [05/Jun/2020:19:18:10 +0000] [Client 13860] 2.0 Get-Notifications 1258
D [05/Jun/2020:19:19:10 +0000] [Client 13860] 2.0 Get-Notifications 1259
D [05/Jun/2020:19:20:10 +0000] [Client 13860] 2.0 Get-Notifications 1260
D [05/Jun/2020:19:21:10 +0000] [Client 13860] 2.0 Get-Notifications 1261
D [05/Jun/2020:19:22:10 +0000] [Client 13860] 2.0 Get-Notifications 1262
D [05/Jun/2020:19:23:10 +0000] [Client 13860] 2.0 Get-Notifications 1263
D [05/Jun/2020:19:24:10 +0000] [Client 13860] 2.0 Get-Notifications 1264
D [05/Jun/2020:19:25:10 +0000] [Client 13860] 2.0 Get-Notifications 1265
D [05/Jun/2020:19:26:10 +0000] [Client 13860] 2.0 Get-Notifications 1266
D [05/Jun/2020:19:27:10 +0000] [Client 13860] 2.0 Get-Notifications 1267
D [05/Jun/2020:19:28:10 +0000] [Client 13860] 2.0 Get-Notifications 1268
D [05/Jun/2020:19:29:10 +0000] [Client 13860] 2.0 Get-Notifications 1269
D [05/Jun/2020:19:30:10 +0000] [Client 13860] 2.0 Get-Notifications 1270
D [05/Jun/2020:19:31:10 +0000] [Client 13860] 2.0 Get-Notifications 1271
D [05/Jun/2020:19:32:10 +0000] [Client 13860] 2.0 Get-Notifications 1272
D [05/Jun/2020:19:33:10 +0000] [Client 13860] 2.0 Get-Notifications 1273
D [05/Jun/2020:19:34:10 +0000] [Client 13860] 2.0 Get-Notifications 1274
D [05/Jun/2020:19:35:10 +0000] [Client 13860] 2.0 Get-Notifications 1275
D [05/Jun/2020:19:36:10 +0000] [Client 13860] 2.0 Get-Notifications 1276
D [05/Jun/2020:19:37:10 +0000] [Client 13860] 2.0 Get-Notifications 1277
D [05/Jun/2020:19:38:10 +0000] [Client 13860] 2.0 Get-Notifications 1278