aerospike-community / aerospike-client-php

Aerospike client for PHP7
Apache License 2.0
29 stars 28 forks source link

UDF aggregate execution error #56

Open ramunasd opened 4 years ago

ramunasd commented 4 years ago

We are getting error UDF: Execution Error 1 when UDF function is executed using method Aerospike->aggregate(). Lua functions on itself are correct and works perfectly when triggered using tool aql.

Here is how we enable log output:

$client->setLogHandler(function(){print_r(func_get_args());});
$client->setLogLevel(Aerospike::LOG_LEVEL_TRACE);
$client->aggregate(...);
var_dump($client->error(), $client->errorno());

And output:

Array
(
    [0] => 4
    [1] => apply_stream
    [2] => src/main/mod_lua.c
    [3] => 1232
)
Array
(
    [0] => 4
    [1] => apply_stream
    [2] => src/main/mod_lua.c
    [3] => 1235
)
Array
(
    [0] => 4
    [1] => poll_state
    [2] => src/main/mod_lua.c
    [3] => 620
)
Array
(
    [0] => 0
    [1] => create_state
    [2] => src/main/mod_lua.c
    [3] => 577

Array
(
    [0] => 4
    [1] => poll_state
    [2] => src/main/mod_lua.c
    [3] => 629
)
Array
(
    [0] => 4
    [1] => apply_stream
    [2] => src/main/mod_lua.c
    [3] => 1239
)
string(22) "UDF: Execution Error 1"
int(100)
ramunasd commented 4 years ago

It would be very nice to get original error message. Currently only technical info(not very usefull) is provided here: https://github.com/aerospike/aerospike-client-php/blob/652bd9cb9776a39f07b403e79fecdf3abf8420a0/src/client/log_handlers.c#L82

dwelch-spike commented 4 years ago

Hi @ramunasd,

This could be a udf registration issue. Stream udfs require that the udf is registered with both the server and the client. Please see this similar issue and the php client example.

https://discuss.aerospike.com/t/another-udf-error-100-debugging/3778 https://github.com/aerospike/aerospike-client-php/blob/master/examples/query_examples/aggregate.php

ramunasd commented 4 years ago

@dwelch-spike thanks for answer. Actually we tried to register functions right before aggregation but still no luck. Everythong works great from CLI even without single time register, while FPM fails almost every time.

ramunasd commented 4 years ago

@dwelch-spike would it possible to submit original error message to php error handler function as last parameter? This would not be a breaking change since all other params stays in same order.