GithubHelp home page GithubHelp logo

aerospike-client-hhvm's People

Contributors

kaisung avatar pavanrao-gslab avatar pratimamane-gslab avatar raunaksabhani-gslab avatar rbotzer avatar serphen avatar sgolemon avatar vishalbudhawant-gslab avatar wchu-citrusleaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aerospike-client-hhvm's Issues

Call to undefined method fail()

When I am trying to connect to an invalid ip or when the connection is down. In the put method I am getting segmentation fault. With an error in the console as " Call to undefined method fail()"

Segmentation fault when using query on index

aql> CREATE INDEX index1 ON ns1.set1 (bin1) STRING
OK, 1 index added.

When I run a query in hhvm this happens:

[Wed May 11 12:42:46 2016] [hphp] [25396:7f84527ff700:0:000001] [] Core dumped: Segmentation fault
[Wed May 11 12:42:46 2016] [hphp] [25396:7f84527ff700:0:000002] [] Stack trace in /tmp/stacktrace.25396.log
Segmentation fault (core dumped)

Stacktrace file /tmp/stacktrace.25396.log is empty.

I can successfully run the same query in aql.

Unable to start HHVM with the extension using systemctl

** update, I wanted to run HHVM as shall (due to custom libraries on the LIB PATH) however adding lib
ldconfig , succeeds just fine, it is not critical really ***

to /opt/local/src/git/aerospike/aerospike-client-c/target/Linux-x86_64/lib:
libaerospike.so -> libaerospike.so


using following guide : (this issue might be strictly related to HHVM, so I might move this to that repo, but running this by you here regardless)

aaactually taking the extension out and repeating if exact result filling this under HHVM repo..

ref.
https://github.com/facebook/hhvm/wiki/Building-and-installing-hhvm-on-CentOS-7.x

Note: able to start HHVM with aerospike extension by hand in the following way (using bash script) from the command line with the sudo

start-hhvm.sh

!/bin/bash

export LD_LIBRARY_PATH=/opt/local/src/git/aerospike/aerospike-client-c/target/Linux-x86_64/lib

/opt/local/src/git/facebook/hhvm/dist/bin/hhvm --config /etc/hhvm/server.ini --user nobody --mode daemon

/opt/local/src/git/facebook/hhvm/dist/bin/hhvm --config /etc/hhvm/server.ini --mode daemon


