What does Interrupt SIGPIPE error mean?

12 views
Skip to first unread message

Malcolm

unread,
Feb 19, 2020, 10:01:39 AM2/19/20
to HiPi Perl
Hi,

I'm coding a fhem module to use SPI to talk to PIC.  I keep getting errors in the log like this

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Interrupt SIGPIPE at /usr/local/lib/arm-linux-gnueabihf/perl/5.28.1/HiPi.pm line 79, <GEN31> line 839.

2020.02.16 13:12:57 1: txt:97:13:10:31:139:8:0:0:0:0:0:0:3:13:10,len:15,off:0
2020.02.16 13:12:57 1: stacktrace:
2020.02.16 13:12:57 1:     main::TcpServer_WriteBlocking       called by ./FHEM/01_FHEMWEB.pm (2131)
2020.02.16 13:12:57 1:     main::FW_outputChunk                called by ./FHEM/01_FHEMWEB.pm (2191)
2020.02.16 13:12:57 1:     main::FW_returnFileAsStream         called by ./FHEM/01_FHEMWEB.pm (780)
2020.02.16 13:12:57 1:     main::FW_serveSpecial               called by ./FHEM/01_FHEMWEB.pm (861)
2020.02.16 13:12:57 1:     main::FW_answerCall                 called by ./FHEM/01_FHEMWEB.pm (583)
2020.02.16 13:12:57 1:     main::FW_Read                       called by fhem.pl (3763)
2020.02.16 13:12:57 1:     main::CallFn                        called by fhem.pl (755)
2020.02.16 13:12:58 1:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

what is this telling me?  I don't these errors all the time so I'm unclear how I occasionally cause these or
why they sometimes happen.  This is on a Raspberry PI with the PI as the master.  As the PIC is the slave I
don't see how that could cause an issue.  It would just return rubbish bytes if the PIC misbehaved.

TIA

Malcolm

Mark Dootson

unread,
Feb 19, 2020, 10:16:16 AM2/19/20
to HiPi Perl
Hi,

HiPi traps SIGPIPE messages to handle graceful cleanup on exit of a script. The default behaviour on receiving a SIGPIPE message is to exit.

fhem overrides this to ignore SIGPIPE interrupts because if it didn't, the errors you observe above are seen.

So, the errors are from within fhem, but you see them because HiPi overrides fhem's signal handling.
 
You can reinstate the intended fhem behaviour in your code by restoring the 'ignore' after you use HiPi the first time.

e.g.

use HiPi;
$SIG{PIPE} = 'IGNORE';

I will think about handling differently within HiPi and may change behaviour in future.

Hope this helps.

Mark

Malcolm

unread,
Feb 20, 2020, 3:35:25 AM2/20/20
to HiPi Perl
Hi,

Thanks for the suggestion.  I think you're right.  I've found a line in fhem where it says the ignore pipe (now I know what to search for :-)).  From what I read, and subject to my understanding, TCP pipe fails are not uncommon and you should just retry, but it is easier to respond to the error rather than the pipe error.  Hence pipe error is usually ignored.
So I'll go with that too and ignore pipe.

Thanks

Malcolm
Reply all
Reply to author
Forward
0 new messages