Hi I’m using: SWI-Prolog version 8.3.18
I just setup a simple test server using library(http/http_server)
from the very template given here.
I’m interested in handling POST request with files (10K < expected_size < 1M). I ran a test that worked like a charm with a 300-byte file, but when scaling to a 900K file I get error 500 with this message :
"message": "copy_stream_data/3: Timeout in read from <stream>(0x5588f9ed9900)"
My code is as simple as this:
:- use_module(library(http/http_server)).
:- initialization
http_server([port(8080)]).
:- http_handler('/generate', gen_handler, []).
gen_handler(Request) :-
stream_property(Stderr, file_no(2)),
http_parameters(Request, [], [form_data(Data)]), % this is where it gets blocked for any file bigger than ~150K
forall(member(Key=Content, Data), format(Stderr, '~p~n~p~n~n', [Key, Content])).
I checked the client’s behaviour with a non Prolog server and it works.
I tried to increase the server-side timeout by passing an option to http_server
, no result.
I have trouble debugging my server since it is multithreaded, but I wonder what could prevent data communication when the file is bigger.