using sudo systemctl start hhvm , following does not start (with or without --user=nobody, with the difference that user nobody creates "Unable to find/load systemlib.php" error in the /var/log/hhvm/error.log

[Unit]
Description=HHVM HipHop Virtual Machine (FCGI)

[Service]
ExecStartPre=-/usr/bin/mkdir -p /var/run/hhvm
ExecStartPre=-/usr/bin/chown nobody /var/run/hhvm
ExecStart=/opt/local/src/git/facebook/hhvm/dist/bin/start-hhvm

[Install]
WantedBy=multi-user.target


pid = /var/run/hhvm/hhvm.pid

hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.ip = 127.0.0.1
hhvm.log.use_log_file = true
hhvm.log.header = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.server.thread_count = 40
hhvm.server.expose_hphp = false
hhvm.server.request_timeout_seconds = 8
hhvm.extensions[] = /opt/local/src/git/aerospike/aerospike-client-hhvm/dist/lib64/hhvm/extensions/20150212/aerospike-hhvm.so


[amilkowski@localhost bin]$ sudo systemctl start hhvm
[amilkowski@localhost bin]$ sudo systemctl status hhvm
hhvm.service - HHVM HipHop Virtual Machine (FCGI)
Loaded: loaded (/usr/lib/systemd/system/hhvm.service; enabled)
Active: inactive (dead) since Fri 2015-07-17 11:06:42 EDT; 6s ago
Process: 116795 ExecStart=/opt/local/src/git/facebook/hhvm/dist/bin/start-hhvm (code=exited, status=0/SUCCESS)
Process: 116792 ExecStartPre=/usr/bin/chown nobody /var/run/hhvm (code=exited, status=0/SUCCESS)
Process: 116790 ExecStartPre=/usr/bin/mkdir -p /var/run/hhvm (code=exited, status=0/SUCCESS)
Main PID: 116795 (code=exited, status=0/SUCCESS)

Jul 17 11:06:42 localhost.localdomain systemd[1]: Starting HHVM HipHop Virtual Machin....
Jul 17 11:06:42 localhost.localdomain systemd[1]: Started HHVM HipHop Virtual Machine....
Hint: Some lines were ellipsized, use -l to show in full.
[amilkowski@localhost bin]$

AEROSPIKE_ERR_RECORD_NOT_FOUND after refresh or redirect.

Hi,

I am having issues where I set a record and after I do a redirect or refresh, then I see in the logs:

Error 2 : AEROSPIKE_ERR_RECORD_NOT_FOUND : Array\n(\n    [ns] => sessions\n    [set] => session\n    [key] => session_9c7b3414346b04e489a88a25a4328b67\n)\n

My code for generating my own session:

public function set_click_session($session_data)
{
    $uniq_id = $this->gen_session_id();

    $as_data = array(
        'bin' => 'sessions',
        'table' => 'session',
        'key' => "session_" . $uniq_id
    );

    $this->aerospike_funcs->set($as_data, $session_data);
}

public function get_click_session()
{
    $uniq_id = $this->gen_session_id();

    $as_data = array(
        'bin' => 'sessions',
        'table' => 'session',
        'key' => "session_" . $uniq_id
    );

    return $this->aerospike_funcs->get($as_data);
}

private function gen_session_id()
{
    // Create unique id for decoding
    $id = ip2long($this->input_funcs->ip_address()) . '#' . $this->input_funcs->user_agent();
    $uniq_id = md5($id);

    return $uniq_id;
}

My code for the aerospike functionality:

<?php

class aerospike_funcs
{
    public function __construct()
    {
        $this->app = \Slim\Slim::getInstance();
        $this->db = $this->app->aerospike_db;
    }

    public function reset_id()
    {
        $id = $this->db->initKey('writes', 'sub_id', 'id');
        $this->db->remove($id);

        $id = $this->db->initKey('writes', 'click_id', 'id');
        $this->db->remove($id);
    }

    public function increment_id($type)
    {
        $key = $this->db->initKey('writes', $type, 'id');

        $op = [
            ['bin' => 'id', 'val' => 1, 'op' => Aerospike::OPERATOR_INCR],
            ['bin' => 'id', 'op' => Aerospike::OPERATOR_READ]];

        $status = $this->db->operate($key, $op, $r);

        if ($status == 0)
        {
            return $r['id'];
        }
        else
        {
            error_log("writes - " . $type . " - id");
            error_log("Error ". $this->db->errorno() . " : " . $this->db->error());
            die();
        }
    }

    public function get($data)
    {
        $id = $this->db->initKey($data['bin'], $data['table'], $data['key']);
        $status = $this->db->get($id, $record);

        if ($status == Aerospike::OK)
        {
            $record = $record['bins'];

            return $record;
        }
        else
        {
            // Log
            error_log($data['bin'] . " - " . $data['table'] . " - " . $data['key']);
            error_log("Error ". $this->db->errorno() . " : " . $this->db->error() . " : " . print_r ($id, true));
            return false;
        }
    }

    public function set($data, $record)
    {
        $id =  $this->db->initKey($data['bin'], $data['table'], $data['key']);
        $status = $this->db->put($id, $record);

        if ($status != Aerospike::OK)
        {
            // Log
            error_log($data['bin'] . " - " . $data['table'] . " - " . $data['key']);
            error_log("Error ". $this->db->errorno() . " : " . $this->db->error() . "\n");
        }
    }

    public function delete($data)
    {
        $id = $this->db->initKey($data['bin'], $data['table'], $data['key']);

        $this->db->remove($id);
    }
}

Here is my aerospike conf:

# Aerospike database configuration file.

service {
    user root
    group root
    paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
    pidfile /var/run/aerospike/asd.pid
    service-threads 4
    transaction-queues 4
    transaction-threads-per-queue 4
    proto-fd-max 15000
}

logging {
    # Log file must be an absolute path.
    file /var/log/aerospike/aerospike.log {
        context any info
    }
}

network {
    service {
        address any
        port 3000
    }

    heartbeat {
        mode multicast
        address 239.1.99.222
        port 9918
        interface-address 10.101.45.27
        interval 150
        timeout 10
    }

    fabric {
        port 3001
    }

    info {
        port 3003
    }
}

namespace cache {
    memory-size 1G
    replication-factor 2
    storage-engine memory
    default-ttl 0

    storage-engine device {
        file /opt/aerospike/data/cache.dat
        filesize 1G
        data-in-memory true
        write-block-size 128K
    }
}

namespace geoip {
    memory-size 4G
    replication-factor 2
    default-ttl 30

    storage-engine device {
        file /opt/aerospike/data/geoip.dat
        filesize 4G
        data-in-memory true
    }
}

namespace sessions {
    memory-size 1G
    replication-factor 2
    default-ttl 30

    storage-engine device {
        file /opt/aerospike/data/sessions.dat
        filesize 2G
        data-in-memory false
    }
}

namespace writes {
    memory-size 1G
    replication-factor 1
    default-ttl 7

    storage-engine device {
        file /opt/aerospike/data/writes.dat
        filesize 4G
        data-in-memory false
    }
}

Build error on ubuntu-1404-trusty-v20150316 (gce)

Hello,

Looks like there is an issue building this extension on ubuntu-1404-trusty-v20150316 (Google Cloud). Basically the same goes for debian 8 also.

cmake . && make
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring for HHVM API version 20150212
-- Configuring done
-- Generating done
-- Build files have been written to: /root/aerospike-client-hhvm/src/aerospike
Scanning dependencies of target aerospike-hhvm
[ 20%] Building CXX object CMakeFiles/aerospike-hhvm.dir/main/ext_aerospike.cpp.o
In file included from /root/aerospike-client-hhvm/src/aerospike/include/batch_op_manager.h:11:0,
                 from /root/aerospike-client-hhvm/src/aerospike/main/ext_aerospike.cpp:9:
/usr/include/aerospike/aerospike_batch.h: In function ‘as_batch_read_record* as_batch_read_reserve(as_batch_read_records*)’:
/usr/include/aerospike/aerospike_batch.h:193:41: error: invalid conversion from ‘void*’ to ‘as_batch_read_record* {aka as_batch_read_record_s*}’ [-fpermissive]
  return as_vector_reserve(&records->list);
                                         ^
make[2]: *** [CMakeFiles/aerospike-hhvm.dir/main/ext_aerospike.cpp.o] Error 1
make[1]: *** [CMakeFiles/aerospike-hhvm.dir/all] Error 2
make: *** [all] Error 2

Any idea?

getMany empty records reference

Hello there, I am trying to run the example code for getMany and I bump into a problem,
The reference seems to be null, altho I am quite confident I have such records inside aerospike (proof below)

[Mon Nov  2 08:09:55 2015] [hphp] [18495:7fbe5e3ff700:1:000001] [] \nNotice: Undefined variable: records in getmany.php on line 14
<?php
$config = array("hosts"=>array(array("addr"=>"xxx.xxx.xxx.xxx", "port"=>3000)));
$db = new Aerospike($config);
if (!$db->isConnected()) {
   echo "Aerospike failed to connect[{$db->errorno()}]: {$db->error()}\n";
   exit(1);
}

$key1 = $db->initKey("devspace", "mysql_cache", 1234);
$key2 = $db->initKey("devspace", "mysql_cache", 1235); // this key does not exist
$key3 = $db->initKey("devspace", "mysql_cache", 1236);
$keys = array($key1, $key2, $key3);
$status = $db->getMany($keys, $records);
if ($status == Aerospike::OK) {
    var_dump($records);
} else {
    echo "[{$db->errorno()}] ".$db->error();
}

As you guess the var dump result is NULL
In Aerospike, however data seems to be there (just to be double sure I have data in both string and int:

aql> select * from devspace.mysql_cache where PK = '1236'
+-------------------------------+
| data                          |
+-------------------------------+
| "t":42,"several":"success"}]" |
+-------------------------------+
1 row in set (0.000 secs)

