Version: (using KDE 3.1.9) Compiler: gcc version 3.2.3 20030210 (Debian prerelease) OS: Linux (i686) release 2.4.19-jb-preempt-w4l Hi, when I run pdflatex on a latex file whose PDF counterpart is watched by kghostview, kghostview keeps popping up "cannot read file.pdf" while pdflatex is still running. (I'd expect it to perhaps display this in the status bar, and wait until the PDF is available again.) When pdflatex is finished, it doesn't redisplay the current page, it clears and displays an EMPTY page. Only when I press pgup/pgdn, the page is displayed correctly. BUT: when I press anything else (eg. page down), kghostview crashes ... however, this only seems to happen when I put kghostview and its annoying error messages in the background during the pdflatex run: (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)...[New Thread 16384 (LWP 22378)] (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...0x410c3a39 in wait4 () from /lib/libc.so.6 #0 0x410c3a39 in wait4 () from /lib/libc.so.6 #1 0x41136bc0 in sys_sigabbrev () from /lib/libc.so.6 #2 0x40f12061 in waitpid () from /lib/libpthread.so.0 #3 0x4070106b in KCrash::defaultCrashHandler(int) () from /usr/lib/libkdecore.so.4 #4 0x41050898 in sigaction () from /lib/libc.so.6 #5 0x40062991 in KDSC::isStructured() const () from /usr/lib/kde3/libkghostviewpart.so #6 0x40039a37 in KGVMiniWidget::nextPage() () from /usr/lib/kde3/libkghostviewpart.so #7 0x40049842 in KGVPart::slotNextPage() () from /usr/lib/kde3/libkghostviewpart.so #8 0x4004add3 in KGVPart::qt_invoke(int, QUObject*) () from /usr/lib/kde3/libkghostviewpart.so #9 0x40a6721a in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/lib/libqt-mt.so.3 #10 0x40a670d7 in QObject::activate_signal(int) () from /usr/lib/libqt-mt.so.3 #11 0x404dac20 in KAction::activated() () from /usr/lib/libkdeui.so.4 #12 0x404da6ab in KAction::slotActivated() () from /usr/lib/libkdeui.so.4 #13 0x404dadc0 in KAction::qt_invoke(int, QUObject*) () from /usr/lib/libkdeui.so.4 #14 0x40a6721a in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/lib/libqt-mt.so.3 #15 0x40a670d7 in QObject::activate_signal(int) () from /usr/lib/libqt-mt.so.3 #16 0x406fcd60 in KAccelPrivate::menuItemActivated() () from /usr/lib/libkdecore.so.4 #17 0x406fba88 in KAccelPrivate::eventFilter(QObject*, QEvent*) () from /usr/lib/libkdecore.so.4 #18 0x40a65454 in QObject::activate_filters(QEvent*) () from /usr/lib/libqt-mt.so.3 #19 0x40a653a2 in QObject::event(QEvent*) () from /usr/lib/libqt-mt.so.3 #20 0x40a94526 in QWidget::event(QEvent*) () from /usr/lib/libqt-mt.so.3 #21 0x40b2b8eb in QMainWindow::event(QEvent*) () from /usr/lib/libqt-mt.so.3 #22 0x40a13236 in QApplication::internalNotify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3 #23 0x40a12e1f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3 #24 0x4069b270 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdecore.so.4 #25 0x406fac76 in KAccelEventHandler::x11Event(_XEvent*) () from /usr/lib/libkdecore.so.4 #26 0x4069fbc1 in KApplication::x11EventFilter(_XEvent*) () from /usr/lib/libkdecore.so.4 #27 0x409b6ef6 in qt_set_x11_event_filter(int (*)(_XEvent*)) () from /usr/lib/libqt-mt.so.3 #28 0x409bf458 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libqt-mt.so.3 #29 0x409d26fd in QEventLoop::processEvents(unsigned) () from /usr/lib/libqt-mt.so.3 #30 0x40a247f7 in QEventLoop::enterLoop() () from /usr/lib/libqt-mt.so.3 #31 0x40a246b4 in QEventLoop::exec() () from /usr/lib/libqt-mt.so.3 #32 0x40a13430 in QApplication::exec() () from /usr/lib/libqt-mt.so.3 #33 0x08048cab in KApplication::~KApplication() () #34 0x4103f9f1 in __libc_start_main () from /lib/libc.so.6 Please have a look at this. Thank you!
I see similar results. kghostview tries to quickly to read the file (before it is done writing). I'd suggest either disabing the "watch file" option, make it wait longer before trying to read a changed file, or only reload the file on a new click (or some action) from the user. (For the record, kdvi seems to have a similar problem).
Subject: kdegraphics/kghostview CVS commit by luis_pedro: Delay the reloading of a watched file until we have had some time without file changes. This prevents kghostview from trying to read half-finished files hundreds of times which sometimes led to crashes. CCMAIL: 55653-done@bugs.kde.org M +15 -2 kgv_view.cpp 1.124 M +3 -0 kgv_view.h 1.63 --- kdegraphics/kghostview/kgv_view.cpp #1.123:1.124 @@ -59,4 +59,5 @@ KGVPart::KGVPart( QWidget* parentWidget, _isGuiInitialized( false ), _isFileDirty( false ), + _dirtyHandler( new QTimer( this ) ), _currentPage( 0 ) { @@ -77,4 +78,6 @@ KGVPart::KGVPart( QWidget* parentWidget, connect( _fileWatcher, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileDirty( const QString& ) ) ); + connect( _dirtyHandler, SIGNAL( timeout() ), + this, SLOT( slotDoFileDirty() ) ); // Setup main widget @@ -644,11 +647,21 @@ void KGVPart::slotJobFinished( KIO::Job* void KGVPart::slotFileDirty( const QString& fileName ) { - if( fileName == m_file ) + // The beauty of this is that each start cancels the previous one. + // This means that timeout() is only fired when there have + // no changes to the file for the last 750 milisecs. + // This is supposed to ensure that we don't update on every other byte + // that gets written to the file. + if ( fileName == m_file ) { + _dirtyHandler->start( 750, true ); + } +} + +void KGVPart::slotDoFileDirty() +{ kdDebug(4500) << "KGVPart::File changed" << endl; _isFileDirty = true; _currentPage = _docManager->currentPage(); document()->openFile( m_file, _mimetype ); - } } --- kdegraphics/kghostview/kgv_view.h #1.62:1.63 @@ -119,4 +119,6 @@ protected slots: void slotFileDirty( const QString& ); + void slotDoFileDirty(); + void slotOrientation (int); void slotMedia (int); @@ -182,4 +184,5 @@ private: KDirWatch* _fileWatcher; KGVRun* _mimetypeScanner; + QTimer* _dirtyHandler; QString _mimetype;
Hi, sorry to bother you, but this is not (yet) resolved. 1) When "watch file" is enabled and the file is unreadable, kghostview keeps popping up messages like "cannot read /tmp/kde-XXX/konquerorXYZ.ps". One after another. I have a fairly large document to create, LaTeX sometimes takes 30 seconds or more, and this shouldn't happen. Please make it a statusbar message or something else but no popup window which requires user interaction. Thanks! 2) When you turn OFF "watch file" while kghostview tries reading a PDF which is just being written to (like during a pdflatex compilation), kghostview crashes when pdflatex is finished and you flip pages: 0x4110daf9 in wait4 () from /lib/libc.so.6 #0 0x4110daf9 in wait4 () from /lib/libc.so.6 #1 0x41180f60 in sys_sigabbrev () from /lib/libc.so.6 #2 0x40f5a061 in waitpid () from /lib/libpthread.so.0 #3 0x40754d7f in KCrash::defaultCrashHandler(int) () from /usr/lib/libkdecore.so.4 #4 0x4109a9c8 in sigaction () from /lib/libc.so.6 #5 0x400645dd in KDSC::isStructured() const () from /usr/lib/kde3/libkghostviewpart.so #6 0x40040083 in KGVMiniWidget::prevPage() () from /usr/lib/kde3/libkghostviewpart.so #7 0x4004bb3e in KGVPart::slotPrevPage() () from /usr/lib/kde3/libkghostviewpart.so #8 0x4004d46b in KGVPart::qt_invoke(int, QUObject*) () from /usr/lib/kde3/libkghostviewpart.so #9 0x40ab8c42 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/lib/libqt-mt.so.3 #10 0x40ab8aff in QObject::activate_signal(int) () from /usr/lib/libqt-mt.so.3 #11 0x404fcdec in KAction::activated() () from /usr/lib/libkdeui.so.4 #12 0x404fc877 in KAction::slotActivated() () from /usr/lib/libkdeui.so.4 #13 0x404fcf8c in KAction::qt_invoke(int, QUObject*) () from /usr/lib/libkdeui.so.4 #14 0x40ab8c42 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/lib/libqt-mt.so.3 #15 0x40ab8aff in QObject::activate_signal(int) () from /usr/lib/libqt-mt.so.3 #16 0x4074d5c0 in KAccelPrivate::menuItemActivated() () from /usr/lib/libkdecore.so.4 #17 0x4074c2e0 in KAccelPrivate::eventFilter(QObject*, QEvent*) () from /usr/lib/libkdecore.so.4 #18 0x40ab6e7c in QObject::activate_filters(QEvent*) () from /usr/lib/libqt-mt.so.3 #19 0x40ab6dca in QObject::event(QEvent*) () from /usr/lib/libqt-mt.so.3 #20 0x40ae5f4a in QWidget::event(QEvent*) () from /usr/lib/libqt-mt.so.3 #21 0x40b7d2b3 in QMainWindow::event(QEvent*) () from /usr/lib/libqt-mt.so.3 #22 0x40a64c66 in QApplication::internalNotify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3 #23 0x40a6484f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3 #24 0x406d8fc4 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdecore.so.4 #25 0x4074b4ce in KAccelEventHandler::x11Event(_XEvent*) () from /usr/lib/libkdecore.so.4 #26 0x406ddaf5 in KApplication::x11EventFilter(_XEvent*) () from /usr/lib/libkdecore.so.4 #27 0x40a0860a in qt_set_x11_event_filter(int (*)(_XEvent*)) () from /usr/lib/libqt-mt.so.3 #28 0x40a10c2c in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libqt-mt.so.3 #29 0x40a24141 in QEventLoop::processEvents(unsigned) () from /usr/lib/libqt-mt.so.3 #30 0x40a76223 in QEventLoop::enterLoop() () from /usr/lib/libqt-mt.so.3 #31 0x40a760e0 in QEventLoop::exec() () from /usr/lib/libqt-mt.so.3 #32 0x40a64e60 in QApplication::exec() () from /usr/lib/libqt-mt.so.3 #33 0x08048e91 in KApplication::~KApplication() () #34 0x41089a51 in __libc_start_main () from /lib/libc.so.6 Please look at this as well. Thank you very much! :)
Can you post the latex source file? I admit I had only tried it with my own small latex files, so it could reallly help me to have a test case. If there are EPSs' or similar please include those (you can just post a big tar.gz file). Thanks, luis
Subject: Re: kghostview crashes when "watch file" is enabled On Thu, May 22, 2003 at 11:41:59AM -0000, Luis Pedro Coelho wrote: > Can you post the latex source file? > I admit I had only tried it with my own small latex files, so it could > reallly help me to have a test case. If there are EPSs' or similar > please include those (you can just post a big tar.gz file). This is my diploma thesis :-) (draft, anyway) I could theoretically send you an ~10MB tar.gz file which needs a dozen additional packages (listings, for example) which are not in the default tetex distribution. If you want to experiment, be my guest. An easier approach would be to create a LaTeX file with lots of large PNG pictures: \includegraphics[width=.5\textwidth]{FILE.png} and then compile it with 'pdflatex'. LaTeX takes about a second to parse a PNG and embed it into a PDF, on my Athlon XP 1800+. (which I find kind of strange, speaking of it...)
Confirmed. I just did a file with a one png and then create result.tex with simple tex headers repeat 200 {cat one_png.tex >> result.tex } echo "\end{document}" >> result.tex
Subject: kdegraphics/kghostview CVS commit by luis_pedro: Stop the interpreter before reloading. Don't allow slot(Next|Prev)Page when the document is not there. CCMAIL: 55653@bugs.kde.org M +7 -0 kgv_view.cpp 1.137 --- kdegraphics/kghostview/kgv_view.cpp #1.136:1.137 @@ -402,4 +402,7 @@ void KGVPart::slotReadDown() void KGVPart::slotPrevPage() { + if( !( document() && document()->isOpen() ) ) + return; + _docManager->prevPage(); _pageView->scrollTop(); @@ -408,4 +411,7 @@ void KGVPart::slotPrevPage() void KGVPart::slotNextPage() { + + if( !( document() && document()->isOpen() ) ) + return; if( _docManager->nextPage() ) { _pageView->scrollTop(); @@ -677,4 +683,5 @@ void KGVPart::slotDoFileDirty() kdDebug(4500) << "KGVPart::File changed" << endl; _isFileDirty = true; + _psWidget->stopInterpreter(); document()->openFile( m_file, _mimetype ); }
Subject: kdegraphics/kghostview CVS commit by luis_pedro: If we are canceling the watching of files, cancel any pending timers as well. CCMAIL: 55653-close@bugs.kde.org M +3 -1 kgv_view.cpp 1.138 --- kdegraphics/kghostview/kgv_view.cpp #1.137:1.138 @@ -437,6 +437,8 @@ void KGVPart::slotWatchFile() if( _watchFile->isChecked() ) _fileWatcher->startScan(); - else + else { + _dirtyHandler->stop(); _fileWatcher->stopScan(); + } }
Wishlist: (using CVS from July 28th) Please change the popup window "Cannot open file ..." while LaTeX is compiling to something like ---------------------------------------------------------------- Cannot open file %s. Retry in %d seconds. [Don't try again / Close file] ---------------------------------------------------------------- or, make it a status bar message and not a popup window! And please do NOT open a new error message every couple seconds. When I compile a big LaTeX document which takes about 30-40 seconds to compile, i have 6-7 of those "Cannot open ..." windows stacked on my desktop. This is really annoying. Thank you!
I think this problem is still present. kghostview occasionally crashes when a .ps file is updated (via groff -Tps). That is on SuSE 9.1 professional, as updated to the latest KDE version; 9.1 postdates the latest preceding comment in the bug report archive, and KDE has been updated several times since. kghostview 0.20 using KDE 3.3.1, Linux (i686) release 2.6.5-7.111-default, gcc version 3.3.3 (SuSE Linux) backtrace: Using host libthread_db library "/lib/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 24143)] [KCrash handler] #5 0x00000aee in ?? () #6 0x40d2cd3c in QObject::connect () from /usr/lib/qt3/lib/libqt-mt.so.3 #7 0x400854a8 in ThumbnailService::processOne () from /opt/kde3/lib/libkghostviewlib.so.0 #8 0x400857a3 in ThumbnailService::slotDone () from /opt/kde3/lib/libkghostviewlib.so.0 #9 0x40085943 in ThumbnailService::qt_invoke () from /opt/kde3/lib/libkghostviewlib.so.0 #10 0x40d2b13e in QObject::activate_signal () from /usr/lib/qt3/lib/libqt-mt.so.3 #11 0x4006b8d2 in KPSWidget::newPageImage () from /opt/kde3/lib/libkghostviewlib.so.0 #12 0x4006de70 in KPSWidget::x11Event () from /opt/kde3/lib/libkghostviewlib.so.0 #13 0x40c664d4 in QApplication::x11ProcessEvent () from /usr/lib/qt3/lib/libqt-mt.so.3 #14 0x40c775d5 in QEventLoop::processEvents () from /usr/lib/qt3/lib/libqt-mt.so.3 #15 0x40ce1071 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3 #16 0x40ce0eb6 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3 #17 0x40ccae8f in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3 #18 0x08049a8b in main ()