Opened 6 years ago

Closed 6 years ago

#2055 closed defect (fixed)

Cannot register ioqueue key after double key unregistration

Reported by: nanang Owned by: bennylp
Priority: normal Milestone: release-2.7.1
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no


When there is double unregistration for the same ioqueue key, some ioqueue backends will eventually reject every ioqueue key registration with error code PJ_ETOOMANY and this is not recoverable. Sample log line:

Handshake failed in accepting a.b.c.d:n: Too many objects of the specified type (PJ_ETOOMANY)

PJ_ETOOMANY is returned by ioqueue key registration because the maximum key count (ioqueue->count) has a very high number (0xFFFFFFFF) which actually representing a negative value in a signed number (note that ioqueue->count is unsigned).

Alternative solutions

  1. It will be ideal if the ioqueue itself can detect and avoid double key unregistration, however as by default each key is recycled (reused after some period of unregistration), this solution may not be bullet proof.
  2. Another approach is to avoid double key unregistration in a bit higher level, e.g: active socket, this is good but still applications using ioqueue directly will not be protected.
  3. Check application for possible double key unregistration. For example in SSL socket, there was similar report documented in ticket #1930.

Thank you Peter Koletzki for the report.

Change History (1)

comment:1 Changed 6 years ago by nanang

  • Resolution set to fixed
  • Status changed from new to closed

In 5680:

Fix #2055:

  • Updated active socket to avoid double ioqueue key unregistration.
  • Updated ioqueue to avoid double ioq key unregistration (select & epoll only, winnt & uwp does not seem to be affected).
  • Added check for potential 'negative' ioqueue->count.
Note: See TracTickets for help on using tickets.