Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cups hang and shutdown #1736

Closed
michaelrsweet opened this issue Jun 1, 2006 · 6 comments
Closed

cups hang and shutdown #1736

michaelrsweet opened this issue Jun 1, 2006 · 6 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2.1
CUPS.org User: spurnelle

cups after a certain operating time stops on an error :
E [01/Jun/2006:08:16:08 +0200] Unable to open "/dev/null" - Too many open files.
After that cups finishes

Information:
OS : RedHat Enterprise Linux 4 ES U4
version gcc 3.4.5 20051201 (Red Hat 3.4.5-2)

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

This is an old bug from before 1.2.0 - please verify that you are running 1.2.1!

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: spurnelle

It's a compiled version of cups-1.2.1 over a cups 1.1.23 RPM package.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

Please test the attached patch...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

This STR has not been updated by the submitter for two or more weeks and has been closed as required by the CUPS Configuration Management Plan. If the issue still requires resolution, please re-submit a new STR.

@michaelrsweet
Copy link
Collaborator Author

"cupsd.conf":

"$Id: cupsd.conf.in 5454 2006-04-23 21:46:38Z mike $"

Sample configuration file for the Common UNIX Printing System (CUPS)

scheduler. See "man cupsd.conf" for a complete description of this

file.

Log general information in error_log - change "info" to "debug" for

troubleshooting...

LogLevel debug

Administrator user group...

SystemGroup sys root

Only listen for connections from the local machine.

Listen 127.0.0.1:631
Listen 10.217.7.3:631
Listen /var/run/cups/cups.sock

Show shared printers on the local network.

Browsing Off
BrowseOrder deny,Allow
BrowseAllow @Local

ServerAdmin root@coradm01.int-corman.be

ServerKey /etc/openssl/keys/coradm01.cor.soparind.bongrain.key
ServerCertificate /etc/openssl/certs/coradm01.cor.soparind.bongrain.cert

Default authentication type, when authentication is required...

DefaultAuthType Basic

Restrict access to the server...

Order Deny,Allow Deny From All Allow localhost Allow From 10.217.4.0/255.255.252.0

Restrict access to the admin pages...

<Location /admin>
AuthType Basic
AuthClass Group
AuthGroupName Prtoper

Encryption Required

Order Deny,Allow
Deny From All
Allow localhost
Allow From 10.217.4.0/255.255.252.0

Restrict access to configuration files...

<Location /admin/conf>
AuthType Basic
Require user @System
Order allow,deny
Allow localhost

Set the default printer/job policies...

# Job-related operations must be done by the owner or an adminstrator... # Require user @owner @System Order deny,allow Allow From localhost Allow From 10.217.4.0/255.255.252.0

All administration operations require an adminstrator to authenticate...

AuthType Basic # Require user @System Order deny,allow Allow From localhost Allow From 10.217.4.0/255.255.252.0

Only the owner or an administrator can cancel or authenticate a job...

Require user @owner @System Order deny,allow Order deny,allow

PreserveJobFiles No
PreserveJobHistory Yes

End of "$Id: cupsd.conf.in 5454 2006-04-23 21:46:38Z mike $".

@michaelrsweet
Copy link
Collaborator Author

"str1736.patch":

Index: client.c

--- client.c (revision 5612)
+++ client.c (working copy)
@@ -1882,24 +1882,27 @@

if (con->filename)

  • {
    fd = open(con->filename, O_RDONLY);
  • else
  • fd = open("/dev/null", O_RDONLY);
  • if (fd < 0)
  • {
  • cupsdLogMessage(CUPSD_LOG_ERROR,
  •                "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
    
  •                con->http.fd, con->filename ? con->filename : "/dev/null",
    
  •           strerror(errno));
    
  • return (0);
  • if (fd < 0)
  • {
  •  cupsdLogMessage(CUPSD_LOG_ERROR,
    
  •                  "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
    
  •                  con->http.fd, con->filename ? con->filename : "/dev/null",
    
  •             strerror(errno));
    
  •  return (0);
    
  • }
  • fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
    }
  • else
  • fd = -1;

- fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);

con->pipe_pid = pipe_command(con, fd, &(con->file), command, options, root);

  • close(fd);
  • if (fd >= 0)
  • close(fd);

cupsdLogMessage(CUPSD_LOG_INFO, "Started "%s" (pid=%d)", command,
con->pipe_pid);

Index: job.c

--- job.c (revision 5612)
+++ job.c (working copy)
@@ -3079,28 +3079,6 @@
job->status = 0;
memset(job->filters, 0, sizeof(job->filters));

- filterfds[1][0] = open("/dev/null", O_RDONLY);

  • if (filterfds[1][0] < 0)
  • {
  • cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open "/dev/null" - %s.",
  •                strerror(errno));
    
  • snprintf(printer->state_message, sizeof(printer->state_message),

- "Unable to open "/dev/null" - %s.", strerror(errno));

