Opened 9 years ago
Closed 9 years ago
#910 closed defect (fixed)
CreateFile() "E:/tmp/0000000001" failed (80: The file exists)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.8.x |
Keywords: | client_body_in_file_only, CreateFile, 80 | Cc: | |
uname -a: |
OS Microsoft Windows Server 2012 Standard
Version 6.2.9200 build 9200 |
||
nginx -V: |
nginx version: nginx/1.9.12
built by cl 16.00.30319.01 for 80x86 built with OpenSSL 1.0.2f 28 Jan 2016 TLS SNI support enabled configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-pat h=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=t emp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt =-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-8.38 --with-zlib=objs.msvc8/lib/zlib-1.2.8 --with-select_module --with-http_realip_module --with -http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module -- with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_modu le --with-http_slice_module --with-mail --with-stream --with-openssl=objs.msvc8/lib/openssl-1.0.2f --with-openssl-opt=no-asm --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-ipv6 |
Description
I am using nginx as a file upload handler.
The first time I run the server everything is fine,
I upload several files and nginx create some temporary files in the folder I set in the directive 'client_body_temp_path'.
The problem arise when I 'restart' the server.
If I try to upload a file it will fail with the following error:
'CreateFile() "E:/tmp/0000000001" failed (80: The file exists)'
So I should delete all the temporary files before restarting the server to avoid this problem.
On Linux however nginx looks smart enough and if a file with that sequence already exists he will create the file with a new random number much higher and will start from it.
This is the configuration for the handler
server { listen 8180; server_name ''; root E:/tmp; location / { deny all; } location /upload { auth_basic "Restricted Upload"; auth_basic_user_file .htpasswd.upload; add_header Pragma no-cache; add_header X-Content-Type-Options nosniff; limit_except POST { deny all; } client_body_temp_path E:/tmp/; client_body_in_file_only on; client_body_buffer_size 1024K; client_max_body_size 4000M; proxy_pass_request_headers on; proxy_set_header X-FILE $request_body_file; proxy_set_body off; proxy_redirect off; # do NOT use domain name in the proxy_pass directive only IP! #proxy_pass $scheme://$host/ws/fileupload$is_args$args; proxy_pass $scheme://$host/Common/TemporaryFile/fastupload.action$is_args$args; } }
Please try the following patch: