# Ann: SWI-Prolog 9.3.3

**URL:** <https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-3/7311>\
**Category:** Releases\
**Created:** [March 15, 2024, 5:23pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-3/7311 "2024-03-15T17:23:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 15, 2024, 5:23pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-3/7311/1 "2024-03-15T17:23:26Z")

</div>

Dear SWI-Prolog user,

SWI-Prolog 9.3.3 is ready for download. This release comes with many  
fixes, although most will affect few users. They are mostly the  
result the website (notably SWISH) reorganization, @peter.ludemann  
work on cpp and @ridgeworks work on clpBNR. Highlights:

- Several issues wrt. the “standard” streams could result in  
crashes and memory leaks.
- Several improvements to help/1 for loaded (documented)  
predicates.
- @brebs fixed an old issue with accasionally failing tests for  
HTTP proxy processing
- Preserve properties of foreign predicates when creating a  
saved state.
- Make coverage analysis deal with include/1.
- Possibly incorrect handling for C-stack limit.
- Various enhancements to HTTP server session management, notably  
for the Redis plugin.
- thread\_exit/1 has been dropped from the Windows version after  
comments by @mgondan.
- Added library(http/http\_server\_health), providing /health to  
return a JSON document with configurable keys with health  
related data. Now active on all SWI-Prolog’s public services.
- PlDoc enhancements or included files and user predicates.  
@peter.ludemann fixed closing quotes in LaTeX based docs to  
use proper Unicode quotes.

Eventually, this will probably all be merged into 9.2.3 (stable).  
Considering the complexity of notably the I/O stream changes it  
is safer to wait a little.

And, on suggestion by @nicos, there are some more sponsor buttons  
spread over the website and SWISH. In particular institutional and  
commercial users are kindly requested to donate and help making  
SWI-Prolog more sustainable.

```
Enjoy --- Jan

```

# SWI-Prolog Changelog since version 9.3.2

- FIXED: tell/1: properly manage standard stream references.

- FIXED: Stream reference counting and reset when closing a standard  
stream.

- FIXED: Memory leak in string\_bytes/3.

- FIXED: Properly close temporary redirect to a string  
tellString()/toldString() could fail to reclaim the temporary stream  
object.

- ENHANCED: Use a segmented stack for dealing with findall/3.  
This avoids memory fragmentatation when findall/3 is deeply nested.  
Although that is a rare occasion, deeply nested findall/3 leads to  
poor memory reuse. As activating and deactivating is stacked anyway,  
a segstack avoids the fragmentation.

- ADDED: help(Name/Arity): handle user predicates.

- FIXED: xref\_source/2: keep processing PlDoc commands after including  
a file.

- ADDED: help/1: give help on a specific user predicate using Module:PI.

- ENHANCED: help/1: filter user predicates on the module class.  
This use to filter on whether they are documented in the manual,  
making it impossible to show documentation for loaded predicates that  
conflict with something defined in the manual.

- FIXED: Thread I/O streams may be invalid If a thread is created  
using thread\_create/3 with the inherit\_from(Thread) option or using  
PL\_thread\_attach\_engine() (which inherits from `main`), we may copy  
`current_input` or `current_output` from a temporary redirect.

- FIXED: help/1 to deal with help on public predicates in included files.  
help/1 finds the predicate and, if necessary, reloads the file in  
which it is defined to get the documentation. If the predicate is  
defined in an include file it should reload the main file to get the  
module context right.

- ENHANCED: trace/1,2 and friends. - Code cleanup - Support conditional  
trace using `trace(Head, Port(Condition))`

- FIXED: Ensure correct setting file handle for std streams. This was  
broken after adding the `fileno` field to the IOSTREAM struct.

- MODIFIED: Discontinue thread\_exit/1 on Windows The implementation was  
broken for some time. The reason is not entirely clear, but possibly  
related to issues in pthread-win32. As the predicate is unsafe and  
deprecated anyway, it has now been removed from the Windows version.

- FIXED: pack metadata checking for `prolog:Feature` requirements.

- FIXED: make stream\_property(S, file\_no(N)) safe. This used to be  
subject to race conditions between the enumerating thread and threads  
that close the underlying stream. We now copy the file handle as it  
was found when creating the stream to the main stream structure.

- CLARIFIED: PL\_free\_blob() can be called multiple times. This patch  
changes subsequent calls to a no-op that returns `FALSE` and document  
this is valid. After comment by Peter Ludemann.

- CLEANUP: Do not call blob `release()` on GC or cleanup after  
PL\_free\_blob()

- ENHANCED: Answer/query expansion. Toplevel variable ($Var) handing  
is now always handled, regardless of the user:expand\_query/4 or  
user:expand\_answer/2 hooks. The user:expand\_answer/2 hook is  
superseded by prolog:expand\_answer/3.

- DOC: Deprecate format/3 with a non-list 3th argument.

- FIXED: Setting the C-stack limit to values not a multiple of the page  
size Causes problems on some platforms.

- DOC: Use ASCII LaTeX ``word’’

- FIXED: Preserve atributes set on foreign functions for saved states.  
This bug causes http\_stream:stream\_range\_open/3 not be to transparent  
when reloaded from a saved state. This in turn raises an error with  
http\_open/3 on HTTPS and chunked streams.

- ENHANCED: coverage/2: analyze and annotate included files.  
The coverage analyzer now deals with files that are included. Files  
that are included multiple times in different modules get their  
numbers aggregated.

- FIXED: Crash when using ‘$cov\_data’/3 if there is no coverage data.

## Package cpp

- DOC: improve non-det example (and tests)

- DOC: Use ASCII LaTeX ``word’'.

## Package http

- TEST: Don’t reuse original test port for HTTP proxy Instead, use port  
assigned by OS.

- FIXED: Make http session GC thread inherit from `main` This thread is  
started lazily from an HTTP worker and would by default interit the  
temporary CGI stream as `current_output`. By interiting from main we  
can safely print debug messages and avoid stream existence exceptions.

- FIXED: HTTP Sessions using Redis to properly handle concurrent delete.  
Multiple participants may decide to delete a session. By checking  
the removal from the timeout queue we avoid that two nodes delete  
the same session.

- ADDED: HTTP session management `granularity` This setting controls  
how precisely we manage idle time updated and session timeouts.  
This is notably important when using an external (Redis) database  
for sharing session information to reduce traffic.

- ENHANCED: http\_upgrade\_to\_websocket/3: discard a websocket on failure.  
When using the guarded(false) option, the created web socket is now  
only left open if the passed Goal succeeds.

- DOC: http\_server/2: Explictly mention the possible use of `AF_UNIX`  
sockets

- ENHANCED: Implementation of `open_files` in server stats.

- ADDED: Extended `/health` with CPU time and thread satistics.  
Also allows asking for specific keys only in the HTTP request, e.g.

- ADDED: http\_workers/2: mode (?,-) (was (+,-)) Also point at  
library(http/http\_dyn\_workers) in docs and improve the implementation  
by using aggregate\_all/3 rather than findall/3 and length/2.

- ADDED: library(http\_server\_health)

## Package ltx2htm

- FIXED: handling of final single quote

- ENHANCED: Warn on non-ASCII characters. We can’t handle these.

## Package pldoc

- ENHANCED: Better ordering of predicates comming from other files.  
pldoc for “re-exported” predicates are now ordered by position, i.e.,  
file name and line number.

## Package plunit

- FIXED: Report tests where the setup goal fail as failed and print  
output.

## Package semweb

- FIXED: #110 Allow blank nodes as graph in TRiG format.

## Package swipl-win

- FIXED: Reset fileno for stdio streams

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 24, 2024, 12:48pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-9-3-3/7311/4 "2024-03-24T12:48:53Z")

</div>

> [@anon95304481](#):
>
> This release hangs on Windows 10. Doesn’t show the sermon and  
> then the prompt, just a blank window, when using the GUI console.

Thanks for reporting. Fixed and updated the binaries on the download page.
