BUG/MEDIUM: lua: the function txn_done() from sample fetches can crash
The function txn_done() ends a transaction. It does not make
sense to call this function from a lua sample-fetch wrapper,
because the role of a sample-fetch is not to terminate a
transaction.
This patch modify the role of the fucntion txn_done() if it
is called from a sample-fetch wrapper, now it just ends the
execution of the Lua code like the done() function.
Must be backported in 1.6
diff --git a/doc/lua-api/index.rst b/doc/lua-api/index.rst
index 2bca4d0..dccf415 100644
--- a/doc/lua-api/index.rst
+++ b/doc/lua-api/index.rst
@@ -1460,6 +1460,11 @@
session. It can be used when a critical error is detected or to terminate
processing after some data have been returned to the client (eg: a redirect).
+ *Warning*: It not make sense to call this function from sample-fetches. In
+ this case the behaviour of this one is the same than core.done(): it quit
+ the Lua execution. The transaction is really aborted only from an action
+ registered function.
+
:param class_txn txn: The class txn object containing the data.
.. js:function:: TXN.set_loglevel(txn, loglevel)