[ECOS] Re: accept() FreeBSD hangs when out of resources

Tad ecos_removethispart@ds3switch.com
Tue Jun 12 03:57:00 GMT 2007


Andrew Lunn wrote:
> On Mon, Jun 11, 2007 at 03:42:07PM -0800, Tad wrote:
>   
>>>> accept() won't return and won't timeout (>12hrs) when listen() indicates 
>>>> a new connection, if out of sockets/file-descriptors and all TCP 
>>>> connections are in ESTABLISHED state.
>>>>         
>>> Where exactly is it blocked. Please could you provide a call stack.

It's possible that the block is somewhere such as this "FIXME" code that 
wasn't finished in sys/kern/sockio.c

   /*
348      * At this point we know that there is at least one connection
349      * ready to be accepted. Remove it from the queue prior to
350      * allocating the file descriptor for it since falloc() may
351      * block allowing another process to accept the connection
352      * instead.
353      */
354     so = TAILQ_FIRST(&head->so_comp);
355     TAILQ_REMOVE(&head->so_comp, so, so_list);
356     head->so_qlen--;
357
358 #if 0 // FIXME
359     fflag = lfp->f_flag;
360     error = falloc(p, &nfp, &fd);
361     if (error) {
362         /*
363          * Probably ran out of file descriptors. Put the
364          * unaccepted connection back onto the queue and
365          * do another wakeup so some other process might
366          * have a chance at it.
367          */
368         TAILQ_INSERT_HEAD(&head->so_comp, so, so_list);
369         head->so_qlen++;
370         wakeup_one(&head->so_timeo);
371         splx(s);
372         goto done;
373     }
374     fhold(nfp);
375     p->p_retval[0] = fd;
376
377     /* connection has been removed from the listen queue */
378     KNOTE(&head->so_rcv.sb_sel.si_note, 0);
379 #endif
380
381     so->so_state &= ~SS_COMP;
382     so->so_head = NULL;
383
384     cyg_selinit(&so->so_rcv.sb_sel);
385     cyg_selinit(&so->so_snd.sb_sel);
386    
387     new_fp->f_type      = DTYPE_SOCKET;

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list