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
This commit is contained in:
Thierry FOURNIER
2016-07-14 11:42:37 +02:00
committed by Willy Tarreau
parent 8ab79420ba
commit ab00df6cf6
3 changed files with 22 additions and 3 deletions

View File

@@ -1460,6 +1460,11 @@ TXN class
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)