crossbario / crossbar

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

Document Web transport client timeout #974

Open oberstet opened 7 years ago

oberstet commented 7 years ago

Browsers, when fetching regular Web stuff via HTTP from Crossbar.io's Web support (which comes from Twisted) may keep alive HTTP connections (set HTTP keep alive header).

Twisted Web will timeout such connections which stay idle for some time, leaving log messages like the following the Crossbar.io's log:

2017-02-27T13:00:44-0800 [Router      73410] Timing out client: IPv4Address(TCP, '127.0.0.1', 62216

Effectively, these come from here:

/twisted/web/http.py:        log.msg("Timing out client: %s" % str(self.transport.getPeer()))

What we do want in Crossbar.io is knobs to configure the timeout period (similar to the knobs we have for WebSocket). We probably also want to allow control the log level.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/42504737-configurable-timeout-for-web-connections?utm_campaign=plugin&utm_content=tracker%2F462544&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F462544&utm_medium=issues&utm_source=github).
oberstet commented 7 years ago

This affects transports of type web and unisocket, not websocket. It also affects the HTTP bridge.

oberstet commented 7 years ago

We are using twisted.web.server.Site (see here).

The log message comes from Twisted Web HTTPChannel from here

edsuom commented 5 years ago

This may not be the cleanest solution, but I thought I'd offer it here since this ticket comes up at the top of list in my search of the issue. Put this code right after your initial import of http from twisted.web:

# Make twisted.web STFU about timing out clients                                                                                                                                                            
from twisted.logger import Logger
class SensibleLogger(Logger):
    def info(self, *args, **kw):
        if args and args[0].startswith("Timing out"):
            # Nah, we don't need to hear about this                                                                                                                                                         
            return
        return Logger.info(self, *args, **kw)
http.HTTPChannel._log = SensibleLogger()
oberstet commented 5 years ago

@edsuom thanks for chiming in and your code snippet! in fact, that made me look again/deeper, and what I overlooked is @meejah s merged PR https://github.com/crossbario/crossbar/pull/1060/files - which actually already fixed this;)

there is a new configuration option client_timeout on Web transports, and the log noise has been confined to log level debug.

consequently, I'll rename this issue to documentation. do we have all Web transport options documented?

https://github.com/crossbario/crossbar/blob/43871e79cae72af92a83b701e367e1641f00343d/crossbar/common/checkconfig.py#L1737


OT, I looked at your blog. I often do that getting to know new people, being a curious person. quite interesting personal story! like in http://edsuom.com/ade.html where I figure 2 stories converge;) well, also cool software, OSS, patents and pictures. what really made me laugh is: "candid observer of naked emperors"=) sharp. anyways, nice to meet you!