aql> select * from devspace.mysql_cache where PK = 1236
+-------------------------------+
| data                          |
+-------------------------------+
| "t":42,"several":"success"}]" |
+-------------------------------+
1 row in set (0.001 secs)

aql> select * from devspace.mysql_cache where PK = 1234
+------------------------------------+-----+------------------------------------+
| data                               | SEG | CRC                                |
+------------------------------------+-----+------------------------------------+
| "[{"alpha":1,"beta":"gamma","spli" | 2   | "dc142fc150e11576cd39b467b77e1d22" |
+------------------------------------+-----+------------------------------------+
1 row in set (0.000 secs)

aql> select * from devspace.mysql_cache where PK = '1234'
+------------------------------------+-----+------------------------------------+
| data                               | SEG | CRC                                |
+------------------------------------+-----+------------------------------------+
| "[{"alpha":1,"beta":"gamma","spli" | 2   | "dc142fc150e11576cd39b467b77e1d22" |
+------------------------------------+-----+------------------------------------+
1 row in set (0.001 secs)

PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
HipHop VM 3.9.1 (rel)
Aerospike- C Client: 3.1.16
HHVM API version 20150212

So yes, I am wondering anyone actually manage to get getMany to work or is it a general issue?
Thanks!

UPDATE
We got as far as understanding that this ONLY happens when HHVM is being prebuilt/cached/pre-anaylized ( http://hhvm.com/blog/4061/go-faster )
Also, running files through CLI causes no problems, but when you try from web (through fastcgi) and u 're using the hhvm pre-analyze approach (compiled *.hhbc file) , result is always NULL. Interesting is taht this problem is not happening to other functions, but it does happen to multiple (batch) functions -- getMany and existMany.

Extension is being loaded through config file as README required.

Any tips are welcome!

support for Centos 7 (Scientific Unix 7)

Hello, trying this client on Scientific Unix 7 (kernel is based off Centos 7) based on the write up I see only Ubuntu and Debian support for HHVM client (specific versions listed are "Currently tested on 64-bit Ubuntu 14.04 LTS against HHVM 3.7.2"

HHVM 3.7.2 and HHVM 3.8.2 does succeed on Centos 7 without a problem

Is there a plan to support Centos 7 OS and approximate timing for this... running master version of this client (aerospike-client-hhvm) with aerospike aerospike-server-community-3.5.14-el6 version and aerospike client c library ( 3.1.16 ) produce segment fault exception

below is HHVM issue regarding HHVM 3.7.2 (my hope is that support for this client will be enabled for higher versions of HHVM as this git repo is suggesting will happen)

below ticket has been canceled, issue was with the artifacts. fresh new git pull and checkout assemble binaries just fine.. issue is with aerospike-client-hhvm alone
facebook/hhvm#5692

Segmentation fault on connect

Hello,

The following crash occurs on connection attempt.

<?php
$config = array("hosts"=>array(array("addr"=>"127.0.0.1", "port"=>3000)));
$db = new Aerospike($config);
ProcessID: 21008
ThreadID: 7f69dc7ff700
ThreadPID: 21012
Name: /usr/bin/hhvm
Type: Segmentation fault
Runtime: hhvm
Version: tags/HHVM-3.7.2-0-gfc9f29b2799933d8215faaadfa83de722df64e26
DebuggerCount: 0
#0  strlen at /lib/x86_64-linux-gnu/libc.so.6:0
#1  __strdup at /lib/x86_64-linux-gnu/libc.so.6:0
#2  as_cluster_create at /root/aerospike-client-c/src/main/aerospike/as_cluster.c:778
#3  aerospike_connect at /root/aerospike-client-c/src/main/aerospike/aerospike.c:108
#4  HPHP::c_Aerospike_ni___construct(HPHP::ObjectData*, HPHP::Array const&, bool, HPHP::Variant const&) at /root/aerospike-client-hhvm/src/aerospike/main/ext_aerospike.cpp:254
#5  void HPHP::Native::callFunc<false, false>(HPHP::Func const*, void*, HPHP::TypedValue*, HPHP::TypedValue&) at /usr/bin/hhvm:0
#6  HPHP::TypedValue* HPHP::Native::methodWrapper<false, false>(HPHP::ActRec*) at /usr/bin/hhvm:0
#7  unsigned char* HPHP::dispatchImpl<false>() at /usr/bin/hhvm:0
#8  HPHP::enterVM(HPHP::ActRec*, HPHP::StackArgsState, HPHP::Resumable*, HPHP::ObjectData*) at bytecode.cpp:0
#9  HPHP::ExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::Func const*, HPHP::Variant const&, HPHP::ObjectData*, HPHP::Class*, HPHP::VarEnv*, HPHP::StringData*, HPHP::ExecutionContext::InvokeFlags) at /usr/bin/hhvm:0
#10 HPHP::ExecutionContext::invokeUnit(HPHP::TypedValue*, HPHP::Unit const*) at /usr/bin/hhvm:0
#11 HPHP::invoke_file(HPHP::String const&, bool, char const*) at builtin-functions.cpp:0
#12 HPHP::include_impl_invoke(HPHP::String const&, bool, char const*) at /usr/bin/hhvm:0
#13 HPHP::hphp_invoke(HPHP::ExecutionContext*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, HPHP::Array const&, HPHP::VRefParamValue const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool, bool, bool) at /usr/bin/hhvm:0
#14 HPHP::HttpRequestHandler::executePHPRequest(HPHP::Transport*, HPHP::RequestURI&, HPHP::SourceRootInfo&, bool) at /usr/bin/hhvm:0
#15 HPHP::HttpRequestHandler::handleRequest(HPHP::Transport*) at /usr/bin/hhvm:0
#16 HPHP::ServerWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::FastCGITransportTraits>::doJobImpl(std::shared_ptr<HPHP::FastCGIJob>, bool) at /usr/bin/hhvm:0
#17 HPHP::ServerWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::FastCGITransportTraits>::doJob(std::shared_ptr<HPHP::FastCGIJob>) at /usr/bin/hhvm:0
#18 HPHP::JobQueueWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::Server*, true, false, HPHP::JobQueueDropVMStack>::start() at /usr/bin/hhvm:0
#19 HPHP::AsyncFuncImpl::ThreadFunc(void*) at /usr/bin/hhvm:0
#20 HPHP::start_routine_wrapper(void*) at /usr/bin/hhvm:0
#21 start_thread at /lib/x86_64-linux-gnu/libpthread.so.0:0
#22 clone at /lib/x86_64-linux-gnu/libc.so.6:0

Environment is:
Ubuntu 14.04
Aerospike cluster version 3.5.14
Aerospike client library version 3.1.16
HHVM client version 0.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.