-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twoskip does a full munmap/mmap for every transaction in foreach #5
Comments
brong
added a commit
that referenced
this issue
Jul 15, 2016
brong
added a commit
that referenced
this issue
Jul 15, 2016
Fixed in 2.5 and master |
This was referenced Dec 13, 2016
Closed
Closed
This was referenced Dec 13, 2016
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discovered by Variomedia AG when they upgraded to 2.5.8 from 2.4 series and used twoskip as the default mailboxes.db.
You can trivially see this on Linux as well with an strace:
brong@wot:
/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/skiplist.db skiplist set a a/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/skiplist.db skiplist set b bbrong@wot:
brong@wot:
/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/skiplist.db skiplist set c c/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/twoskip.db twoskip set a abrong@wot:
brong@wot:
/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/twoskip.db twoskip set b b/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/twoskip.db twoskip set c cbrong@wot:
brong@wot:
/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/skiplist.db skiplist show/src/cyrus-imapd$ /usr/cyrus/bin/cyr_dbtool -n /tmp/twoskip.db twoskip showa a
b b
c c
brong@wot:
a a
b b
c c
Here's the interesting bit of the skiplist show under strace:
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 5, 0) = 0x7f37c1856000
sendto(3, "<182>Jul 15 22:54:20 025212C1/cy"..., 123, MSG_NOSIGNAL, NULL, 0) = 123
fcntl(5, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fcntl(5, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(5, {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
stat("/tmp/skiplist.db", {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
fcntl(5, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
writev(1, [{"a", 1}, {"\t", 1}, {"a", 1}, {"\n", 1}], 4a a
) = 4
fcntl(5, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(5, {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
stat("/tmp/skiplist.db", {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
fcntl(5, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
writev(1, [{"b", 1}, {"\t", 1}, {"b", 1}, {"\n", 1}], 4b b
) = 4
fcntl(5, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(5, {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
stat("/tmp/skiplist.db", {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
fcntl(5, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
writev(1, [{"c", 1}, {"\t", 1}, {"c", 1}, {"\n", 1}], 4c c
) = 4
fcntl(5, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(5, {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
stat("/tmp/skiplist.db", {st_mode=S_IFREG|0600, st_size=232, ...}) = 0
fcntl(5, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
munmap(0x7f37c1856000, 16384) = 0
And the interesting bit of the twoskip show under strace:
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 4, 0) = 0x7f1389e5f000
fcntl(4, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
stat("/tmp/twoskip.db", {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
munmap(0x7f1389e5f000, 16384) = 0
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 4, 0) = 0x7f1389e5f000
fcntl(4, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fcntl(4, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
stat("/tmp/twoskip.db", {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
munmap(0x7f1389e5f000, 16384) = 0
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 4, 0) = 0x7f1389e5f000
fcntl(4, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
writev(1, [{"a", 1}, {"\t", 1}, {"a", 1}, {"\n", 1}], 4a a
) = 4
fcntl(4, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
stat("/tmp/twoskip.db", {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
munmap(0x7f1389e5f000, 16384) = 0
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 4, 0) = 0x7f1389e5f000
fcntl(4, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
writev(1, [{"b", 1}, {"\t", 1}, {"b", 1}, {"\n", 1}], 4b b
) = 4
fcntl(4, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
stat("/tmp/twoskip.db", {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
munmap(0x7f1389e5f000, 16384) = 0
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 4, 0) = 0x7f1389e5f000
fcntl(4, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
writev(1, [{"c", 1}, {"\t", 1}, {"c", 1}, {"\n", 1}], 4c c
) = 4
fcntl(4, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
stat("/tmp/twoskip.db", {st_mode=S_IFREG|0600, st_size=536, ...}) = 0
munmap(0x7f1389e5f000, 16384) = 0
mmap(NULL, 16384, PROT_READ, MAP_SHARED, 4, 0) = 0x7f1389e5f000
fcntl(4, F_SETLKW, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
close(4) = 0
munmap(0x7f1389e5f000, 16384) = 0
....
The fix will be to make lib/mappedfile.c less agressive about re-mmaping.
The text was updated successfully, but these errors were encountered: