crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 274 forks source link

Allow TCP user timeout configuration in endpoint #1930

Closed Bastian-Krause closed 2 years ago

Bastian-Krause commented 2 years ago

TCP_USER_TIMEOUT (see man tcp) is a socket option that causes TCP connections to be closed if transmitted data is not acked within the given time (in milliseconds). This allows failing fast instead of waiting for ACKs to arrive up to 20 min on dead connections.

A use case for this is an embedded device connecting to crossbar. If this is shut down forcibly, the connection hangs and subsequent procedure registrations fail until the connection is closed. This can take up to 20 minutes.

Fixes #1929

oberstet commented 2 years ago

this looks really good and complete!

oberstet commented 2 years ago

I guess the only problem the CI detects is wrong exports (all) ...

crossbar/common/twisted/sharedport.py:42:1: F822 undefined name 'SharedPort' in __all__
crossbar/common/twisted/sharedport.py:42:1: F822 undefined name 'SharedTLSPort' in __all__

as of

(cpy39_1) (base) oberstet@intel-nuci7:~/scm/crossbario/crossbar$ find . -name "*.py" -exec grep -Hi "SharedPort" {} \;
./crossbar/common/twisted/endpoint.py:from crossbar.common.twisted.sharedport import SharedPort, SharedTLSPort
./crossbar/common/twisted/endpoint.py:            listening_port = SharedPort(port, factory, backlog, interface, reactor, shared=shared)
./crossbar/common/twisted/sharedport.py:__all__ = ('create_stream_socket', 'SharedPort', 'SharedTLSPort')
./crossbar/common/twisted/sharedport.py:class SharedPort(tcp.Port):
./crossbar/common/twisted/sharedport.py:class SharedTLSPort(SharedPort, ssl.Port):
Bastian-Krause commented 2 years ago

this looks really good and complete!

Thanks, will look into this on Monday.

I guess the only problem the CI detects is wrong exports (all) ...

crossbar/common/twisted/sharedport.py:42:1: F822 undefined name 'SharedPort' in __all__
crossbar/common/twisted/sharedport.py:42:1: F822 undefined name 'SharedTLSPort' in __all__

as of

(cpy39_1) (base) oberstet@intel-nuci7:~/scm/crossbario/crossbar$ find . -name "*.py" -exec grep -Hi "SharedPort" {} \;
./crossbar/common/twisted/endpoint.py:from crossbar.common.twisted.sharedport import SharedPort, SharedTLSPort
./crossbar/common/twisted/endpoint.py:            listening_port = SharedPort(port, factory, backlog, interface, reactor, shared=shared)
./crossbar/common/twisted/sharedport.py:__all__ = ('create_stream_socket', 'SharedPort', 'SharedTLSPort')
./crossbar/common/twisted/sharedport.py:class SharedPort(tcp.Port):
./crossbar/common/twisted/sharedport.py:class SharedTLSPort(SharedPort, ssl.Port):

Ah right, fixed.

oberstet commented 2 years ago

I'll wait for the CAA and will merge then! thanks again for the great work.

rgd the failing yapf ... code formatting:

pip install "yapf==0.29.0"
make autoformat
Bastian-Krause commented 2 years ago

I've sent the CAAs (individual + entity). All remarks should be addressed now.

oberstet commented 2 years ago

@Bastian-Krause thanks for the CAA! got it. and thanks for your contribution - awesome=)