在chroot中执行服务(openoffice headless)很慢

时间:2010-05-27 15:02:40

标签: linux system call chroot strace

我创建了一个ubuntu chroot环境(使用debootstrap)并启动openoffice作为服务来使用unoconv转换文件。它可以工作,但它花费大约20秒进行chroot监狱外1s以下的转换。对它进行支持我可以看到,这些额外的时间花费在一些超时到期的套接字操作中,相同的操作在没有chroot环境的情况下运行良好。但是,类似的操作也可以。

有什么建议吗?


启动服务器(chrooted):

soffice -invisible -headless -nologo -nodefault "-accept=socket,host=localhost,port=8301;urp;StarOffice.ComponentContext" -env:UserInstallation=ootest2

调用它(chrooted):

strace unoconv -f pdf -p 8300 simple_test.docx

超时追踪:

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "M#\1\0\0\1\0\0\0\0\0\0\tlocalhost\6(none)\10mo"..., 47, MSG_NOSIGNAL, NULL, 0) = 47
poll([{fd=4, events=POLLIN}], 1, 5000)  = 0 (Timeout)
close(4)                                = 0

类似的跟踪没有超时(相同的unoconv操作):

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "M#\1\0\0\1\0\0\0\0\0\0\tlocalhost\6(none)\10mo"..., 47, MSG_NOSIGNAL, NULL, 0) = 47
poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])
ioctl(4, FIONREAD, [47])                = 0
recvfrom(4, "M#\201\202\0\1\0\0\0\0\0\0\tlocalhost\6(none)\10mo"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 47
close(4)                                = 0

chroot详细信息:

  • 使用dchroot将其用作普通用户
  • 将dev,proc等安装为(fstab):

    / tmp / var / local / chrootest / tmp
    / dev / var / local / chrootest / dev
    / sys / var / local / chrootest / sys
    proc-chroot / var / local / chrootest / proc
    devpts-chroot / var / local / chrootest / dev / pts

1 个答案:

答案 0 :(得分:3)

unoconv做了一些wack DNS查找。我把它添加到我的/ etc / hosts:

127.0.0.1 localhost localhost.(none)

它使事情变得更好。