This chapter documents some errors that can happen in LIXA environments.
If your Application Program starts many short transactions, you can exhaust the number of ephemeral ports that can be used to create TCP/IP connections.
A typicaly simptom is tx_open()
returning error
code -7.
To inspect it a little more, you can activate the tracing using
LIXA_TRACE_MASK=0x4000. Here is the typical error you can catch in the
trace:
2020-06-16 20:19:29.922380 [5786/139620897502976] client_connect/excp=2/ret_cod=-138/errno=99
where "ret_cod=-138" is associated to connect()
Linux function and "errno=99" means "EADDRNOTAVAIL".
The number of sockets in TIME_WAIT state can be checked with:
$ netstat -unta | grep TIME_WAIT | wc -l 14018
To workaround this issue, you can tell the Linux kernel to reuse sockets in TIME_WAIT state adding the following row
net.ipv4.tcp_tw_reuse=1
to file /etc/sysctl.conf
Telling the Linux kernel to reuse sockets in TIME_WAIT state is not without consequences: please read the related documentation and use it at your own risk.