From: TopCoder2K (@TopCoder2K) <noreply+TopCoder2K@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #831: Creating the HNSW index causes "psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected"
Date: Mon, 28 Apr 2025 08:01:35 +0000
Message-ID: <gh-pgvector-pgvector-831@github.com> (raw)
I've already searched for possible causes, so I've looked at
- [Creating an HNSW index causes SSL error](https://github.com/pgvector/pgvector/issues/307)
- [Postgres SSL SYSCALL error: EOF detected with python and psycopg](https://stackoverflow.com/questions/24130305/postgres-ssl-syscall-error-eof-detected-with-python-and...)
but it seems I don't have any direct problems with network, CPU or RAM.
### My case
I run the following (real names have been removed):
```
CREATE INDEX my_index ON my_table USING hnsw (my_column sparsevec_ip_ops) WITH (m = 64, ef_construction = 512)
```
and get the error after around 35 minutes. Relevant logs from `/var/log/postgresql/postgresql-12-main.log` are:
```
[3251] LOG: server process (PID 2557861) was terminated by signal 11: Segmentation fault
[3251] DETAIL: Failed process was running: CREATE INDEX my_index ON my_table USING hnsw (my_column sparsevec_ip_ops) WITH (m = 64, ef_construction = 512)
```
The HNSW index was successfully created on the same table with `m = 64, ef_construction = 256` after working for about 6 hours, therefore, the error may be caused by some memory issues. However, I was monitoring the RAM during the index creation and it wasn't exceeding 10% of the total RAM.
Also, I don't believe there are problems with the connection, but I tried to set
```
keepalives_idle=28_800, # 8 hours
keepalives_interval=3600, # 1 hour
```
and it didn't help.
Could you please advise me which settings I should check and what can be the cause of the error?
#### Set up
```
PostgreSQL 12.17
psycopg 3.2.6
psycopg-binary 3.2.6
pgvector 0.4.0
```