-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
Description
Let server.pl consist of:
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_unix_daemon)).
:- initialization http_daemon.
:- http_handler(/, handle_request, []).
handle_request(_Request) :-
format("Content-type: text/plain~n~n"),
format("hello!!").Start the server with:
$ swipl server.pl --interactive --port=3030Let test_server.tcl consist of:
set i 0
while {true} {
if {$i % 100 == 0} { puts "$i."}
set s [socket localhost 3030]
puts $s "GET /"
set i [expr {$i + 1}]
}and run this Tcl script with:
$ tclsh test_server.tclOn OS-X 10.10.1, I get the following output from the test script:
$ tclsh test_server.tcl
0.
100.
200.
...
2500.
couldn't open socket: nodename nor servname provided, or not knownand the SWI-Prolog HTTP server crashes with:
% Started server at http://localhost:3030/
% Started server at port 3030
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.3.14-62-g18f1547-DIRTY)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
?-
<b>SWI-Prolog [thread 3 (httpd@3030_2) at Sat Jan 23 23:38:32 2016]: received fatal signal 11 (segv)
C-stack trace labeled "crash":</b>
[0] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/libswipl.dylib(save_backtrace+0xb9) [0x104a60d69]
[1] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/libswipl.dylib(crashHandler+0xa8) [0x104a61348]
[2] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/libswipl.dylib(dispatch_signal+0x2d3) [0x104a09333]
[3] /usr/lib/system/libsystem_platform.dylib(_sigtramp+0x1a) [0x7fff91c49f1a]
[5] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/libswipl.dylib(Sgetcode+0x260) [0x104a4e520]
[6] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/readutil.dylib(read_line_to_codes3+0x7c) [0x104b30b0c]
[7] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/libswipl.dylib(PL_next_solution+0x80c2) [0x10499dfd2]
[8] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/libswipl.dylib(callProlog+0x151) [0x1049ebcc1]
[9] /usr/local/lib/swipl-7.1.27/lib/x86_64-darwin14.0.0/libswipl.dylib(start_thread+0x140) [0x104a1e810]
[10] /usr/lib/system/libsystem_pthread.dylib(_pthread_body+0x83) [0x7fff88bb72fc]
[11] /usr/lib/system/libsystem_pthread.dylib(_pthread_body+0x0) [0x7fff88bb7279]
[12] /usr/lib/system/libsystem_pthread.dylib(thread_start+0xd) [0x7fff88bb54b1]On Debian 8.2, the test script test_server.tcl runs seemingly without problems, but as soon as I interrupt the script with Ctrl+C, the SWI-Prolog HTTP server also crashes on Debian, and its output is:
?-
SWI-Prolog [thread 4 (httpd@3030_3) at Sat Jan 23 23:45:32 2016]: received fatal signal 11 (segv)
SWI-Prolog [thread 3 (httpd@3030_2) at Sat Jan 23 23:45:32 2016]: received fatal signal 11 (segv)
SWI-Prolog [thread 5 (httpd@3030_4) at Sat Jan 23 23:45:32 2016]: received fatal signal 11 (segv)
C-stack trace labeled "crash":
C-stack trace labeled "crash":
SWI-Prolog [thread 6 (httpd@3030_5) at Sat Jan 23 23:45:32 2016]: received fatal signal 11 (segv)
SWI-Prolog [thread 2 (httpd@3030_1) at Sat Jan 23 23:45:32 2016]: received fatal signal 11 (segv)
C-stack trace labeled "crash":
C-stack trace labeled "crash":
C-stack trace labeled "crash":
[0] save_backtrace() at :? [0x7f5c64ef183a]
[0] save_backtrace() at :? [0x7f5c64ef183a]
[0] save_backtrace() at :? [0x7f5c64ef183a]
[0] save_backtrace() at :? [0x7f5c64ef183a]
[0] save_backtrace() at :? [0x7f5c64ef183a]
[1] crashHandler() at pl-cstack.c:? [0x7f5c64ef1a04]
[1] crashHandler() at pl-cstack.c:? [0x7f5c64ef1a04]
[1] crashHandler() at pl-cstack.c:? [0x7f5c64ef1a04]
[1] crashHandler() at pl-cstack.c:? [0x7f5c64ef1a04]
[1] crashHandler() at pl-cstack.c:? [0x7f5c64ef1a04]
[2] dispatch_signal() at pl-setup.c:? [0x7f5c64ea162b]
[2] dispatch_signal() at pl-setup.c:? [0x7f5c64ea162b]
[2] dispatch_signal() at pl-setup.c:? [0x7f5c64ea162b]
[2] dispatch_signal() at pl-setup.c:? [0x7f5c64ea162b]
[3] __restore_rt() at ??:? [0x7f5c64c0b8d0]
[3] __restore_rt() at ??:? [0x7f5c64c0b8d0]
[3] __restore_rt() at ??:? [0x7f5c64c0b8d0]
[2] dispatch_signal() at pl-setup.c:? [0x7f5c64ea162b]
[3] __restore_rt() at ??:? [0x7f5c64c0b8d0]
[4] S__fillbuf() at ??:? [0x7f5c64ee361d]
[4] S__fillbuf() at ??:? [0x7f5c64ee361d]
[4] S__fillbuf() at ??:? [0x7f5c64ee361d]
[3] __restore_rt() at ??:? [0x7f5c64c0b8d0]
[5] Sgetcode() at ??:? [0x7f5c64ee40d0]
[4] S__fillbuf() at ??:? [0x7f5c64ee361d]
[5] Sgetcode() at ??:? [0x7f5c64ee40d0]
[4] S__fillbuf() at ??:? [0x7f5c64ee361d]
[5] Sgetcode() at ??:? [0x7f5c64ee40d0]
[6] read_line_to_codes3() at readutil.c:? [0x7f5c63645c67]
[6] read_line_to_codes3() at readutil.c:? [0x7f5c63645c67]
[5] Sgetcode() at ??:? [0x7f5c64ee40d0]
[6] read_line_to_codes3() at readutil.c:? [0x7f5c63645c67]
[7] PL_next_solution() at ??:? [0x7f5c64e55a65]
[7] PL_next_solution() at ??:? [0x7f5c64e55a65]
[5] Sgetcode() at ??:? [0x7f5c64ee40d0]
[8] callProlog() at :? [0x7f5c64e8ada9]
[6] read_line_to_codes3() at readutil.c:? [0x7f5c63645c67]
[8] callProlog() at :? [0x7f5c64e8ada9]
[7] PL_next_solution() at ??:? [0x7f5c64e55a65]
[6] read_line_to_codes3() at readutil.c:? [0x7f5c63645c67]
[7] PL_next_solution() at ??:? [0x7f5c64e55a65]
[8] callProlog() at :? [0x7f5c64e8ada9]
[9] start_thread() at pl-thread.c:? [0x7f5c64eb7fb2]
[9] start_thread() at pl-thread.c:? [0x7f5c64eb7fb2]
[8] callProlog() at :? [0x7f5c64e8ada9]
[7] PL_next_solution() at ??:? [0x7f5c64e55a65]
[9] start_thread() at pl-thread.c:? [0x7f5c64eb7fb2]
[10] start_thread() at ??:? [0x7f5c64c040a4]
[10] start_thread() at ??:? [0x7f5c64c040a4]
[8] callProlog() at :? [0x7f5c64e8ada9]
[9] start_thread() at pl-thread.c:? [0x7f5c64eb7fb2]
[10] start_thread() at ??:? [0x7f5c64c040a4]
[9] start_thread() at pl-thread.c:? [0x7f5c64eb7fb2]
[10] start_thread() at ??:? [0x7f5c64c040a4]
[11] clone() at ??:? [0x7f5c6493904d]