jaaql-middleware-python 5.3.2__py3-none-any.whl → 5.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jaaql/constants.py CHANGED
@@ -218,5 +218,5 @@ ROLE__dba = "dba"
218
218
 
219
219
  PROTOCOL__postgres = "postgresql://"
220
220
 
221
- VERSION = "5.3.2"
221
+ VERSION = "5.3.3"
222
222
 
@@ -22,6 +22,18 @@ PGCONN__max_conns = 10
22
22
 
23
23
  TIMEOUT = 2.5
24
24
 
25
+ # Upper bound on how long a request waits for the parallel auth verifier's verdict before failing
26
+ # closed. Kept below the nginx proxy read timeout so the worker unwinds and returns its connection
27
+ # rather than the request dying at the proxy while the worker hangs on holding an open transaction.
28
+ WAIT_HOOK__timeout = 30
29
+ ERR__verification_timed_out = "Authorization verification timed out"
30
+
31
+ # libpq TCP keepalives: detect a peer that vanishes (DB reboot, network drop) within ~25s so the
32
+ # socket errors instead of a read blocking indefinitely. Without this the single serial
33
+ # auth-verification thread can wedge forever on a dead connection and, via the wait below, take
34
+ # every authenticated request down with it. Ignored by libpq for unix-socket connections.
35
+ CONN_STR__keepalives = " keepalives=1 keepalives_idle=10 keepalives_interval=5 keepalives_count=3"
36
+
25
37
  ERR__invalid_role = "Role not allowed, invalid format!"
26
38
  ERR__must_use_canned_query = "Must use canned query as you are not an admin!"
27
39
 
@@ -199,6 +211,8 @@ class DBPGInterface(DBInterface):
199
211
  if str(port) != "5432":
200
212
  conn_str += " port=" + str(port)
201
213
 
214
+ conn_str += CONN_STR__keepalives
215
+
202
216
  self.conn_str = conn_str
203
217
 
204
218
  if self.db_name not in user_pool:
@@ -309,7 +323,14 @@ class DBPGInterface(DBInterface):
309
323
  do_prepare = prepare and _statement_is_preparable(query)
310
324
 
311
325
  if wait_hook:
312
- res, err, code = wait_hook.get()
326
+ try:
327
+ res, err, code = wait_hook.get(timeout=WAIT_HOOK__timeout)
328
+ except queue.Empty:
329
+ # The parallel verifier never delivered a verdict (its single serial thread
330
+ # wedged, e.g. on a connection killed by a DB reboot). Fail closed and let
331
+ # the worker unwind - without this bound the worker blocks forever holding
332
+ # an open transaction, and enough of them starve the pool into nginx 504s.
333
+ raise Exception(ERR__verification_timed_out)
313
334
  if not res:
314
335
  if code == 500:
315
336
  raise Exception(err)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jaaql-middleware-python
3
- Version: 5.3.2
3
+ Version: 5.3.3
4
4
  Summary: The jaaql package, allowing for rapid development and deployment of RESTful HTTP applications
5
5
  Home-page: https://github.com/JAAQL/JAAQL-middleware-python
6
6
  Author: Software Quality Measurement and Improvement bv
@@ -1,6 +1,6 @@
1
1
  jaaql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  jaaql/config_constants.py,sha256=puoR6jfbXw8oXXEfbYNn2ysGwgiGTyuDjOj7F8acsTE,470
3
- jaaql/constants.py,sha256=sfY4dvRV-sRuMwo6UcqD37XKFLPYNSzRD2VjM8CQNAs,7355
3
+ jaaql/constants.py,sha256=ocgDdVs0zked7wQ2_gh_LHKk9KO4rujsTTnNc2mI_Qc,7355
4
4
  jaaql/generated_constants.py,sha256=pxmpTux7rrjJH6iqLb-R8RKJ4t0CeoGdnspjH5DiWgU,11327
5
5
  jaaql/jaaql.py,sha256=bfiEW9A8PlZIVjDJd_LOhCLBL8flc_f7w0umR6EWbU4,6614
6
6
  jaaql/patch.py,sha256=VE4B6jA492NCIxNIewbynh92jxVulmRFtB9hNEe6q94,149
@@ -10,7 +10,7 @@ jaaql/config/config-test.ini,sha256=ap9OFqCCbYdWqmUKq0p9GD1IkM4CzeTXDV5gbQGQZoQ,
10
10
  jaaql/config/config.ini,sha256=o1orXNYRFgf09MKzZBQ3v0oMzWn7N6KwvX5YV0WJtns,321
11
11
  jaaql/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  jaaql/db/db_interface.py,sha256=n4pwRHeGpkbmTOvZDe8VvqFf2l4QsE9GbhUBzW335m0,7702
13
- jaaql/db/db_pg_interface.py,sha256=3w7_uMUmZ7RedqIQ_hZry5HDtfUK9kCdazHra3TYuDQ,19597
13
+ jaaql/db/db_pg_interface.py,sha256=zBZUkfbbmN8WU6gz0vLiZv10QKd1e7muhx0zP6yekt4,21098
14
14
  jaaql/db/db_utils.py,sha256=xZCdtWT9semzLL-NAiwMFx_38Wv96BBv60pfPYNDnCc,7761
15
15
  jaaql/db/db_utils_no_circ.py,sha256=WLhk6EwsnTdLGUAjq3RZBH3FzgwEumh45A24WWysWmQ,4666
16
16
  jaaql/documentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -66,8 +66,8 @@ jaaql/utilities/options.py,sha256=75M7-oSeY4wmHGz3-su_c36yf_Csv9HxvTG7aRlGR0A,49
66
66
  jaaql/utilities/utils.py,sha256=nVYVhuHtWSjdaJaXe9eC1Usja56NO-V9SoBIlcHAK8Q,5166
67
67
  jaaql/utilities/utils_no_project_imports.py,sha256=YwcskR15dAqKdEiuF8zGx-tzwWkclSGil_zm_qZ8ylU,4626
68
68
  jaaql/utilities/vault.py,sha256=DudyQNtMtaRLL71IGQX0AI16Tg1id98BHTCQPyUNkmE,2243
69
- jaaql_middleware_python-5.3.2.dist-info/licenses/LICENSE.txt,sha256=wr50eN0TnkrCSuNwyiI81FLZqmrW3q0JqRlVVQIrGA0,18134
70
- jaaql_middleware_python-5.3.2.dist-info/METADATA,sha256=cN4zk-t4FHTjS1N16a6CldkX4G5BqynXlvWUp2qjRUU,1976
71
- jaaql_middleware_python-5.3.2.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
72
- jaaql_middleware_python-5.3.2.dist-info/top_level.txt,sha256=k5aKVQy77bPyfyNHITvo5m3FqdSAiiXbjT5S9D9KzgU,6
73
- jaaql_middleware_python-5.3.2.dist-info/RECORD,,
69
+ jaaql_middleware_python-5.3.3.dist-info/licenses/LICENSE.txt,sha256=wr50eN0TnkrCSuNwyiI81FLZqmrW3q0JqRlVVQIrGA0,18134
70
+ jaaql_middleware_python-5.3.3.dist-info/METADATA,sha256=oEe5Uk6pBPUmldYY9N9IKLjQU-XWreZiDXBGCxkZusw,1976
71
+ jaaql_middleware_python-5.3.3.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
72
+ jaaql_middleware_python-5.3.3.dist-info/top_level.txt,sha256=k5aKVQy77bPyfyNHITvo5m3FqdSAiiXbjT5S9D9KzgU,6
73
+ jaaql_middleware_python-5.3.3.dist-info/RECORD,,