![](/img/trans.png)
[英]Apache unresponsive when using NFS on Windows with Vagrant
[英]NFS hang from Vagrant guest to OSX
我有一個Vagrant客戶,我正在使用它在本地運行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客戶,讓它再次恢復。 這似乎主要發生在PHP命令行應用程序中(但它也是我執行的主要命令行任務,因此它可能不相關)。
syslog報告掛起的任務:
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
流浪客人的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%
我確保使用插件:guestrant添加的訪客添加內容是最新的:vagrant-vbguest
我不知道如何調試這個。 我很清楚這是guest虛擬機和Mac OSX主機之間的NFS問題。 如果我使用NFS Manager在OSX上嘗試啟動NFS的調試日志記錄,我會在OSX中遇到內核恐慌。
有沒有其他人有類似的問題? 任何有關前進道路的建議都將受到贊賞 - 因為每天多次為客人提供電力循環是不可行的。
環境
在共享的nfs文件夾中運行npm install時遇到了類似的問題,隨后發現禁用nfs_udp修復了懸掛問題:
config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false
您沒有提供特定答案的具體配置(例如,導出文件,fstab文件,防火牆配置等)的足夠詳細信息。 以下是一些想法:
在fstab中嘗試將“hard,intr”標志添加到掛載選項 - 這使得可以在死掛載上終止等待I / O的進程。
還要確保您的防火牆已打開以進行rpc調用,並且rpc-statd服務正在運行。
還要弄清楚你正在運行的nfs版本以及打開了正確的TCP / UDP端口。 如果NFS v4無法運行,可以嘗試使用NFS v3。
最后,您是通過IP地址還是主機名連接? 主機名很棒,但請確保它始終正確解析 - 可能在/ etc / hosts文件中。 或者,硬編碼IP地址,這樣就不會出現名稱解析失敗的可能性......
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.