Skip to main content

fitz-pgserver

Fork of pgserver with Windows crash recovery fix.

Why this fork?

On Windows, when PostgreSQL crashes or is killed (e.g., via Ctrl+C), the recovery process can fail with a "sharing violation" error on the log file. This happens because:

  1. pg_ctl -l logfile start opens the log file for writing
  2. postgres subprocess starts and does crash recovery
  3. During recovery, postgres tries to fsync the entire pgdata directory
  4. This includes the log file that pg_ctl still has open → sharing violation
  5. postgres retries for 30 seconds before proceeding

The Fix

Put the log file in the system temp directory (outside pgdata):

# Before (pgserver):
self.log = self.pgdata / 'log'

# After (fitz-pgserver):
temp_dir = Path(tempfile.gettempdir())
self.log = temp_dir / f'pgserver_log.{uuid.uuid4().hex[:8]}'

By putting the log file outside pgdata, postgres doesn't try to fsync it during recovery, avoiding the sharing violation entirely.

Installation

pip install fitz-pgserver

Usage

Drop-in replacement for pgserver:

# Instead of: import pgserver
import fitz_pgserver as pgserver

db = pgserver.get_server("./my_pgdata")
uri = db.get_uri()
# Use uri with psycopg, SQLAlchemy, etc.

Performance

Scenario pgserver fitz-pgserver
Normal startup ~2s ~2s
First-time init ~10-13s ~10-13s
Crash recovery ~33s (data preserved but slow) ~1-2s (28x faster)

The massive improvement in crash recovery is because we avoid the 30-second sharing violation retry loop.

License

Apache 2.0 (same as original pgserver)

Credits

Original pgserver by Oscar Moll.

Metadata

Release files for fitz-pgserver 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fitz-pgserver 0.1.5
File Size Uploaded Provenance
fitz_pgserver-0.1.5.tar.gz 15.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fitz-pgserver 0.1.5
File Interpreter ABI Platform
fitz_pgserver-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 31.9 kB

Release files / fitz_pgserver-0.1.5.tar.gz

Download URL fitz_pgserver-0.1.5.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dc409630918e7434025782be6a9a478d6cac18c79b55a83c442064ae6d873e91
BLAKE2b-256 checksum
How to use checksums
75afabb31e4db68509040842e3f498c394a624105ebe0525606bfffc60984769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

Release files / fitz_pgserver-0.1.5-py3-none-any.whl

Download URL fitz_pgserver-0.1.5-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2459737398b59140f4aeb5666eeadf1e8d22f7df77c305ad2924754dec7bab8
BLAKE2b-256 checksum
How to use checksums
0692ea063556e81c7db91d0081dac564d69e9852b5d5946340a79c310bf21d5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

Security for fitz-pgserver 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fitz_pgserver-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page