Segfault in aod_sketch_get_estimate while lgk=16

Open
#77 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, cpp, linux, postgresql
Domain
databases

Research direction

Start with test/aod_sketch_test.sql at line 25 and reproduce the query aod_sketch_get_estimate(aod_sketch_union(sketch, 16)) using the reported PostgreSQL, datasketches-postgresql, and datasketches-cpp versions. Trace the crash and use the regression test to verify that the query completes without a server termination signal.

Written by the indexing model from the issue text.

Description

Hi team.
I am experiencing segfault while I am running datasketches-postgresql tests.
Here is the error log

 psql:test/aod_sketch_test.sql:25: server closed the connection unexpectedly
 	This probably means the server terminated abnormally
 	before or while processing the request.
 psql:test/aod_sketch_test.sql:25: error: connection to server was lost
 2025-05-23 21:14:29.609 UTC [13567] LOG:  server process (PID 13607) was terminated by signal 11: Segmentation fault
 2025-05-23 21:14:29.609 UTC [13567] DETAIL:  Failed process was running: select aod_sketch_get_estimate(aod_sketch_union(sketch, 16)) from aod_sketch_test;

I am running with version datasketches-postgresql 1.7.0, with datasketches-cpp 5.0.0, on PostgreSQL 15.12 OEL7 linux distribution.
Here is my datasketches-postgresql set up script

# install datasketches-cpp
curl -O https://archive.apache.org/dist/datasketches/cpp/5.0.0/apache-datasketches-cpp-5.0.0-src.zip
unzip apache-datasketches-cpp-5.0.0-src.zip
mv apache-datasketches-cpp-5.0.0-src datasketches-cpp

# install boost
curl -O https://archives.boost.io/release/1.75.0/source/boost_1_75_0.tar.bz2
tar -xjf boost_1_75_0.tar.bz2
mv boost_1_75_0 boost

export BUILD_USER_DIR="/home/builduser"

# mark the extension as trusted, so that users can create it without
# superuser permissions
echo "trusted = true" >> datasketches.control
su builduser -c "make"
su builduser -c "make install"
# clean up the already created data directory
su builduser -c "rm -rf ${BUILD_USER_DIR}/data_dir"

# re-create the data directory
su builduser -c "mkdir -p ${BUILD_USER_DIR}"

# to do regression tests, we need to create new data dir
su builduser -c "pg_ctl -D ${BUILD_USER_DIR}/data_dir init"

# start postgres for testing
su builduser -c "pg_ctl start -D ${BUILD_USER_DIR}/data_dir"

# run tests
 su builduser -c "psql -h 127.0.0.1 -d postgres -c 'create database test;'"
 su builduser -c "make tests"

Is there anything I did wrong? Looking forward to your response.

Dominant language
C
Stars
96
Forks
13
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/datasketches-postgresql

All issues in apache/datasketches-postgresql

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.