Skip to content

data.table 1.18.0 causes Postgresql server crash (segmentation fault) with pl/R on Debian servers #7605

Description

@ced75

Since version 1.18.0, loading data.table in a pl/R function on a PostgreSQL server on Debian (12 and 13 at least) causes a segmentation fault which crashes the PostgreSQL instance (17 and 18 tested).

Steps to reproduce on a fresh Debian (12 or 13) VM:

Install PostgreSQL

sudo apt update
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt install postgresql-17

Install R

sudo apt install r-base r-base-dev

Install R packages

To be usable by PostgreSQL, packages are installed as sudo.

sudo R
install.packages(c("dplyr", "data.table"))
exit

data.table v 1.18.0 is installed by default, since it's the last available version.

Install pl/R

sudo apt install postgresql-17-plr

Create and test a pl/R function loading data.table

sudo -iu postgres psql
create extension plr;

SELECT * FROM plr_environ();
SELECT load_r_typenames();
SELECT * FROM r_typenames();
SELECT plr_array_accum('{23,35}', 42);

CREATE OR REPLACE FUNCTION public.r_test(int) RETURNS int AS $code$
    library(data.table)
    return(arg1)
$code$ LANGUAGE 'plr' STRICT;

select * from public.r_test(1);

The PostgreSQL server crashes with a segmentation fault caused by the r_test function call. If you comment the data.table loading, the function works fine.

In R, data.table loading works fine, the problem is only related to pl/R in PostgreSQL.
If you replace data.table v 1.18.0 by v 1.17.8 (or earlier), everything works fine.

On an Ubuntu Server 24.04, the problem does not occur.

Activity

  1. added theissue type on Jan 19, 2026
  2. aitap commented on Jan 19, 2026

    @aitap
    Member

    Confirmed. We're seeing a name collision, similar to #4369:

    Thread 1 "postgres" received signal SIGSEGV, Segmentation fault.
    __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
    (gdb) bt
    #0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
    #1  0x0000563701d3a577 in hash_create (tabname=tabname@entry=0x13 <error: Cannot access memory at address 0x13>, nelem=140507227299856, info=0x10, flags=67)
        at ./build/../src/backend/utils/hash/dynahash.c:390 # ← PostgreSQL
    #2  0x00007fca4849663d in chmatchMain (x=<optimized out>, table=<optimized out>, nomatch=0, chin=<optimized out>, chmatchdup=false)
        at chmatch.c:60 # ← data.table
    #3  0x00007fca65aff6fa in R_doDotCall (fun=fun@entry=0x7fca48496860 <chin_R>, nargs=nargs@entry=2, cargs=cargs@entry=0x7ffe680b0270, call=call@entry=0x563705f95470)
        at ./src/main/dotcode.c:871 # ← R
    

    Version 1.18.0 introduced a function named hash_create. It's too bad that the PostgreSQL server already has a function named like that, with the dynamic linker resolving the wrong symbol.

  3. added a commit that references this issue on Jan 19, 2026
    1ecbe92
  4. added this to the 1.18.2 milestone on Jan 19, 2026
  5. added a commit that references this issue on Jan 20, 2026
    d6ac127
  6. added a commit that references this issue on Jan 20, 2026
    2a9feba
  7. added a commit that references this issue on Jan 27, 2026
    afe1218
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

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions