Skip to content

Commit

Permalink
add log about RPC errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDet committed Jul 25, 2023
1 parent 316e5f7 commit aed9f0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions runtime/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
#include "runtime/tl/rpc_server.h"
#include "runtime/tl/rpc_tl_query.h"
#include "runtime/tl/tl_builtins.h"
#include "runtime/tl/tl_magics_decoding.h"
#include "runtime/zlib.h"
#include "server/php-queries.h"

DEFINE_VERBOSITY(rpc);

static const int GZIP_PACKED = 0x3072cfa1;

const string tl_str_("");
Expand Down Expand Up @@ -816,8 +819,12 @@ void process_rpc_error(int32_t request_id, int32_t error_code, const char *error
php_assert (request->resumable_id != -1);
return;
}
if (!is_fake_error && kphp_tracing::is_turned_on()) {
kphp_tracing::on_rpc_query_fail(request_id, error_code);
if (!is_fake_error) {
tvkprintf(rpc, 1, "RPC error: error_code=%d, request_id=%d, tl_function=%s(0x%08x), actor_id=%d\n",
error_code, request_id, tl_magic_convert_to_name(request->function_magic), request->function_magic, request->actor_or_port);
if (kphp_tracing::is_turned_on()) {
kphp_tracing::on_rpc_query_fail(request_id, error_code);
}
}
int64_t resumable_id = request->resumable_id;
request->resumable_id = -2;
Expand Down
3 changes: 3 additions & 0 deletions runtime/rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include <memory>

#include "common/algorithms/hashes.h"
#include "common/kprintf.h"
#include "runtime/dummy-visitor-methods.h"
#include "runtime/kphp_core.h"
#include "runtime/net_events.h"
#include "runtime/resumable.h"
#include "runtime/to-array-processor.h"

DECLARE_VERBOSITY(rpc);

struct rpc_request {
int64_t resumable_id; // == 0 - default, > 0 if not finished, -1 if received an answer, -2 if received an error, -3 if answer was gotten
union {
Expand Down

0 comments on commit aed9f0d

Please sign in to comment.