Feature #2171


Solaris event-ports support

Added by mm almost 11 years ago. Updated over 9 years ago.

Target version:


This is a reworked 2-year-old patch of #1147 with only little modifications, diffed against lighttpd 1.4.26.

Solaris Event Ports are currently the best polling mechansim on Solaris 10 and OpenSolaris.

Configuration file:
server.event-handler = "solaris-eventports"

You may change the event handler name to "solaris-port" as in the original patch (but this one is more declarative).

The patch works on my Solaris 10 systems under high load and in comparsion to solaris-devpoll does not eat up a whole CPU core.

If you consider adding this patch to the core, please close issue #1147

Martin Matuska.


solaris-eventports-1.4.26.diff (16.2 KB) solaris-eventports-1.4.26.diff Event Ports support for 1.4.26 mm, 2010-03-10 00:31
solaris-eventports-1.4.26.diff (16.7 KB) solaris-eventports-1.4.26.diff Updated Event Ports patch for 1.4.26 mm, 2010-03-10 14:54
solaris-eventports.patch (10.6 KB) solaris-eventports.patch mm, 2011-03-13 19:46
fdevent-add-solaris-eventports.patch (9.9 KB) fdevent-add-solaris-eventports.patch stbuehler, 2011-06-13 14:35

Related issues

Related to Feature #1147: Solaris Event PortsFixedActions

Updated by mm almost 11 years ago

Running on a busy server (single process) with 4000+ connections, 3000+ requests/sec, 200+Mbit/s traffic.
Server load with poll module: 0.7, with event ports: 0.5 (~50% of one core)


Updated by mm almost 11 years ago

From client's perspective connections are handled properly and data is delivered properly.

But when connections are closed, the following appears in the error log:
2010-03-10 11:06:22: (connections.c.1216) connection closed: poll() -> ERR [number]

We can do this in connections.c:

diff -Naur ../lighttpd-1.4.26.orig/src/connections.c ./src/connections.c
--- ../lighttpd-1.4.26.orig/src/connections.c   2010-03-10 11:18:02.173041427 +0100
+++ ./src/connections.c 2010-03-10 11:19:24.161434445 +0100
@@ -1212,7 +1212,7 @@

                } else if (revents & FDEVENT_ERR) {
+#if !defined(USE_LINUX_SIGIO) && !defined(USE_SOLARIS_PORT)
                        log_error_write(srv, __FILE__, __LINE__, "sd",
                                        "connection closed: poll() -> ERR", con->fd);

Updated by mm almost 11 years ago

  • Status changed from New to Patch Pending

Updated by nitrox almost 11 years ago

  • Missing in 1.5.x changed from No to Yes

Updated by stbuehler almost 11 years ago

  • Target version changed from 1.4.27 to 1.4.x

Updated by stbuehler over 10 years ago

  • Status changed from Patch Pending to Missing Feedback
  • Target version deleted (1.4.x)

I just committed the libev fdevent handler; that should include support for solaris-eventports too.

If you'd still like a native solaris-port handler, please update your patch to:
  • use log* functions (see other backends) instead of fprintf
  • don't include the diffs for generated files like:, configure,

Just reopen the bug in that case, thx.


Updated by mm almost 10 years ago

I have updated the native eventports patch following your instructions and running it successfully on Solaris 10, OpenSolaris and Nexenta Core.


Updated by Olaf-van-der-Spek almost 10 years ago

What's the advantage over using libev?


Updated by stbuehler over 9 years ago

what is the && defined(__sun) needed for?


Updated by mm over 9 years ago

That is probably remains from the old patch, I don't think it is necessary.


Updated by stbuehler over 9 years ago

Ok, next question: why call port_getn twice?


Updated by stbuehler over 9 years ago

stbuehler wrote:

Ok, next question: why call port_getn twice?

Hm, i think i get that now.

But i don't like the handling of ETIME, according to the man page

     ETIME     The time  interval  expired  before  the  expected
               number  of  events  have  been  posted to the port
               (original value in nget), or nget is updated  with
               the  number of returned port_event_t structures in

This doesn't sound like one could rely on nget, or you should at least compare it to the value you provided, and only proceed when they are different.


Updated by stbuehler over 9 years ago

Here the patch i would use; as opensolaris is a pain in the ass i didn't manage to test it.


Updated by mm over 9 years ago

Hi, to compile, the patch is missing a int declaration:
for (i = 0; i < available_events; ++i) {
solaris_port_events = 0;
should be:
for (i = 0; i < available_events; ++i) {
int solaris_port_events = 0;

Second, it doesn't work (lighttpd doesn't server a single file). The previous patch works.

I can do one or more of these things:
a) help you debug this
b) provide you access to a machine with a working build environment
c) provide you with a virtualbox appliance with a working build environment

Thank you for looking at this,
Martin Matuska


Updated by stbuehler over 9 years ago

solaris_ports_events = 0; can be removed (the var isn't needed, the flags are read from user_data). wait_for_events should perhaps be initialized to 0.

Apart from that it should work (as long as it compiles).

If it doesn't, well... i guess for all 3 options it would be helpful if you could join #lighttpd@freenode

Whether it works or not, i'm especially interested in compiler warnings :)


Updated by stbuehler over 9 years ago

  • Status changed from Reopened to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2796.

Also available in: Atom