KApplication blocks SIGPIPE

Hi All,
For some reason, on CentOS 7 the k4dirstat application is getting SIGPIPE and the application crashes with error -

ICE default IO error handler doing an exit(), pid = XXX , error_code=32 i have figured out that this error shows up after application gets SIGPIPE.

I am trying to customize this application so that as soon as application gets SIGPIPE, i am able to see traceback . I noticed that as soon as KApplication object is created, the application stops invoking handler function in response to SIGPIPE .

void sigpipeHandler(int signum) {
    std::cout << "Caught signal (" << signum << ")" << std::endl;
    cpptrace::generate_trace().print();
    // Handle SIGPIPE as needed
    // }
}


int main(int argc, char **argv)
{
    signal(SIGPIPE, sigpipeHandler);
    signal(SIGKILL, sigpipeHandler);
    signal(SIGTERM, sigpipeHandler);
    signal(SIGINT, sigpipeHandler);
    signal(SIGALRM, sigpipeHandler);
    signal(SIGHUP, sigpipeHandler);
    signal(SIGTRAP, sigpipeHandler);
    signal(SIGBUS, sigpipeHandler);


    KAboutData about("k4dirstat", 0, ki18n("k4dirstat"), version, ki18n(description),
                     KAboutData::License_GPL,
                     ki18n("(c) 1999-2008 Stefan Hundhammer, (c) 2010 Joshua Hodosh"),
                     KLocalizedString(), "https://bitbucket.org/jeromerobert/k4dirstat",
                     "https://bitbucket.org/jeromerobert/k4dirstat/issues");

    about.addAuthor( ki18n("Jerome Robert"),
                      ki18n("Current maintainer." ), 0,
                      "https://bitbucket.org/jeromerobert/k4dirstat" );
    about.addAuthor( ki18n("Stefan Hundhammer"),
                      ki18n("Original kdirstat author." ), "kdirstat@gmx.de",
                      "http://kdirstat.sourceforge.net/" );
    about.addAuthor( ki18n("Joshua Hodosh"), ki18n("Ported to KDE4"),
                     "kdirstat@grumpypenguin.org" );

    about.addCredit( ki18n("SequoiaView Team"),
                      ki18n( "for showing just how useful treemaps really can be." ),
                      0,        // e-mail
                      "http://www.win.tue.nl/sequoiaview" );

    about.addCredit( ki18n("Jarke J. van Wijk, Huub van de Wetering, Mark Bruls"),
                      ki18n( "for their papers about treemaps." ),
                      "vanwijk@win.tue.nl",
                      "http://www.win.tue.nl/~vanwijk/" );

    about.addCredit( ki18n("Ben Shneiderman"),
                      ki18n( "for his ingenious idea of treemaps -\n"
                                 "a truly intuitive way of visualizing tree contents." ),
                      "",       // E-Mail
                      "http://www.cs.umd.edu/hcil/treemaps/" );

    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add("+[Dir/URL]", ki18n( "Directory or URL to open" ));
    KCmdLineArgs::addCmdLineOptions(options);
    sleep(60);
    KApplication app;

So in aforementioned code, when application is in sleep state, i am able to send SIGPIPE (kill -PIPE < process id>) and handler shows me the traceback.

But if i modify the code to

    KApplication app;
   sleep(60);

then the handler function is never invoked, application stays in sleep state.
Could you please let me know if KApplication class masks certain signals after the object is created?

CentOS 7? Is this using KDE 4?

Hi @ngraham , thank you for the response.
yes, OS is CentOS 7 and KDE4, We can close this issue as i am not planning to debug the code further.

I was trying to handle the signal as i assumed that this is kdirstat application specific issue. I tried running dolphin as well , and it gets terminated with same SIGPIPE.

So , any KDE application which tries to query file system (via QT/ any other library) information seems to have been impacted as it seems that the FS information takes very long time.

Some application terminate with ICE error (kdirstat , dolphin) where as other applications take a very long time to show FS information (example - Konqueror and Kwrite’s open file dialog).

However non KDE apps like thunar , nautilus work fine.

And this is not server issue as - from another new XFCE vnc session on same server, these applications (kdirstat,etc) work fine. I assume that there is some issue with $HOME/.kde socket etc. or some helper process is malfunctioning.

I have raised a new help request here (we can mark the current one as duplicate)-

Please do let me know if any information is required from my end on this issue.

Unfortunately I’m doubtful that you’ll find anyone either able or willing to help with KDE 4 stuff on a volunteer basis. That’s gotta be over 10 years old! A lot of us weren’t even KDE contributors back then. If you need commercial support for KDE4 software, I’d recommend checking out KDE e.V.s list of trusted IT consultancies, some of which may be interested in doing the work for a fee.