Skip to content

Remote SQLite "on server" never connects: exec request exceeds libssh2's packet limit (libssh2 -34) #4241

Closed

Description

@rpsimao

What happens

A SQLite connection with SSH remote file access set to on server fails every time with "Could not connect … Not connected to database". The log shows:

[com.TablePro:RemoteSQLiteTransport] Remote SQLite session ready for <private> on 127.0.0.1:60032
[com.TablePro:RemoteSQLiteTunnel] Remote SQLite exec channel failed to open, libssh2 -34

SSH authentication succeeds (the server logs Accepted publickey), then the session closes before the agent starts.

Steps to reproduce

  1. Create a SQLite connection over SSH (private key auth) with remote file access on server, pointing at a database file on a Linux host that has python3.
  2. Connect.

Expected behavior

The remote SQLite agent starts and the database opens.

Cause

RemoteSQLiteAgentSource.launcherCommand() puts the base64 agent program into the shell command once per interpreter (python3, /usr/bin/python3, /usr/libexec/platform-python). The program is about 18 KB, about 24 KB in base64, so the exec request is about 73 KB.

libssh2 (src/transport.c, _libssh2_transport_send) refuses any uncompressed packet whose payload is >= MAX_SSH_PACKET_LEN - 0x100 (35000 - 256) and returns LIBSSH2_ERROR_INVAL (-34). TablePro doesn't set LIBSSH2_FLAG_COMPRESS, so libssh2_channel_process_startup always fails here. This should affect every server, not one particular setup.

Proof the server side is fine

Running the same agent program by hand over the same route (OpenSSH client, one copy of the program in argv, a HELLO frame on stdin) returns READY with SQLite 3.46.1 and Python 3.14.4.

Possible fixes

  • Embed the program once: e.g. sh -c 'for i in python3 /usr/bin/python3 /usr/libexec/platform-python; do command -v "$i" >/dev/null 2>&1 && exec "$i" -I -S -c "…" <b64>; done; echo …'. About 24 KB is still close to the limit, so also:
  • Send the program on stdin after the exec starts (a short bootstrap that reads N bytes and execs them), or compress it (zlib + base64 and zlib.decompress in the bootstrap). Either keeps the request far below 35 KB as the agent grows.

Environment

  • TablePro 0.86.0 (macOS); same launcher code on main at 2fba4a0
  • libssh2 1.11.2-dev.3209951db4e4 (from apple/scripts/build-libssh2.sh)
  • Server: Ubuntu 26.04, OpenSSH, Python 3.14.4, libsqlite3 3.46.1; connection through one jump host (it fails at the exec step, after the jump and auth have succeeded)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions