Index rebuild takes 15 minutes with 100% CPU
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zim |
New
|
Undecided
|
Unassigned |
Bug Description
Index rebuild proceeds normally till the end where Zim GUI freezes and the normal 100% CPU changes from all user to about one third system. Repeated 10-second 'strace -c' on the process shows initially only 3 calls: mmap2, brk, munmap. Soon the brk stops, leaving just mmap2 and munmap. (see excerpt below)
First encountered this on doing a Search. Searches now display a few hits, then trigger an index rebuild during which both Zim windows are frozen. If another notebook is open, its window is NOT frozen. The approx. 15min rebuild proceeds as described above. A commandline index rebuild with Zim otherwise completely closed (no daemon running) exhibits the same behavior. All index rebuilds now take about 15mins. All searches now trigger an index rebuild.
Have deleted index.db and rebuilt from scratch numerous times. Same behavior.
RAM usage never goes above 200MB. No swap in use. Conky reports Zim using only 5-5.5% of memory.
Stats...
VERSION: 0.56 on Ubuntu 10.04 on 800MHz AMD Athlon processor with 512MB memory
SIZE OF .zim/index.db: 77824 bytes
HISTORY: Has been working flawlessly for years.
Have fought with this all day including excising vast swaths of pages (on a copy of notebook of course) thinking it was due to some non-UTF-8 pages or bad page names, etc. to no effect. Looks like it's in a tight loop allocating and deallocating RAM.
This might be the well documented mmap2 Python bug (see http://
|
| SAMPLE straces...
|
'strace -c' shortly after freeze begins...
root@LX02:
Process 1946 attached - interrupt to quit
Process 1946 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
93.18 0.028749 23 1243 munmap
6.45 0.001991 3 583 brk
0.37 0.000113 0 1244 mmap2
------ ----------- ----------- --------- --------- ----------------
100.00 0.030853 3070 total
'strace -v' a little later (sample)...
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5efd000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5e2e000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5efd000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5e2e000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5efd000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5e2e000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5efd000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5e2e000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5efd000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5e2e000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5efd000, 847872) = 0
mmap2(NULL, 847872, PROT_READ|
munmap(0xb5e2e000, 847872) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efd000, 847872) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2d000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5d5d000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5efc000, 851968) = 0
mmap2(NULL, 851968, PROT_READ|
munmap(0xb5e2c000, 851968) = 0
Two 10-second 'strace -c' taken after CPU usage changed to one third system...
root@LX02:
Process 1946 attached - interrupt to quit
Process 1946 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
99.85 0.070496 58 1220 munmap
0.15 0.000104 0 1220 mmap2
------ ----------- ----------- --------- --------- ----------------
100.00 0.070600 2440 total
root@LX02:
Process 1946 attached - interrupt to quit
Process 1946 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
99.85 0.101483 110 926 munmap
0.15 0.000153 0 926 mmap2
------ ----------- ----------- --------- --------- ----------------
100.00 0.101636 1852 total
Afraid I'm not familiar with the "python mmap bug". Zim does not use mmap
calls directly, but they may be used by underlying python libraries.
Have you tried running the commandline index with the "-V" or "-D" switch
to check what zim is doing all this time?
If you have not updated zim, maybe an update of python or filesystem /
kernel related packages could have triggered this ?
Regards,
Jaap
On Tue, Jul 9, 2013 at 1:58 PM, Robert C Watson
<email address hidden>wrote:
> Public bug reported: man7.org/ linux/man- pages/man2/ mmap.2. html) but why is it only /boot/share/ NotesArchive/ .zim strace -c -p1946 PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1,
>
> Index rebuild proceeds normally till the end where Zim GUI freezes and
> the normal 100% CPU changes from all user to about one third system.
> Repeated 10-second 'strace -c' on the process shows initially only 3
> calls: mmap2, brk, munmap. Soon the brk stops, leaving just mmap2 and
> munmap. (see excerpt below)
>
> First encountered this on doing a Search. Searches now display a few
> hits, then trigger an index rebuild during which both Zim windows are
> frozen. If another notebook is open, its window is NOT frozen. The
> approx. 15min rebuild proceeds as described above. A commandline index
> rebuild with Zim otherwise completely closed (no daemon running)
> exhibits the same behavior. All index rebuilds now take about 15mins.
> All searches now trigger an index rebuild.
>
> Have deleted index.db and rebuilt from scratch numerous times. Same
> behavior.
>
> RAM usage never goes above 200MB. No swap in use. Conky reports Zim
> using only 5-5.5% of memory.
>
> Stats...
> VERSION: 0.56 on Ubuntu 10.04 on 800MHz AMD Athlon processor with 512MB
> memory
> SIZE OF .zim/index.db: 77824 bytes
> HISTORY: Has been working flawlessly for years.
>
> Have fought with this all day including excising vast swaths of pages
> (on a copy of notebook of course) thinking it was due to some non-UTF-8
> pages or bad page names, etc. to no effect. Looks like it's in a tight
> loop allocating and deallocating RAM.
>
> This might be the well documented mmap2 Python bug (see
> http://
> being triggered now?
>
> |
> | SAMPLE straces...
> |
>
> 'strace -c' shortly after freeze begins...
>
> root@LX02:
> Process 1946 attached - interrupt to quit
> Process 1946 detached
> % time seconds usecs/call calls errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> 93.18 0.028749 23 1243 munmap
> 6.45 0.001991 3 583 brk
> 0.37 0.000113 0 1244 mmap2
> ------ ----------- ----------- --------- --------- ----------------
> 100.00 0.030853 3070 total
>
>
> 'strace -v' a little later (sample)...
>
> mmap2(NULL, 847872, PROT_READ|
> 0) = 0xb5e2e000
> munmap(0xb5efd000, 847872) = 0
> mmap2(NULL, 847872, PROT_READ|
> 0) = 0xb5efd000
> munmap(0xb5e2e000, 847872) = 0
> mmap2(NULL, 847872, PROT_READ|
> 0) = 0xb5e2e000
> munmap(0xb5efd000, 847872) = 0
> mm...