- cupsdAddPrinterHistory(printer);

  • cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,

- "Job canceled because the server could not open /dev/null.");

  • goto abort_job;

- }

- fcntl(filterfds[1][0], F_SETFD, fcntl(filterfds[1][0], F_GETFD) | FD_CLOEXEC);

  • cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: filterfds[%d] = [ %d %d ]",

- 1, filterfds[1][0], filterfds[1][1]);

for (i = 0, slot = 0, filter = (mime_filter_t *)cupsArrayFirst(filters);
filter;
i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
@@ -3154,36 +3132,43 @@
else
{
job->print_pipes[0] = -1;

  • if (!strncmp(printer->device_uri, "file:/dev/", 10) &&
    
  •     strcmp(printer->device_uri, "file:/dev/null"))
    
  •   job->print_pipes[1] = open(printer->device_uri + 5,
    
  •                              O_WRONLY | O_EXCL);
    
  • else if (!strncmp(printer->device_uri, "file:///dev/", 12) &&
    
  •          strcmp(printer->device_uri, "file:///dev/null"))
    
  •   job->print_pipes[1] = open(printer->device_uri + 7,
    
  •                              O_WRONLY | O_EXCL);
    
  • if (!strcmp(printer->device_uri, "file:/dev/null") ||
    
  •     !strcmp(printer->device_uri, "file:///dev/null"))
    
  •   job->print_pipes[1] = -1;
    
    else
  •   job->print_pipes[1] = open(printer->device_uri + 5,
    

- O_WRONLY | O_CREAT | O_TRUNC, 0600);

  • if (job->print_pipes[1] < 0)
    

    {

  •        cupsdLogMessage(CUPSD_LOG_ERROR,
    
  •                   "Unable to open output file \"%s\" - %s.",
    
  •                   printer->device_uri, strerror(errno));
    
  •        snprintf(printer->state_message, sizeof(printer->state_message),
    
  •        "Unable to open output file \"%s\" - %s.",
    
  •            printer->device_uri, strerror(errno));
    
  •   if (!strncmp(printer->device_uri, "file:/dev/", 10))
    
  •     job->print_pipes[1] = open(printer->device_uri + 5,
    
  •                            O_WRONLY | O_EXCL);
    
  •   else if (!strncmp(printer->device_uri, "file:///dev/", 12))
    
  •     job->print_pipes[1] = open(printer->device_uri + 7,
    
  •                            O_WRONLY | O_EXCL);
    
  •   else if (!strncmp(printer->device_uri, "file:///", 8))
    
  •     job->print_pipes[1] = open(printer->device_uri + 7,
    
  •                            O_WRONLY | O_CREAT | O_TRUNC, 0600);
    
  •   else
    
  •     job->print_pipes[1] = open(printer->device_uri + 5,
    
  •                            O_WRONLY | O_CREAT | O_TRUNC, 0600);
    
  •   cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
    
  •                 "Job canceled because the server could not open the "
    
  •         "output file.");
    
  •   if (job->print_pipes[1] < 0)
    
  •   {
    
  •          cupsdLogMessage(CUPSD_LOG_ERROR,
    
  •                     "Unable to open output file \"%s\" - %s.",
    
  •                     printer->device_uri, strerror(errno));
    
  •          snprintf(printer->state_message, sizeof(printer->state_message),
    
  •          "Unable to open output file \"%s\" - %s.",
    
  •              printer->device_uri, strerror(errno));
    
  •        goto abort_job;
    
  • }
    
  •     cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
    
  •                   "Job canceled because the server could not open the "
    
  •           "output file.");
    
  • fcntl(job->print_pipes[1], F_SETFD,
    
  •       fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
    
  •          goto abort_job;
    
  •   }
    
  •   fcntl(job->print_pipes[1], F_SETFD,
    
  •         fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
    
  •      }
    

    }

    cupsdLogMessage(CUPSD_LOG_DEBUG2,
    @@ -3263,26 +3248,8 @@
    argv[0] = sani_uri;

    filterfds[slot][0] = -1;

  •  filterfds[slot][1] = open("/dev/null", O_WRONLY);
    
  •  filterfds[slot][1] = -1;
    
  •  if (filterfds[slot][1] < 0)
    
  •  {
    
  • cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open "/dev/null" - %s.",

  •               strerror(errno));
    
  • snprintf(printer->state_message, sizeof(printer->state_message),

- "Unable to open "/dev/null" - %s.", strerror(errno));

- cupsdAddPrinterHistory(printer);

  • cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,

- "Job canceled because the server could not open a file.");

  •    goto abort_job;
    

- }

  •  fcntl(filterfds[slot][1], F_SETFD,
    

- fcntl(filterfds[slot][1], F_GETFD) | FD_CLOEXEC);

   cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: backend=\"%s\"",
                   command);
   cupsdLogMessage(CUPSD_LOG_DEBUG2,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant