arpa2 / tlspool

TLS daemon with PKCS #11 backend
Other
6 stars 7 forks source link

Stop continuous looping during closedown (POSIX) #127

Open vanrein opened 5 years ago

vanrein commented 5 years ago

The POSIX system has inherited a Windows-compliance patch that is impacting its proper function. This should be reverted, even if only on POSIX.

To reproduce on Linux, start a chatsrv in the background and a chatcli in the foreground. Talk a bit and press ^D. This starts an inifinite loop that ends abruptly when chatsrv is brought to the foreground, constantly printing these lines:

TLS Pool[46086]: already done local shutdown
TLS Pool[46086]: inout [0].revents 0x0010
TLS Pool[46086]: inout [1].revents 0x0000

This is bad: The TLS Pool is drawing CPU because a client program does not respond (is misbehaving). In this case, it is probably suspended due to backgrounding, or waiting to read from the console. Anyway, the TLS Pool should not wait for the client program to shutdown its half but instead stop looping, or stop watching revents or somehow other reduce this load.

The load is observable as a running fan, so it is not subtle. The Windows patch that causes it is probably the one that silenced the fan on Windows, so this may be a POSIX incompatibility (of either platform!) caused by the fuzzy "definition" of POSIX in this point.

vanrein commented 5 years ago

Wil jij hier (eerst) eens naar kijken, Henri?

hfmanson commented 5 years ago

fixed by using select instead of poll