In 358166a ("BUG/MINOR: hlua_fcn: restore server pairs iterator pointer consistency"), I wrongly assumed that because the iterator was a temporary object, no specific cleanup was needed for the watcher. In fact watcher_detach() is not only relevant for the watcher itself, but especially for its parent list to remove the current watcher from it. As iterators are temporary objects, failing to remove their watchers from the server watcher list causes the server watcher list to be corrupted. On a normal iteration sequence, the last watcher_next() receives NULL as target so it successfully detaches the last watcher from the list. However the corner case here is with interrupted iterators: users are free to break away from the iteration loop when a specific condition is met for instance from the lua script, when this happens hlua_listable_servers_pairs_iterator() doesn't get a chance to detach the last iterator. Also, Lua doesn't tell us that the loop was interrupted, so to fix the issue we rely on the garbage collector to force a last detach right before the object is freed. To achieve that, watcher_detach() was slightly modified so that it becomes possible to call it without knowing if the watcher is already detached or not, if watcher_detach() is called on a detached watcher, the function does nothing. This way it saves the caller from having to track the watcher state and makes the API a little more convenient to use. This way we now systematically call watcher_detach() for server iterators right before they are garbage collected. This was first reported in GH #3055. It can be observed when the server list is browsed one than more time when it was already browsed from Lua for a given proxy and the iteration was interrupted before the end. As the watcher list is corrupted, the common symptom is watcher_attach() or watcher_next() not ending due to the internal mt_list call looping forever. Thanks to GH users @sabretus and @sabretus for their precious help. It should be backported everywhere 358166a was.
HAProxy
HAProxy is a free, very fast and reliable reverse-proxy offering high availability, load balancing, and proxying for TCP and HTTP-based applications.
Installation
The INSTALL file describes how to build HAProxy. A list of packages is also available on the wiki.
Getting help
The discourse and the mailing-list are available for questions or configuration assistance. You can also use the slack or IRC channel. Please don't use the issue tracker for these.
The issue tracker is only for bug reports or feature requests.
Documentation
The HAProxy documentation has been split into a number of different files for ease of use. It is available in text format as well as HTML. The wiki is also meant to replace the old architecture guide.
Please refer to the following files depending on what you're looking for:
- INSTALL for instructions on how to build and install HAProxy
- BRANCHES to understand the project's life cycle and what version to use
- LICENSE for the project's license
- CONTRIBUTING for the process to follow to submit contributions
The more detailed documentation is located into the doc/ directory:
- doc/intro.txt for a quick introduction on HAProxy
- doc/configuration.txt for the configuration's reference manual
- doc/lua.txt for the Lua's reference manual
- doc/SPOE.txt for how to use the SPOE engine
- doc/network-namespaces.txt for how to use network namespaces under Linux
- doc/management.txt for the management guide
- doc/regression-testing.txt for how to use the regression testing suite
- doc/peers.txt for the peers protocol reference
- doc/coding-style.txt for how to adopt HAProxy's coding style
- doc/internals for developer-specific documentation (not all up to date)
License
HAProxy is licensed under GPL 2 or any later version, the headers under LGPL 2.1. See the LICENSE file for a more detailed explanation.