Gilchrist Dadaglo
d00ce06d9d
BUG/MEDIUM: contrib/spoa-server: Fix ipv4_address used instead of ipv6_address
...
Typo leads to checking the wrong object for memory issues
This patch must be backported as far as 2.0.
2020-09-01 18:28:40 +02:00
Gilchrist Dadaglo
2417ebcc01
BUG/MINOR: contrib/spoa-server: Updating references to free in case of failure
...
When we encounter a failure, all previously borrowed references should
be freed. Especially if the program is not failing immediately
This patch must be backported as far as 2.0.
2020-09-01 18:28:40 +02:00
Gilchrist Dadaglo
c7d303a0a8
BUG/MINOR: contrib/spoa-server: Do not free reference to NULL
...
As per https://docs.python.org/3/c-api/refcounting.html , Py_DECREF
should not be called on NULL objects.
This patch must be backported as far as 2.0.
2020-09-01 18:28:40 +02:00
Gilchrist Dadaglo
9f0c984cf5
BUG/MINOR: contrib/spoa-server: Ensure ip address references are freed
...
IP addresses references passed in argument for ps_python are not freed after
they have been used. Leading to a small chance of mem leak if a lot of ip
addresses are passed around
This patch must be backported as far as 2.0.
2020-09-01 18:28:21 +02:00
Gilchrist Dadaglo
222f060be3
BUG/MAJOR: contrib/spoa-server: Fix unhandled python call leading to memory leak
...
The result from spoa evaluation of the user provided python code is
never passed back to the main spoa process nor freed.
Same for the keyword list passed.
This results into the elements never freed by Python as reference count
never goes down.
https://docs.python.org/3/extending/extending.html#reference-counting-in-python
This patch must be backported as far as 2.0.
2020-09-01 18:28:16 +02:00
Bertrand Jacquin
ae2132cffb
MINOR: contrib/spoa-server: allow MAX_FRAME_SIZE override
...
MAX_FRAME_SIZE is forced to the default value of tune.bufsize, however
they don't necessarily have to be tight together.
2020-09-01 18:25:04 +02:00
William Dauchy
4896d279aa
DOC: spoa-server: fix false friends actually
...
it seems like `actually` was wrongly used instead of `currently`
Signed-off-by: William Dauchy <w.dauchy@criteo.com>
2020-08-05 22:12:54 +02:00
William Dauchy
bbe18ac5df
BUG/MINOR: spoa-server: fix size_t format printing
...
From https://www.python.org/dev/peps/pep-0353/
"A new type Py_ssize_t is introduced, which has the same size as the
compiler's size_t type, but is signed. It will be a typedef for ssize_t
where available."
For integer types, causes printf to expect a size_t-sized integer
argument.
This should fix github issue #702
This should be backported to >= v2.2
Signed-off-by: William Dauchy <w.dauchy@criteo.com>
2020-08-05 22:12:47 +02:00
Bertrand Jacquin
54f7823ed5
BUG/MEDIUM: contrib/spoa: do not register python3.8 if --embed fail
...
spoa server fails to build when python3.8 is not available. If
python3-config --embed fails, the output of the command is registered in
check_python_config. However when it's later used to define
PYTHON_DEFAULT_INC and PYTHON_DEFAULT_LIB it's content does not match
and fallback to python2.7
Content of check_python_config when building with python3.6:
Usage: bin/python3-config --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir python3
As we are only looking for return code, this commit ensure we always
ignore the output of python3-config or hash commands.
2020-05-26 16:16:19 +02:00
Gilchrist Dadaglo
3e235d38ec
MAJOR: contrib: porting spoa_server to support python3
...
Background:
Python 2 is no longer supported since January, 1st 2020 as per
https://www.python.org/doc/sunset-python-2/
The purpose of this change is to make the spoa_server contrib library
compatible with Python 3 to allow transition to Python 3.
Test Settings:
ps_python.py:
...
spoa.set_var_null("null", spoa.scope_txn)
spoa.set_var_boolean("boolean", spoa.scope_txn, True)
spoa.set_var_int32("int32", spoa.scope_txn, 1234)
spoa.set_var_uint32("uint32", spoa.scope_txn, 1234)
spoa.set_var_int64("int64", spoa.scope_txn, 1234)
spoa.set_var_uint64("uint64", spoa.scope_txn, 1234)
spoa.set_var_ipv4("ipv4", spoa.scope_txn, ipaddress.IPv4Address(u"127.0.0.1"))
spoa.set_var_ipv6("ipv6", spoa.scope_txn, ipaddress.IPv6Address(u"1::f"))
spoa.set_var_str("str", spoa.scope_txn, "1::f")
spoa.set_var_bin("bin", spoa.scope_txn, "1:\x01:\x42f\x63\x63")
spoa.set_var_str("python_version", spoa.scope_sess, str(sys.version_info))
...
haproxy.cfg:
...
http-request capture var(txn.verb.null),debug len 1
http-request capture var(txn.verb.boolean),debug len 1
http-request capture var(txn.verb.int32),debug len 4
http-request capture var(txn.verb.uint32),debug len 4
http-request capture var(txn.verb.int64),debug len 4
http-request capture var(txn.verb.uint64),debug len 4
http-request capture var(txn.verb.ipv4),debug len 16
http-request capture var(txn.verb.ipv6),debug len 45
http-request capture var(txn.verb.str),debug len 32
http-request capture var(txn.verb.bin),debug len 32
http-request capture var(sess.verb.python_version),debug len 100
...
Test result:
Python 3.8:
ft_public ft_public/<NOSRV> 0/-1/-1/-1/0 403 212 - - PR-- 1/1/0/0/0 0/0 {|1|1234|1234|1234|1234|127.0.0.1|1::f|1::f|1:#01:Bfcc|sys.version_info(major=3, minor=8, micro=1, releaselevel='final', serial=0)} "POST / HTTP/1.1"
Python 3.7:
ft_public ft_public/<NOSRV> 0/-1/-1/-1/0 403 212 - - PR-- 1/1/0/0/0 0/0 {|1|1234|1234|1234|1234|127.0.0.1|1::f|1::f|1:#01:Bfcc|sys.version_info(major=3, minor=7, micro=6, releaselevel='final', serial=0)} "POST / HTTP/1.1"
Python 3.6:
ft_public ft_public/<NOSRV> 0/-1/-1/-1/0 403 212 - - PR-- 1/1/0/0/0 0/0 {|1|1234|1234|1234|1234|127.0.0.1|1::f|1::f|1:#01:Bfcc|sys.version_info(major=3, minor=6, micro=10, releaselevel='final', serial=0)} "POST / HTTP/1.1"
Python 2.7:
ft_public ft_public/<NOSRV> 0/-1/-1/-1/0 403 212 - - PR-- 1/1/0/0/0 0/0 {|1|1234|1234|1234|1234|127.0.0.1|1::f|1::f|1:#01:Bfcc|sys.version_info(major=2, minor=7, micro=17, releaselevel='final', serial=0)} "POST / HTTP/1.1"
Not tested:
Python <2.7
2020-05-11 10:52:55 +02:00
Ilya Shipitsin
ce7b00f926
CLEANUP: assorted typo fixes in the code and comments
...
This is fifth iteration of typo fixes
2020-03-31 17:09:35 +02:00
Ilya Shipitsin
1fae8db7b7
DOC: assorted typo fixes in the documentation
...
This is the fourth round of cleanups in various docs
2020-03-18 11:34:33 +01:00
Aleksandar Lazic
a71447539d
DOC: contrib: spoa_server Add some hints for building spoa_server
2019-07-05 16:31:50 +02:00
Daniel Corbett
c802921721
DOC/MINOR: contrib/spoa_server: Fix typo in README
...
Fix typo in README ps_pyhton.py -> ps_python.py
2019-06-11 19:27:42 +02:00
Daniel Corbett
061766859c
MINOR: contrib/spoa_server: Add random IP score
...
The example configuration uses sess.ip_score however this variable
is not referenced within the example scripts. This patch adds support
for sess.ip_score to the python + lua scripts and generates a
random number between 1 and 100.
2019-06-11 19:27:42 +02:00
Daniel Corbett
4e0fa55dcd
BUG/MEDIUM: contrib/spoa_server: Set FIN flag on agent frames
...
When communicating over SPOP the AGENT-HELLO, AGENT-DISCONNECT,
and ACK frames must have the FIN flag set.
2019-06-11 19:27:41 +02:00
Daniel Corbett
5897867ac5
MINOR: contrib/spoa_server: Upgrade SPOP to 2.0
...
Upgrade SPOP version to 2.0
2019-06-11 19:27:41 +02:00
Thierry FOURNIER
4d7bfa1cd1
MINOR/DOC: spoe-server: Add documentation
...
This is the documentation and examples.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
00a0225636
MINOR: spoa-server: Add python
...
This commit adds the Python support for the server.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
6908c95804
MINOR: spoa-server: Add Lua processing
...
Use the defined binding for registering Lua engine.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
a09df3f5d0
MINOR: spoa-server: Execute registered callbacks
...
Call the right function with the right engine for each received message.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
fbd3824868
MINOR: spoa-server: Prepare responses
...
This patch adds SPOP responses managament. It provides SPOP
encoding primitives. It also move the example function
ip_reputation to this new behavior.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
8b9a73bac0
MINOR: spoa-server: Load files
...
Declare files to be executed at the begining and execute it. The binding
between the engine and the file is done throught the extension.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
892f6647c1
MINOR: spoa-server: Allow registering message processors
...
This function register processor executed by any language for processing
an SPOP message.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
64eaa33214
MINOR: spoa-server: Allow registering external processes
...
Add struct for declaring an reistrering external processing resource.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
786e9e684b
MINOR: spoa-server: With debug mode, start only one process
...
Because debug with processes is simpler if only one process is started.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
7de6fc6ae1
MINOR: spoa-server: Replace the thread init system by processes
...
I will replace thread by processes. Note that, I keep the pthread_key
system for identifiying process in the same way that threads. Note
also that I keep commented out the original thread code because I hope
to reactivate it.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
5301ed1589
MINOR: spoe-server: rename "worker" functions
...
"worker" name is a little bit generic and it is used in many
places, so it is hard to find the expected symbol.
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
880d7e15ba
MINOR: spoa-server: Externalise debug functions
...
Make external LOG and DEBUG function. Other process can use this ones
and later these functions will be replaced by another log system
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
4aec0a4a9a
MINOR: spoa-server: move some definition from spoa_server.c to spoa_server.h
...
This will allow to add some other files to the project
2019-05-13 17:43:47 +02:00
Thierry FOURNIER
d8b5c77b55
MINOR: spoa-server: Clone the v1.7 spoa-example project
...
This is a working base.
2019-05-13 17:43:47 +02:00