Nginx 如何修复';向客户端发送响应时失败(22:无效参数)';

Nginx 如何修复';向客户端发送响应时失败(22:无效参数)';,nginx,Nginx,使用directio时,如果有多个扇区大小不同的装入点,Nginx无法读取文件 我们的服务器将不同的硬盘安装在Nginx的根文件夹下。所有旧磁盘的扇区大小都是512,当我们更换磁盘时,Nginx突然无法从该磁盘读取文件 服务器上似乎没有什么问题,我们可以毫无问题地列出/读取文件,但Nginx不能。在错误日志中向客户端发送响应时显示失败(22:无效参数) [crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) whil

使用directio时,如果有多个扇区大小不同的装入点,Nginx无法读取文件

我们的服务器将不同的硬盘安装在Nginx的根文件夹下。所有旧磁盘的扇区大小都是512,当我们更换磁盘时,Nginx突然无法从该磁盘读取文件

服务器上似乎没有什么问题,我们可以毫无问题地列出/读取文件,但Nginx不能。在错误日志中向客户端发送响应时显示失败(22:无效参数)

[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
[crit] pread() "/str/.../dsf13at.mp4" failed (22: Invalid argument) while sending response to client
硬盘信息

带512的硬盘驱动器

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
带有4096的新硬盘驱动器

Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

问题是Nginx使用512的directio_对齐,但当硬盘驱动器的扇区大小为4096时,这似乎不起作用

将directio_alignment设置为4k解决了这个问题,Nginx现在可以读取512和4096扇区的驱动器

Nginx配置:

aio threads;
aio_write on;
directio 8M;
directio_alignment 4k;

这些
aio
选项的配置是什么?当我重新启动nginx时,它会抱怨,
此处不允许aio
@adriant所有这些选项都进入一个位置block@stjernstrom . 仍然得到相同的错误…@krishna如果你使用open\u file\u缓存,你可以尝试关闭它,也许是helps@stjernstrom,不,我根本没有使用open_file_缓存。。。。