Closed rla closed 2 years ago
I compiled SWI-Prolog 8.5.16 using the standard instructions (Debian 11).
Test code:
:- use_module(library(http/http_json)). :- use_module(library(http/http_unix_daemon)). :- use_module(library(http/thread_httpd)). http_unix_daemon:http_server_hook(Options):- http_server(reply, Options). reply(_):- reply_json(_{ status: hello }).
Command line:
swipl test.pl --no-fork --port=15043 --workers=8 --interactive=false
Sending SIGINT does nothing except in 5 or so minutes where it throws:
ERROR: 2022-09-15 22:20:00.000 Stack limit (1.0Gb) exceeded ERROR: 2022-09-15 22:20:00.000 Stack sizes: local: 11Kb, global: 3Kb, trail: 0Kb ERROR: 2022-09-15 22:20:00.000 Stack depth: 30, last-call: 33%, Choice points: 13 ERROR: 2022-09-15 22:20:00.000 In: ERROR: 2022-09-15 22:20:00.000 [30] '$messages':longest_prefix([], _1028) ERROR: 2022-09-15 22:20:00.000 [29] '$messages':longest_prefix([length:1], [length:1|_1060]) ERROR: 2022-09-15 22:20:00.000 [28] '$messages':longest_id(en_US, _1080) ERROR: 2022-09-15 22:20:00.000 [26] '$messages':translate_message(<compound debug/2>, _1100, []) ERROR: 2022-09-15 22:20:00.000 [25] '$dcg':call_dcg(<compound (:)/2>, _1128, []) ERROR: 2022-09-15 22:20:00.000 ERROR: 2022-09-15 22:20:00.000 Use the --stack_limit=size[KMG] command line option or ERROR: 2022-09-15 22:20:00.000 ?- set_prolog_flag(stack_limit, 2_147_483_648). to double the limit.
Removing thread_idle wrapper from wait/1 in https://github.com/SWI-Prolog/packages-http/blob/4a1cc0aa520dfe6244831fc60e1756afaf4cd6ea/http_unix_daemon.pl#L837 fixes it. Signal seems to be sent but the thread seems to have trouble receiving it when thread_idle is used.
thread_idle
wait/1
Thanks. The thread_idle call was unrelated :smile: Fixed with SWI-Prolog/swipl-devel@8c9d3757bf900403e8b6428e21bf4f980061d70a
Thanks for the quick fix!
I compiled SWI-Prolog 8.5.16 using the standard instructions (Debian 11).
Test code:
Command line:
Sending SIGINT does nothing except in 5 or so minutes where it throws:
Removing
thread_idle
wrapper fromwait/1
in https://github.com/SWI-Prolog/packages-http/blob/4a1cc0aa520dfe6244831fc60e1756afaf4cd6ea/http_unix_daemon.pl#L837 fixes it. Signal seems to be sent but the thread seems to have trouble receiving it whenthread_idle
is used.