Project

General

Profile

Bug #8664

Ungraceful handling of SIGPIPE

Added by Dominick Rocco over 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
05/07/2015
Due date:
% Done:

0%

Estimated time:
First Occurred:
Occurs In:
Stakeholders:
Duration:

Description

When piped to "head", jobsub_q prints a nasty python traceback and an IOError when the output stream is closed. This probably pops up in other jobsub_client tools as well. This can be resolved using the built-in signal module. From stack overflow, I recently cargo-culted this solution for one of my own scripts:
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE,SIG_DFL)

Some solutions also involved catching the exception, although that seems less elegant. Original stack overflow entry here: http://stackoverflow.com/questions/14207708/ioerror-errno-32-broken-pipe-python

Complete error output:

Traceback (most recent call last):
  File "/grid/fermiapp/products/common/db/../prd/jobsub_client/v1_0_4/NULL/jobsub_q", line 161, in main
    http_code = js_client.listJobs(options.jobId,options.uid,options.outFormat)
  File "/grid/fermiapp/products/common/prd/jobsub_client/v1_0_4/NULL/jobsubClient.py", line 526, in listJobs
    return self.changeJobState(self.listURL, 'GET')
  File "/grid/fermiapp/products/common/prd/jobsub_client/v1_0_4/NULL/jobsubClient.py", line 410, in changeJobState
    self.printResponse(curl, response, response_time)
  File "/grid/fermiapp/products/common/prd/jobsub_client/v1_0_4/NULL/jobsubClient.py", line 588, in printResponse
    serving_server, response_time)
  File "/grid/fermiapp/products/common/prd/jobsub_client/v1_0_4/NULL/jobsubClient.py", line 709, in print_json_response
    print_msg(output)
  File "/grid/fermiapp/products/common/prd/jobsub_client/v1_0_4/NULL/jobsubClient.py", line 682, in print_msg
    print '%s' % '\n'.join(msg)
IOError: [Errno 32] Broken pipe
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

History

#1 Updated by Parag Mhashilkar over 4 years ago

  • Assignee set to Dennis Box
  • Target version set to v1.2

#2 Updated by Dennis Box about 4 years ago

  • Target version changed from v1.2 to v1.1.9.1

#3 Updated by Dennis Box about 4 years ago

  • Status changed from New to Feedback

#4 Updated by Dennis Box almost 4 years ago

  • Status changed from Feedback to Closed


Also available in: Atom PDF