php - NFS 从 Vagrant guest 挂起到 OSX

标签 php osx-mountain-lion vagrant

我有一个 Vagrant guest ,我正在使用它在本地运行 Symfony 2 应用程序以进行开发。一般来说,这工作正常,但是,我经常发现进程锁定在“D+”状态(等待 I/O)。

例如。我尝试运行我的单元测试:

./bin/phpunit -c app

任务启动,但之后永远不会退出。在进程列表中我看到:

vagrant 3279 0.5 4.9 378440 101132 pts/0 D+ 02:43 0:03 php ./bin/phpunit -c app

这个任务是杀不死的。我需要重新启动 Vagrant guest 来恢复它。这似乎主要发生在 PHP 命令行应用程序中(但它也是我执行的主要命令行任务,因此它可能不相关)。

系统日志报告一个挂起的任务:

Aug 20 03:04:40 precise64 kernel: [ 6240.210396] INFO: task php:3279 blocked for more than 120 seconds.
Aug 20 03:04:40 precise64 kernel: [ 6240.211920] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Aug 20 03:04:40 precise64 kernel: [ 6240.212843] php             D 0000000000000000     0  3279   3091 0x00000004
Aug 20 03:04:40 precise64 kernel: [ 6240.212846]  ffff88007aa13c98 0000000000000082 ffff88007aa13c38 ffffffff810830df
Aug 20 03:04:40 precise64 kernel: [ 6240.212849]  ffff88007aa13fd8 ffff88007aa13fd8 ffff88007aa13fd8 0000000000013780
Aug 20 03:04:40 precise64 kernel: [ 6240.212851]  ffff88007aa9c4d0 ffff880079e596f0 ffff88007aa13c78 ffff88007fc14040
Aug 20 03:04:40 precise64 kernel: [ 6240.212853] Call Trace:
Aug 20 03:04:40 precise64 kernel: [ 6240.212859]  [<ffffffff810830df>] ? queue_work+0x1f/0x30
Aug 20 03:04:40 precise64 kernel: [ 6240.212863]  [<ffffffff811170e0>] ? __lock_page+0x70/0x70
Aug 20 03:04:40 precise64 kernel: [ 6240.212866]  [<ffffffff8165a55f>] schedule+0x3f/0x60
Aug 20 03:04:40 precise64 kernel: [ 6240.212867]  [<ffffffff8165a60f>] io_schedule+0x8f/0xd0
Aug 20 03:04:40 precise64 kernel: [ 6240.212869]  [<ffffffff811170ee>] sleep_on_page+0xe/0x20
Aug 20 03:04:40 precise64 kernel: [ 6240.212871]  [<ffffffff8165ae2f>] __wait_on_bit+0x5f/0x90
Aug 20 03:04:40 precise64 kernel: [ 6240.212873]  [<ffffffff81117258>] wait_on_page_bit+0x78/0x80
Aug 20 03:04:40 precise64 kernel: [ 6240.212875]  [<ffffffff8108af00>] ? autoremove_wake_function+0x40/0x40
Aug 20 03:04:40 precise64 kernel: [ 6240.212877]  [<ffffffff8111736c>] filemap_fdatawait_range+0x10c/0x1a0
Aug 20 03:04:40 precise64 kernel: [ 6240.212882]  [<ffffffff81122a01>] ? do_writepages+0x21/0x40
Aug 20 03:04:40 precise64 kernel: [ 6240.212884]  [<ffffffff81118da8>] filemap_write_and_wait_range+0x68/0x80
Aug 20 03:04:40 precise64 kernel: [ 6240.212892]  [<ffffffffa01269fe>] nfs_file_fsync+0x5e/0x130 [nfs]
Aug 20 03:04:40 precise64 kernel: [ 6240.212896]  [<ffffffff811a632b>] vfs_fsync+0x2b/0x40
Aug 20 03:04:40 precise64 kernel: [ 6240.212900]  [<ffffffffa01272c3>] nfs_file_flush+0x53/0x80 [nfs]
Aug 20 03:04:40 precise64 kernel: [ 6240.212903]  [<ffffffff81175d6f>] filp_close+0x3f/0x90
Aug 20 03:04:40 precise64 kernel: [ 6240.212905]  [<ffffffff81175e72>] sys_close+0xb2/0x120
Aug 20 03:04:40 precise64 kernel: [ 6240.212907]  [<ffffffff81664a82>] system_call_fastpath+0x16/0x1b`

为了配置盒子,我使用以下方式共享本地文件夹:

config.vm.synced_folder "/my/local/path.dev", "/var/www", :nfs => true

Vagrant 在 OSX 主机上创建以下/etc/exports 文件:

# VAGRANT-BEGIN: c7d0c56a-a126-46f5-a293-605bf554bc9a
"/Users/djdrey-local/Sites/oddswop.dev" 192.168.33.101 -mapall=501:20
# VAGRANT-END: c7d0c56a-a126-46f5-a293-605bf554bc9a

Vagrant 客的 nfsstat 输出

Server rpc stats:
calls      badcalls   badclnt    badauth    xdrcall
0          0          0          0          0

Client rpc stats:
calls      retrans    authrefrsh
87751      0          87751

Client nfs v3:
null         getattr      setattr      lookup       access       readlink
0         0% 35018    39% 1110      1% 8756      9% 19086    21% 0         0%
read         write        create       mkdir        symlink      mknod
5100      5% 7059      8% 4603      5% 192       0% 0         0% 0         0%
remove       rmdir        rename       link         readdir      readdirplus
4962      5% 262       0% 313       0% 0         0% 0         0% 1056      1%
fsstat       fsinfo       pathconf     commit
1         0% 2         0% 1         0% 229       0%

我已经使用插件 vagrant-vbguest 确保 Guest Additions 在 guest 上是最新的

我不确定如何调试它。我很清楚这是 guest 和 Mac OSX 主机之间的 NFS 问题。如果我尝试使用 NFS 管理器在 OSX 上启动 NFS 的调试日志记录,我会在 OSX 中遇到内核错误。

有没有人遇到过类似的问题?任何关于前进方向的建议都将不胜感激 - 因为每天多次为客人提供动力循环是行不通的。

环境

  • 操作系统 10.8.4
  • Vagrant 1.2.7
  • Virtualbox 4.2.16
  • Vagrant guest 操作系统:Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-23-generic x86_64) [precise64.box]

最佳答案

我在共享 nfs 文件夹中运行 npm install 时遇到了类似的问题,随后发现禁用 nfs_udp 修复了挂起的问题:

 config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false

关于php - NFS 从 Vagrant guest 挂起到 OSX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18326463/

相关文章:

php - 如何根据类别中的匹配从数据库中进行选择?

xcode - 当缩进级别大于三时,为什么 Xcode 会停止绘制选项卡?

php - Yii2-SQLSTATE[42000] : Syntax error or access violation: 1064 on insert batch

php - 无法显示 PDO mysql 脚本中的数据,该脚本根据数据库结构自动生成表布局

nsnotificationcenter - Mountain Lion 上的同步 NSUserNotification 警报

ruby - 无法从 OSX 中的 Launch Agent 运行终端通知程序(Ruby 应用程序)。环境变量问题?

mysql - MariaDb 通过 Puppet 和 Vagrant

已分配 Vagrant + Hyper V IPV6 地址

php - Microsoft 推送通知服务 403 - 禁止 : Access is denied