Pike 8.0.466 Release notes

Changes since Pike 8.0.438 (release 9)

New Features

  • Concurrent

    The Concurrent module simplifies asynchronous code by synchronizing events in different ways. As an example the connect() function shown below will respond with a Concurrent.Future object that at some point will represent either a connected socket or a failure.

    Concurrent.Future connect(string host, int port)
    {
      Stdio.File con = Stdio.File();
      Concurrent.Promise p = Concurrent.Promise();
      if( !con->async_connect(host, port, lambda(int success)
        {
          if(success)
            p->success(con);
          else
            p->failure("Failed to connect to "+host+":"+port+"\n");
        }))
      {
        p->failure("Failed to open socket.\n");
      }
      return p->future();
    }
    

    The returned future can then be used in various ways.

    // On success, call make_request(con, query). On failure call
    // werror(msg).
    connect(host, port)
      ->on_failure(werror)
      ->on_success(make_request, query);
    
    // On success, call make_request(con, query1) followed by
    // make_request(resp, query2), where resp is the return value from
    // make_reqest.
    connect(host, port)
      ->then(make_request, werror, query1)
      ->then(make_request, werror, query2);
    
    // Call bridge_ports(con1, con2) when both connections are
    // established.
    Concurrent.all(connect(host1, port1), connect(host2, port2))
      ->then(bridge_ports, failure);
    
    // Call make_request(con) once either of the connections are
    // established.
    Concurrent.race(connect(host1, port1), connect(host2, port2))
      ->then(make_requet, query);
    
  • Debug.Inspect

    Allows for interactive debugging and live data structure inspection in both single- and multi-threaded programs.

    Example: In the program you’d like to inspect, insert the following one-liner:

    Debug.Inspect("/tmp/test.pike");
    

    Then start the program and keep it running. Next you create a /tmp/test.pike with the following content:

    void create() {
      werror("Only once per modification of test.pike\n");
    }
    
    int main() {
      werror("This will run every iteration\n");
      werror("By returning 1 here, we disable the stacktrace dumps\n");
      return 0;
    }
    
    void destroy() {
      werror("destroy() runs just as often as create()\n");
    }
    

    Whenever you edit /tmp/test.pike, it will automatically reload the file.

Bug fixes

  • ADT.Heap

    Fixed heap corruption when the same object is pushed more than once. It will now be considered as calling adjust().

  • FSEvents

    EventStreamMonitor now works with other backends.

  • Filesystem.Monitor

    • Reduced initialization latency.

    • Changed the polling heuristic.

      This is intended to reduce poll (and notification) delays in some circumstances.

    • Improved robostness of adjust_monitor().

    • Removed some dead and obsolete code.

    • Scan accelerated monitors too.

      Both the Inotify and FSEvents APIs claim that they support notifications on eg network file systems, and while they will succeed in notifying on changes performed by the local host on such file systems, they will not on changes performed by other hosts. To avoid missing such changes these monitors need to be actively scanned too.

    • Fixed lost acceleration with InotifyMonitor

      Recover from race-condition where when a file was repeatedly created and deleted, acceleration was lost.

    • Fixed symlink issue with InotifyMonitor.

    • Added support for more fine-grained tracing of monitors.

  • Inotify

    Addressed an issue where the backend might be stuck in pending indefinitely.

  • mappings

    Fixed an off by one error in random(mapping) that randomly caused values of type PIKE_T_FREE from the freelist to be exposed to Pike.

  • Nettle.Hash

    Fixed NULL-dereference in Nettle.Hash()->crypt_hash().

  • Parser.HTML

    Fixed a condition where Pike would run out of stack space for large documents.

  • Search

    Fixed a race condition when updating the database.

  • Sql.pgsql

    • Sped up BEGIN/COMMIT statements.

    • Preserve the initial error message in case of multiple error messages during the same transaction.

    • Flush out unseen error messages upon connection close to stderr.

    • Closed a prepared-statement-cache race when the same statement is offered multiple times before it finalises the cache entry.

    • Fix sync errors with the database in case of multiple running statements on a single connection that generate multiple errors.

    • Eliminate spurious sync errors on pipe-lined transactions (multiple transactions in flight on a single file descriptor).

    • CancelRequests (to cancel running queries) caused sync errors with the database when multiple queries were in flight.

    • Eliminate transient error messages on database restarts.

  • Sql.SQLite

    When using query bindings, strings are now always stored as strings; previously, 8-bit strings were stored as binary objects (BLOBs) and wide strings were stored as unicode strings, which caused 8-bit strings to be unequal (and thus not returned) when used in a standard string query.

    Binary values may be stored as BLOBs using bindings by wrapping the binary string in a multiset. For example, to store the value “myBinary” as a BLOB value using a binding, use: (<”myBinary”>).

  • Standards.BSON

    • Fixed incorrect encoding/decoding of Binary data.

    • Bugfixes for the decoding of Binary values of subtype 2, Binary values of subtypes above 0x7f and Datetime values with negative values.

  • Standards.JSON

    Fixed integer overflow in decode() on 64-bit platforms.

  • Stdio.Buffer

    • Fixed a crash when attempting to create a rewind key on a buffer returned by read_buffer().

    • Fixed integer overflow in read_json().

Building

  • Configure

    Attempt to detect the tool prefix depending on ABI.

    Improves detection of pkg-config.

  • Java

    Detect system installation of JavaVM framework on MacOS X.

  • Stdio

    Improved support for NetBSD.