[Libwebsockets] problems with big dynamic content

Per Bothner per at bothner.com
Sat Jun 23 00:24:27 CEST 2018


On 06/22/2018 02:48 PM, Andy Green wrote:
> 
> 
> On 06/22/2018 10:52 PM, Per Bothner wrote:
>> I tried this patch, which seems to work, though of course it's hard to
>> be definite with a problem like this.
>>
>> diff --git a/lib/plat/unix/unix-sockets.c b/lib/plat/unix/unix-sockets.c
>> index a4699016..98dfd509 100644
>> --- a/lib/plat/unix/unix-sockets.c
>> +++ b/lib/plat/unix/unix-sockets.c
>> @@ -73,7 +73,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
>>       defined(__HAIKU__)
>>       struct protoent *tcp_proto;
>>   #endif
>> -
>> +        fcntl(fd, F_SETFD, FD_CLOEXEC );
>>       if (vhost->ka_time) {
>>           /* enable keepalive on this socket */
>>           optval = 1;
>>
> 
> Looks like the right thing to me.  I pushed it on master and v3.0-stable, thanks.

Great!  It seems plausible to me that FD_CLOEXEC should be set on *every*
file descriptor that is "local" to the lws library.  For example the 'listen' socket.
Otherwise we might leak file descriptors.

Any suggestions for detecting and working around older versions?
I tried, based on a comment in libwebsockets.h:

#if LWS_LIBRARY_VERSION_NUMBER <= 2004002
     info.ka_time = 0;
#endif

However, that doesn't seem to make any difference, since the default is 0
anyway, as far as I can tell.
-- 
	--Per Bothner
per at bothner.com   http://per.bothner.com/



More information about the Libwebsockets mailing list