Bug 349893

Summary: Swapfile synced on every keystroke
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: pbs3141
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: minor CC: bugzilla-kde, cullmann
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description pbs3141 2015-07-04 13:00:48 UTC
Reproducible: Always

Steps to Reproduce:
1. Open a document that exists on disk.
2. Enable swapfile, set sync timeout to 15 sec.
3. Hold down a key.

Actual Results:  
Hard disk thrashing noise, because swapfile is constantly being synced. Can confirm using IO monitoring tools, for example. /proc/sys/vm/block_dump.


swapSyncInterval() is measured in seconds, but is passed to QTimer::start as the msecs argument.

swapfile/kateswapfile.cpp:
-syncTimer()->start(m_document->config()->swapSyncInterval());
+syncTimer()->start(m_document->config()->swapSyncInterval() * 1000);

The value was previously hard-coded to 15 sec.
syncTimer()->start(15000);
Comment 1 Christoph Cullmann 2015-07-11 14:03:41 UTC
it commit 034f0a9babf28b5d4719a9695066e855186e6cf0 by Christoph Cullmann.
Committed on 08/06/2015 at 18:40.
Pushed by cullmann into branch 'master'.

fix problem with lockups, wrong time unit ms vs. s for swrap file saving
BUG: 348159

M  +2    -1    src/swapfile/kateswapfile.cpp

http://commits.kde.org/ktexteditor/034f0a9babf28b5d4719a9695066e855186e6cf0

diff --git a/src/swapfile/kateswapfile.cpp b/src/swapfile/kateswapfile.cpp
index 8ec3ac2..e91fc55 100644
--- a/src/swapfile/kateswapfile.cpp
+++ b/src/swapfile/kateswapfile.cpp
@@ -464,7 +464,8 @@ void SwapFile::finishEditing()
     // write the file to the disk every 15 seconds (default)
     // skip this if we disabled that
     if (m_document->config()->swapSyncInterval() != 0 && !syncTimer()->isActive()) {
-        syncTimer()->start(m_document->config()->swapSyncInterval());
+        // important: we store the interval as seconds, start wants milliseconds!
+        syncTimer()->start(m_document->config()->swapSyncInterval() * 1000);
     }
 
     // format: qint8

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