... | ... | @@ -494,8 +494,43 @@ def configure(cnf): |
|
|
|
|
|
### ------------------------------------------------------
|
|
|
### [MAL]
|
|
|
--------------------------------------------------------------------------
|
|
|
--------------------------------------------------------------------------
|
|
|
--------------------------------------------------------------------------
|
|
|
### Avoid ephemeral ports [MAL]
|
|
|
|
|
|
**Problem**
|
|
|
|
|
|
When you leave a client running for a while (say 20 minutes) without server available, you start getting errors:
|
|
|
```
|
|
|
Message=Malformed message received, missing frames.
|
|
|
```
|
|
|
|
|
|
Starting the server does not fix the situation, and gives this error:
|
|
|
```
|
|
|
Errno 48 : Address already in use
|
|
|
```
|
|
|
|
|
|
**Solution**
|
|
|
|
|
|
The solution is not to use ports from the ephemeral range. The port numbers in the ephemeral range can be found with `cat /proc/sys/net/ipv4/ip_local_port_range`. For DevEnv 3.x with CentOS 8 they are:
|
|
|
|
|
|
| Port Range | Usable for MAL |
|
|
|
| ---- | ---- |
|
|
|
| 1 -1023 | 🟠 No |
|
|
|
| 1024 - 32767 | 🟢 Yes |
|
|
|
| 32768 - 60999 | 🟠 No |
|
|
|
| 61000 - 65535 | 🟢 Yes |
|
|
|
|
|
|
With the implementation of ECII-402, the MAL library will write a warning log (and can also be configured to throw an exception) if an application runs a MAL instance on one of the ephemeral ports.
|
|
|
|
|
|
**Background**
|
|
|
|
|
|
(Explanation provided by M. Sekoranja)
|
|
|
|
|
|
After a while of (re-)connection attempts, the client will manage to connect... to itself! Because a client will never expect client's messages, errors of malformed messages are emitted.
|
|
|
|
|
|
This happens because TCP design allows for a 'simultaneous connect feature': if a client is trying to connect to local port and if the port is from the ephemeral range, it can occasionally connect to itself. The client thinks it is connected to a server, however it is actually connected to itself. Moreover, the server can not bind to its server port anymore.
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------
|
... | ... | |