Bug 314432

Summary: Fileindexer fails with too many open pipes, causing nepomukservicestub crash
Product: [Unmaintained] nepomuk Reporter: Mathias Tillman <master.homer>
Component: fileindexerAssignee: Nepomuk Bugs Coordination <nepomuk-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nepomuk-bugs
Priority: NOR    
Version: 4.9.98 RC3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Mathias Tillman 2013-02-04 19:21:44 UTC
I'm not sure since what KDE version as I have had nepomuk turned off due to it's instability in the past, but now that it's at least a bit more stable the nepomukservicestub with nepomukfileindexer service crashes randomly. Which I have concluded is because the fileindexer has too many open instances of the nepomukindexer executable.

The crash backtrace is as follows:
#5  0x00007f4f11174425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#6  0x00007f4f11177b8b in __GI_abort () at abort.c:91
#7  0x00007f4f111b239e in __libc_message (do_abort=2, fmt=0x7f4f112b9e5f "*** %s ***: %s terminated\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:201
#8  0x00007f4f1124883c in __GI___fortify_fail (msg=<optimized out>) at fortify_fail.c:38
#9  0x00007f4f11247710 in __GI___chk_fail () at chk_fail.c:29
#10 0x00007f4f112487ce in __fdelt_chk (d=<optimized out>) at fdelt_chk.c:26
#11 0x00007f4f1367c854 in QProcessPrivate::waitForStarted (this=0x3778af0, msecs=30000) at io/qprocess_unix.cpp:1038
#12 0x00007f4f13636f53 in QProcess::waitForFinished (this=0x4853b70, msecs=30000) at io/qprocess.cpp:1752
#13 0x00007f4f01e376d6 in Nepomuk2::FileIndexingJob::slotProcessTimerTimeout (this=0x35bebc0) at ../../../services/fileindexer/fileindexingjob.cpp:118
#14 0x00007f4f136b6f5f in QMetaObject::activate (sender=0x2b22100, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3547
#15 0x00007f4f136b626c in QObject::event (this=0x2b22100, e=<optimized out>) at kernel/qobject.cpp:1157
#16 0x00007f4f119cbe9c in QApplicationPrivate::notify_helper (this=this@entry=0x234b8d0, receiver=receiver@entry=0x2b22100, e=e@entry=0x7fffc2d36d30) at kernel/qapplication.cpp:4562
#17 0x00007f4f119d030a in QApplication::notify (this=0x7fffc2d371c0, receiver=0x2b22100, e=0x7fffc2d36d30) at kernel/qapplication.cpp:4423
#18 0x00007f4f129d1636 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#19 0x00007f4f136a156e in QCoreApplication::notifyInternal (this=0x7fffc2d371c0, receiver=0x2b22100, event=0x7fffc2d36d30) at kernel/qcoreapplication.cpp:915
#20 0x00007f4f136d2462 in sendEvent (event=0x7fffc2d36d30, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#21 QTimerInfoList::activateTimers (this=0x234f760) at kernel/qeventdispatcher_unix.cpp:611
#22 0x00007f4f136cf584 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:186
#23 timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:180
#24 0x00007f4f1064eab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007f4f1064ede8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007f4f1064eea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007f4f136cfbf6 in QEventDispatcherGlib::processEvents (this=0x2328c20, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#28 0x00007f4f11a70c1e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#29 0x00007f4f136a02bf in QEventLoop::processEvents (this=this@entry=0x7fffc2d36fa0, flags=...) at kernel/qeventloop.cpp:149
#30 0x00007f4f136a0548 in QEventLoop::exec (this=0x7fffc2d36fa0, flags=...) at kernel/qeventloop.cpp:204
#31 0x00007f4f136a5708 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#32 0x0000000000403dd0 in main (argc=<optimized out>, argv=0x7fffc2d37408) at ../../servicestub/main.cpp:177

And if I look in my ~/.xsession-errors I can see references to Too many open files right before the crash:
[/usr/bin/nepomukservicestub] QProcessPrivate::createPipe: Cannot create pipe 0x3778c40: Too many open files
QSocketNotifier: Invalid socket specified
QProcessPrivate::createPipe: Cannot create pipe 0x3778c68: Too many open files
QSocketNotifier: Invalid socket specified

Reproducible: Sometimes

Steps to Reproduce:
I can't really reproduce the error in nepomuk as it happens randomly. However, you can reproduce the error in an external program using this code:
QProcess process[1024];
	for(int i =0 ; i < 1024; i++) {
		process[i].start("bash test2");
	}

	for(int i = 0; i < 1024; i++) {
		process[i].kill();
		process[i].waitForFinished();
	}
Actual Results:  
It fails at #168 stating Too many open files and then later on crashes in waitForFinished at #168 with the same backtrace as the nepomuk indexer.

Expected Results:  
It should either wait until a pipe is free, or not create so many pipes.

This might be considered a Qt problem as it shouldn't crash when calling waitForFinished on a QProcess that fails to run. However, the nepomuk file indexer would still have to check for this and take appropriate action when it fails (wait until a pipe is ready for example).
Comment 1 Christoph Feck 2013-02-05 00:05:36 UTC

*** This bug has been marked as a duplicate of bug 310777 ***