Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse SSH(FTP)和Web服务器并发文件IO_Eclipse_Apache_Concurrency_Ssh_Ftp - Fatal编程技术网

Eclipse SSH(FTP)和Web服务器并发文件IO

Eclipse SSH(FTP)和Web服务器并发文件IO,eclipse,apache,concurrency,ssh,ftp,Eclipse,Apache,Concurrency,Ssh,Ftp,我有一个Apache服务器 我对一个文件的并发读写操作有问题 假设我在ApacheDocRoot中有index.html文件。在浏览器中,我可以打开一个窗口来阅读它 我使用EclipseIDE通过SSH(或FTP)直接修改服务器上的文件。 在对文件做了一些修改之后,我将把它上传到服务器上。上传需要一些时间 问题是:若我试图在文件上传时在浏览器中查看文件,上传挂起,目标文件变为空白。看起来apache和SSH服务器都在尝试访问文件,SSH进行写入,apache进行读取。碰撞破坏了一切 有没有办法避

我有一个Apache服务器

我对一个文件的并发读写操作有问题

假设我在ApacheDocRoot中有
index.html
文件。在浏览器中,我可以打开一个窗口来阅读它

我使用EclipseIDE通过SSH(或FTP)直接修改服务器上的文件。 在对文件做了一些修改之后,我将把它上传到服务器上。上传需要一些时间

问题是:若我试图在文件上传时在浏览器中查看文件,上传挂起,目标文件变为空白。看起来apache和SSH服务器都在尝试访问文件,SSH进行写入,apache进行读取。碰撞破坏了一切


有没有办法避免这种情况?可能是一些SSH服务器配置选项或Apache模块?

您需要先锁定文件。你知道你使用什么操作系统和apache配置吗?它是你自己的系统吗

以下是apache服务器文档中的引用:

EnableMMAP Directive Description: Use memory-mapping to read files during delivery Syntax: EnableMMAP On|Off Default: EnableMMAP On Context: server config, virtual host, directory, .htaccess Override: FileInfo Status: Core Module: core This directive controls whether the httpd may use memory-mapping if it needs to read the contents of a file during delivery. By default, when the handling of a request requires access to the data within a file -- for example, when delivering a server-parsed file using mod_include -- Apache httpd memory-maps the file if the OS supports it. This memory-mapping sometimes yields a performance improvement. But in some environments, it is better to disable the memory-mapping to prevent operational problems: •On some multiprocessor systems, memory-mapping can reduce the performance of the httpd. •Deleting or truncating a file while httpd has it memory-mapped can cause httpd to crash with a segmentation fault. For server configurations that are vulnerable to these problems, you should disable memory-mapping of delivered files by specifying: EnableMMAP Off For NFS mounted files, this feature may be disabled explicitly for the offending files by specifying: EnableMMAP Off 启用映射指令 说明: 在传递期间使用内存映射读取文件 语法: 启用映射打开|关闭 违约: 启用映射到 背景: 服务器配置、虚拟主机、目录、.htaccess 覆盖: 文件信息 地位: 核心 模块: 核心 如果httpd在交付期间需要读取文件内容,则该指令控制httpd是否可以使用内存映射。默认情况下,当处理请求需要访问文件中的数据时(例如,当使用mod_include交付服务器解析的文件时),如果操作系统支持,Apache httpd内存将映射文件。 这种内存映射有时会提高性能。但在某些环境中,最好禁用内存映射以防止操作问题: •在某些多处理器系统上,内存映射会降低httpd的性能。 •在httpd映射内存时删除或截断文件可能导致httpd因分段错误而崩溃。 对于易受这些问题影响的服务器配置,应通过指定以下内容禁用已交付文件的内存映射: 启用映射关闭 对于NFS装载的文件,可以通过指定以下内容,对有问题的文件显式禁用此功能: 启用映射关闭 由于您的服务器正在崩溃,我怀疑您对文件所在的目录设置了此选项

添加 允许映射关闭


下载到目录的.htaccess文件。

如何使用与原始文件稍有不同的名称上载替换文件,并在上载完成后,删除旧文件并将上载重命名为原始名称?你可以为此设置一个脚本……实际上,Eclispe可以这样做(我使用Aptana2)。它复制名为
tmp\u upload.
的新文件,并在复制完成后重新打印实际文件。在服务器端替换文件和并发Apache文件访问时,问题仍然存在。听起来像个bug。您是否尝试过创建符号链接,这是一个奇怪的解决方案,但可能会奏效。您需要先锁定文件。您知道您使用的是什么操作系统和apache配置吗?它是您自己的系统吗?如果它是您的服务器,那么设置一个适合操作系统的文件锁定机制。 AllowMMAP Off