-------- Original Message --------
Subject: [iROD-Chat:7748] iCommands and SIGPIPE
From: Martin Pollard <martin....@sanger.ac.uk>
Date: Wed, February 29, 2012 9:53 am
To: irod...@googlegroups.com
Cc: martin....@sanger.ac.uk
Hi,
At the Sanger we use shell scripting extensively in our genetics
pipelines and we tend to use pipes | quite a bit. Unfortunately there
is a bug in some of the iCommands whereby if you pipe their output to
something which closes the pipe such as head they flood stderr with
messages claiming that the connection to the server might be broken.
This is because there is currently a SIGPIPE handler which is meant to
catch errors in sending data to the server. Because of the way pipes
work in POSIX environments, this catches all closed pipes including
those created by a shell command. I've had a look through the code and
it appears that the send and receive code is error checked, therefore I
suggest the SIGPIPE handler be replaced with a SIG_IGN. Proposed patch
is posted on Bugzilla:
https://www.irods.org/bugzilla/show_bug.cgi?id=146
Any feedback, suggestions etc are welcomed.
Regards,
Martin
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
--
"iRODS: the Integrated Rule-Oriented Data-management System; A community driven, open source, data grid software solution" https://www.irods.org
iROD-Chat: http://groups.google.com/group/iROD-Chat
Can you try running an iquest that returns more lines of output?
I can confirm this is a problem on Ubuntu, running the same command on
our iRODS system (which produces 244 rather than 38 lines of output).
> $ lsb_release -d
> Description: Ubuntu 10.04.4 LTS
> $ /software/irods/icommands/bin/iquest "select DATA_ID" | wc -l
> 244
> $ /software/irods/icommands/bin/iquest "select DATA_ID" | head
> DATA_ID = 10016
> ------------------------------------------------------------
> DATA_ID = 10080
> ------------------------------------------------------------
> DATA_ID = 10082
> ------------------------------------------------------------
> DATA_ID = 10086
> ------------------------------------------------------------
> DATA_ID = 10087
> ------------------------------------------------------------
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
If I instead run the same iquest in a zone that has more entries, I
get more broken pipe signals on STDERR.
> $ /software/irods/icommands/bin/iquest --no-page -z /seq "select DATA_ID where DATA_ID like '102%'" | wc -l
> 743
> $ /software/irods/icommands/bin/iquest --no-page -z /seq "select DATA_ID where DATA_ID like '102%'" | head
> Zone is /seq
> DATA_ID = 10206
> ------------------------------------------------------------
> DATA_ID = 10208
> ------------------------------------------------------------
> DATA_ID = 10209
> ------------------------------------------------------------
> DATA_ID = 10216
> ------------------------------------------------------------
> DATA_ID = 10219
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
And the number of entries seems to be associated with the number of errors:
> $ /software/irods/icommands/bin/iquest --no-page -z /seq "select DATA_ID where DATA_ID like '10%'" | wc -l
> 45839
> $ /software/irods/icommands/bin/iquest --no-page -z /seq "select DATA_ID where DATA_ID like '10%'" | head
> Zone is /seq
> DATA_ID = 10206
> ------------------------------------------------------------
> DATA_ID = 10208
> ------------------------------------------------------------
> DATA_ID = 10209
> ------------------------------------------------------------
> DATA_ID = 10216
> ------------------------------------------------------------
> DATA_ID = 10219
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> Client Caught broken pipe signal. Connection to server may be down
> ...(repeats 429 more times)
Fitting a linear model to errors vs lines shows we'd expect about 1
error for every 100 lines of output, so given this data if all else is
equal we'd expect a dataset with 38 lines to have approximately 0
errors.
Josh.