reeze / php-leveldb

The PHP Binding for LevelDB
Other
239 stars 44 forks source link

When doing "LevelDB::repair("/path/to/db")", Segmentation fault (core dumped) #49

Open cayolblake opened 2 years ago

cayolblake commented 2 years ago

Hi @reeze @dktapps

This code fails with a segfault,

PHP 8.1.6, Linux

<?php
/* default open options */
$options = array(
        'create_if_missing'     => true,        // if the specified database didn't exist will create a new one
        'error_if_exists'       => false,       // if the opened database exsits will throw exception
        'paranoid_checks'       => true,
        'block_cache_size'      => 8 * (2 << 20),
        'write_buffer_size' => 4<<20,
        'block_size'            => 4096,
        'max_open_files'        => 1000,
        'block_restart_interval' => 16,
        'compression'           => LEVELDB_SNAPPY_COMPRESSION,
        'comparator'            => NULL,   // any callable parameter which returns 0, -1, 1
);
/* default readoptions */
$readoptions = array(
        'verify_check_sum'      => false,
        'fill_cache'            => true,
        'snapshot'              => null
);

/* default write options */
$writeoptions = array(
        'sync' => false
);

$db = new LevelDB("db1", $options, $readoptions, $writeoptions);
LevelDB::repair("db1");