Bug?
Alejandro Martínez
lists at ruby-forum.com
Thu Sep 24 23:23:25 MSD 2009
i keep getting:
2009/09/24 18:21:09 [crit] 11956#0: *50 pwrite() has written only 266240
of 524288, client: 10.100.0.115, server: contentdata.spacash.com,
request: "POST /store.php HTTP/1.1", host: "10.100.0.155"
2009/09/24 18:22:19 [crit] 11956#0: *81 pwrite() has written only 225280
of 524288, client: 10.100.0.115, server: contentdata.spacash.com,
request: "POST /store.php HTTP/1.1", host: "10.100.0.155"
store.php just receives files via POST and then moves them to the final
location via move_uploaded_file()
I tracked the string "pwrite() has written only" within nginx's source
and got to:
src/os/unix/ngx_files.c where there is:
ssize_t
ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
{
ssize_t n;
ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0,
"write: %d, %p, %uz, %O", file->fd, buf, size,
offset);
#if (NGX_HAVE_PWRITE)
n = pwrite(file->fd, buf, size, offset);
if (n == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "pwrite()
failed");
return NGX_ERROR;
}
if ((size_t) n != size) {
ngx_log_error(NGX_LOG_CRIT, file->log, 0,
"pwrite() has written only %z of %uz", n, size);
return NGX_ERROR;
}
#else
if (file->sys_offset != offset) {
if (lseek(file->fd, offset, SEEK_SET) == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "lseek()
failed");
return NGX_ERROR;
}
file->sys_offset = offset;
}
n = write(file->fd, buf, size);
if (n == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "write()
failed");
return NGX_ERROR;
}
if ((size_t) n != size) {
ngx_log_error(NGX_LOG_CRIT, file->log, 0,
"write() has written only %z of %uz", n, size);
return NGX_ERROR;
}
file->sys_offset += n;
#endif
file->offset += n;
return n;
}
Googling for pwrite, i found out that pwrite just isn't to write all of
its data at once, so one has to put it into a loop.
So is this a bug or did i do something terribly wrong?
Thank you for your time.
Alejandro Martínez Lanfranco
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list