Opened 9 years ago

Closed 8 years ago

#14 closed defect (fixed)

Number of *_buffers must be less then 17 on Solaris

Reported by: dsdiv.moikrug.ru Owned by: Maxim Dounin
Priority: minor Milestone:
Component: nginx-core Version: 1.0.x
Keywords: Solaris Cc:
uname -a: SunOS unknown 5.10 Generic_142910-17 i86pc i386 i86pc
nginx -V:

Description

At Solaris readv() return EINVAL, if iovcnt greater than IOV_MAX.

Change History (5)

comment:1 by Maxim Dounin, 9 years ago

Owner: changed from somebody to Maxim Dounin
Status: newassigned

Ack, readv() should be limited to IOV_MAX in the same way as writev() in current code. I'll take a look as time permits.

comment:2 by Jeremy Stashewsky, 9 years ago

I'm running into this on nginx 1.1.7;

Is it as simple as this or will this lead to a memory leak?

diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c
index b65a0d7..16399b8 100644
--- a/src/os/unix/ngx_readv_chain.c
+++ b/src/os/unix/ngx_readv_chain.c
@@ -214,7 +214,7 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
     rev = c->read;
 
     do {
-        n = readv(c->fd, (struct iovec *) vec.elts, vec.nelts);
+        n = readv(c->fd, (struct iovec *) vec.elts, vec.nelts > IOV_MAX ? IOV_MAX : vec.nelts);
 
         if (n == 0) {
             rev->ready = 0;

nginx -V

nginx: nginx version: nginx/1.1.7
nginx: built by gcc 3.4.3 (csl-sol210-3_4-20050802)
nginx: configure arguments: --with-ipv6 --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --without-http_ssi_module --without-http_auth_basic_module --without-http_autoindex_module --without-http_geo_module --without-http_fastcgi_module --without-http_uwsgi_module --without-http_scgi_module --without-http_memcached_module --without-http_empty_gif_module --without-http-cache --user=www --group=www --with-cc-opt='-g -O3 -m32' --with-ld-opt='-L/opt/local/lib -Wl,-R/opt/local/lib' --sbin-path=/opt/local/sbin --conf-path=/opt/local/etc/nginx/nginx.conf --pid-path=/var/db/nginx/nginx.pid --lock-path=/var/db/nginx/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/db/nginx/client_body_temp --http-proxy-temp-path=/var/db/nginx/proxy_temp --prefix=/opt/local

uname -a

SunOS redacted.joyent.us 5.11 snv_121 i86pc i386 i86pc Solaris

comment:3 by Maxim Dounin, 9 years ago

The patch isn't really correct, but as far as I see it should work without any major problems.

comment:4 by Maxim Dounin, 8 years ago

In [4598/nginx]:

(The changeset message doesn't reference this ticket)

comment:5 by Maxim Dounin, 8 years ago

Resolution: fixed
Status: assignedclosed

Fix committed.

Note: See TracTickets for help on using tickets.