diff --git a/net/net-socket.cpp b/net/net-socket.cpp index fb53b89e66..935bc0a45d 100644 --- a/net/net-socket.cpp +++ b/net/net-socket.cpp @@ -54,7 +54,7 @@ const char *unix_socket_path(const char *directory, const char *owner, uint16_t static struct sockaddr_un path; if (snprintf(path.sun_path, sizeof(path.sun_path), "%s/%s/%d", directory, owner, port) >= sizeof(path.sun_path)) { - vkprintf(4, "Too long UNIX socket path: \"%s/%s/%d\": %zu bytes exceeds\n", directory, owner, port, sizeof(path.sun_path)); + kprintf("Too long UNIX socket path: \"%s/%s/%d\": %zu bytes exceeds\n", directory, owner, port, sizeof(path.sun_path)); return NULL; } @@ -68,13 +68,13 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c struct passwd *passwd = getpwnam(username); if (!passwd) { - vkprintf(4, "Cannot getpwnam() for %s: %s\n", username, strerror(errno)); + vkprintf(1, "Cannot getpwnam() for %s: %s\n", username, strerror(errno)); return -1; } struct group *group = getgrnam(groupname); if (!group) { - vkprintf(4, "Cannot getgrnam() for %s: %s\n", groupname, strerror(errno)); + vkprintf(1, "Cannot getgrnam() for %s: %s\n", groupname, strerror(errno)); return -1; } @@ -84,7 +84,7 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c vkprintf(4, "Trying to create UNIX socket directory: \"%s\"\n", directory); const mode_t dirmode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; if (mkdir(directory, dirmode) == -1 && errno != EEXIST) { - vkprintf(4, "Cannot mkdir() UNIX socket directory: \"%s\": %s\n", directory, strerror(errno)); + vkprintf(1, "Cannot mkdir() UNIX socket directory: \"%s\": %s\n", directory, strerror(errno)); return -1; } } @@ -93,7 +93,7 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c } if (dirfd == -1) { - vkprintf(4, "Cannot open() UNIX socket directory: \"%s\": %s\n", directory, strerror(errno)); + vkprintf(1, "Cannot open() UNIX socket directory: \"%s\": %s\n", directory, strerror(errno)); return -1; } @@ -101,7 +101,7 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c if (groupdirfd == -1) { if (errno == ENOENT) { if (mkdirat(dirfd, group->gr_name, S_IRUSR) == -1 && errno != EEXIST) { - vkprintf(4, "Cannot mkdirat() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); + vkprintf(1, "Cannot mkdirat() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); close(dirfd); return -1; } @@ -110,7 +110,7 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c } if (groupdirfd == -1) { - vkprintf(4, "Cannot openat() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); + vkprintf(1, "Cannot openat() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); close(dirfd); return -1; } @@ -118,7 +118,7 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c struct stat groupdirst; if (fstat(groupdirfd, &groupdirst) == -1) { - vkprintf(4, "Cannot fstatat() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); + vkprintf(1, "Cannot fstatat() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); close(groupdirfd); close(dirfd); return -1; @@ -126,7 +126,7 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c if (groupdirst.st_uid != passwd->pw_uid || groupdirst.st_gid != group->gr_gid) { if (fchown(groupdirfd, passwd->pw_uid, group->gr_gid)) { - vkprintf(4, "Cannot fchown() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); + vkprintf(1, "Cannot fchown() UNIX socket group directory: \"%s/%s\": %s\n", directory, groupname, strerror(errno)); close(groupdirfd); close(dirfd); return -1; @@ -136,7 +136,7 @@ int prepare_unix_socket_directory(const char *directory, const char *username, c const mode_t groupdirmode = S_IRWXU | S_IRGRP | S_IXGRP; if ((groupdirst.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)) != groupdirmode) { if (fchmod(groupdirfd, groupdirmode) == -1) { - vkprintf(4, "Cannot fchmod() UNIX socket owner directory: \"%s/%s\": %s\n", directory, username, strerror(errno)); + vkprintf(1, "Cannot fchmod() UNIX socket owner directory: \"%s/%s\": %s\n", directory, username, strerror(errno)); close(groupdirfd); close(dirfd); return -1; @@ -257,7 +257,7 @@ int server_socket(int port, struct in_addr in_addr, int backlog, int mode) { addr.sin_port = htons(port); addr.sin_addr = in_addr; if (bind(sfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { - vkprintf(4, "bind(%s:%d): %s\n", inet_ntoa(in_addr), port, strerror(errno)); + kprintf("bind(%s:%d): %s\n", inet_ntoa(in_addr), port, strerror(errno)); close(sfd); return -1; } @@ -270,7 +270,7 @@ int server_socket(int port, struct in_addr in_addr, int backlog, int mode) { addr.sin6_addr = in6addr_any; if (bind(sfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { - vkprintf(4, "bind(%s:%d): %s\n", inet_ntoa(in_addr), port, strerror(errno)); + kprintf("bind(%s:%d): %s\n", inet_ntoa(in_addr), port, strerror(errno)); close(sfd); return -1; } @@ -307,7 +307,7 @@ int server_socket_unix(const struct sockaddr_un *addr, int backlog, int mode) { unlink(addr->sun_path); if (bind(fd, (struct sockaddr *) addr, sizeof(*addr)) == -1) { - vkprintf(4, "bind(%s): %s\n", addr->sun_path, strerror(errno)); + kprintf("bind(%s): %s\n", addr->sun_path, strerror(errno)); close(fd); return -1; } @@ -407,7 +407,7 @@ int client_socket_unix(const struct sockaddr_un *addr, int mode) { socket_maximize_sndbuf(fd, 0); socket_maximize_rcvbuf(fd, 0); if (connect(fd, (struct sockaddr *) addr, sizeof(*addr)) == -1 && errno != EINPROGRESS) { - vkprintf(4, "Cannot connect() to \"%s\": %s\n", addr->sun_path, strerror(errno)); + kprintf("Cannot connect() to \"%s\": %s\n", addr->sun_path, strerror(errno)); close(fd); return -1; } diff --git a/net/net-tcp-rpc-client.cpp b/net/net-tcp-rpc-client.cpp index 8876b3796e..8375e76d43 100644 --- a/net/net-tcp-rpc-client.cpp +++ b/net/net-tcp-rpc-client.cpp @@ -238,7 +238,7 @@ int tcp_rpcc_parse_execute (struct connection *c) { } assert (rwm_fetch_lookup (&c->in, &D->packet_len, 4) == 4); if (D->packet_len <= 0 || (D->packet_len & 3) || (D->packet_len > TCP_RPCC_FUNC(c)->max_packet_len && TCP_RPCC_FUNC(c)->max_packet_len > 0)) { - tvkprintf(net_connections, 4, "error while parsing packet: bad packet length %d\n", D->packet_len); + kprintf("error while parsing packet: bad packet length %d\n", D->packet_len); c->status = conn_error; c->error = -1; return 0; @@ -250,7 +250,7 @@ int tcp_rpcc_parse_execute (struct connection *c) { continue; } if (D->packet_len < 16) { - tvkprintf(net_connections, 4, "error while parsing packet: bad packet length %d\n", D->packet_len); + kprintf("error while parsing packet: bad packet length %d\n", D->packet_len); c->status = conn_error; c->error = -1; return 0; @@ -273,7 +273,7 @@ int tcp_rpcc_parse_execute (struct connection *c) { assert (rwm_fetch_data_back (&msg, &crc32, 4) == 4); D->packet_crc32 = rwm_custom_crc32 (&msg, D->packet_len - 4, D->custom_crc_partial); if (crc32 != D->packet_crc32) { - tvkprintf(net_connections, 4, "error while parsing packet: crc32 = %08x != %08x\n", D->packet_crc32, crc32); + kprintf("error while parsing packet: crc32 = %08x != %08x\n", D->packet_crc32, crc32); c->status = conn_error; c->error = -1; rwm_free (&msg); @@ -291,7 +291,7 @@ int tcp_rpcc_parse_execute (struct connection *c) { int res = -1; if (D->packet_num != D->in_packet_num) { - tvkprintf(net_connections, 4, "error while parsing packet: got packet num %d, expected %d\n", D->packet_num, D->in_packet_num); + kprintf("error while parsing packet: got packet num %d, expected %d\n", D->packet_num, D->in_packet_num); c->status = conn_error; c->error = -1; rwm_free (&msg); diff --git a/server/php-engine.cpp b/server/php-engine.cpp index cca6f2537a..a1a0c62992 100644 --- a/server/php-engine.cpp +++ b/server/php-engine.cpp @@ -542,7 +542,7 @@ int hts_func_execute(connection *c, int op) { return -501; } - vkprintf (1, "start https execute: connection #%d, op=%d, header_size=%d, data_size=%d, http_version=%d\n", + vkprintf (1, "start http server execute: connection #%d, op=%d, header_size=%d, data_size=%d, http_version=%d\n", c->fd, op, D->header_size, D->data_size, D->http_ver); if (!vk::any_of_equal(D->query_type, htqt_get, htqt_post, htqt_head)) { @@ -890,7 +890,7 @@ static void send_rpc_error(connection *c, long long req_id, int error_code, cons } int rpcx_execute(connection *c, int op, raw_message *raw) { - vkprintf(1, "rpc execute: fd=%d, op=%d, len=%d\n", c->fd, op, raw->total_bytes); + vkprintf(2, "rpc execute: fd=%d, op=%d, len=%d\n", c->fd, op, raw->total_bytes); int len = raw->total_bytes; diff --git a/server/php-master.cpp b/server/php-master.cpp index eec4f91038..795794881c 100644 --- a/server/php-master.cpp +++ b/server/php-master.cpp @@ -370,7 +370,7 @@ int changed = 0; int failed = 0; int socket_fd = -1; int to_exit = 0; -int general_worker_to_kill = 0, general_worker_to_run = 0; +int general_workers_to_kill = 0, general_workers_to_run = 0; int job_workers_to_kill = 0, job_workers_to_run = 0; long long generation; int receive_fd_attempts_cnt = 0; @@ -1173,7 +1173,7 @@ int php_master_http_execute(struct connection *c, int op) { void run_master_off_in_graceful_shutdown() { kprintf("master off in graceful shutdown\n"); assert(state == master_state::off_in_graceful_shutdown); - general_worker_to_kill = vk::singleton::get().get_running_count(WorkerType::general_worker); + general_workers_to_kill = vk::singleton::get().get_running_count(WorkerType::general_worker); if (all_http_workers_killed()) { if (all_job_workers_killed()) { to_exit = 1; @@ -1198,7 +1198,7 @@ void run_master_off_in_graceful_restart() { if (other->to_kill_generation > me->generation) { // old master kills as many workers as new master told - general_worker_to_kill = other->to_kill; + general_workers_to_kill = other->to_kill; } if (all_http_workers_killed()) { @@ -1298,7 +1298,7 @@ void run_master_on() { if (done) { const auto &control = vk::singleton::get(); const int total_workers = control.get_alive_count(WorkerType::general_worker) + (other->is_alive ? other->running_http_workers_n + other->dying_http_workers_n : 0); - general_worker_to_run = std::max(0, int{control.get_count(WorkerType::general_worker)} - total_workers); + general_workers_to_run = std::max(0, int{control.get_count(WorkerType::general_worker)} - total_workers); job_workers_to_run = control.get_count(WorkerType::job_worker) - control.get_alive_count(WorkerType::job_worker); if (other->is_alive) { @@ -1360,7 +1360,6 @@ void check_and_instance_cache_try_swap_memory() { } static void cron() { - tvkprintf(master_process, 2, "master process cron work\n"); if (!other->is_alive || in_old_master_on_restart()) { // write stats at the beginning to avoid spikes in graphs send_data_to_statsd_with_prefix(vk::singleton::get().get_statsd_prefix(), stats_tag_kphp_server); @@ -1407,6 +1406,12 @@ static void cron() { instance_cache_purge_expired_elements(); check_and_instance_cache_try_swap_memory(); confdata_binlog_update_cron(); + tvkprintf(master_process, 3, "master process cron work [utime = %llu, stime = %llu, alive_workers_count = %d]. " + "General workers details [running general workers = %d, waiting general workers = %d, ready for accept general workers = %d]. " + "Job workers details [running job workers = %d, waiting job workers = %d, ready for accept job workers = %d].\n", + utime, stime, alive_workers_count, + general_workers_stat.running_workers, general_workers_stat.waiting_workers, general_workers_stat.ready_for_accept_workers, + job_workers_stat.running_workers, job_workers_stat.waiting_workers, job_workers_stat.ready_for_accept_workers); } auto get_steady_tp_ms_now() noexcept { @@ -1473,7 +1478,7 @@ WorkerType run_master() { changed = 0; failed = 0; to_exit = 0; - general_worker_to_kill = general_worker_to_run = 0; + general_workers_to_kill = general_workers_to_run = 0; job_workers_to_kill = job_workers_to_run = 0; update_workers(); @@ -1513,24 +1518,25 @@ WorkerType run_master() { me->generation = generation; - if (general_worker_to_kill != 0 || general_worker_to_run != 0 || job_workers_to_kill != 0 || job_workers_to_run != 0) { - tvkprintf(master_process, 2, "[general_worker_to_kill = %d] [general_worker_to_run = %d] [job_workers_to_kill = %d] [job_workers_to_run = %d]\n", - general_worker_to_kill, general_worker_to_run, job_workers_to_kill, job_workers_to_run); + if (general_workers_to_kill != 0 || general_workers_to_run != 0 || job_workers_to_kill != 0 || job_workers_to_run != 0) { + tvkprintf(master_process, 2, "[general_workers_to_kill = %d] [general_workers_to_run = %d] [job_workers_to_kill = %d] [job_workers_to_run = %d]\n", + general_workers_to_kill, general_workers_to_run, job_workers_to_kill, job_workers_to_run); } for (int i = 0; i < job_workers_to_kill; ++i) { kill_worker(WorkerType::job_worker); } - for (int i = 0; i < job_workers_to_run; ++i) { + for (int i = 0; i < job_workers_to_run && !failed; ++i) { if (run_worker(WorkerType::job_worker)) { + tvkprintf(job_workers, 1, "launched new job worker with pid = %d\n", pid); return WorkerType::job_worker; } } - for (int i = 0; i < general_worker_to_kill; ++i) { + for (int i = 0; i < general_workers_to_kill; ++i) { kill_worker(WorkerType::general_worker); } - for (int i = 0; i < general_worker_to_run; ++i) { + for (int i = 0; i < general_workers_to_run && !failed; ++i) { if (run_worker(WorkerType::general_worker)) { return WorkerType::general_worker; } diff --git a/server/php-runner.cpp b/server/php-runner.cpp index 7712d33558..91d5791fe3 100644 --- a/server/php-runner.cpp +++ b/server/php-runner.cpp @@ -35,7 +35,7 @@ #include "server/server-stats.h" #include "server/signal-handlers.h" -DEFINE_VERBOSITY(php_code); +DEFINE_VERBOSITY(php_runner); query_stats_t query_stats; long long query_stats_id = 1; @@ -145,7 +145,7 @@ PhpScript::PhpScript(size_t mem_size, double oom_handling_memory_ratio, size_t s , oom_handling_memory_ratio(oom_handling_memory_ratio) , run_mem(static_cast(mmap(nullptr, mem_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0))) , script_stack(stack_size) { - tvkprintf(php_code, 1, "initialize PHP-script\n"); + tvkprintf(php_runner, 1, "initialize PHP-script\n"); // fprintf (stderr, "PHPScriptBase: constructor\n"); // fprintf (stderr, "[%p -> %p] [%p -> %p]\n", run_stack, run_stack_end, run_mem, run_mem + mem_size); } @@ -314,18 +314,11 @@ void PhpScript::finish() noexcept { kphp_tracing::on_php_script_finish_terminated(); } - if (save_state == run_state_t::error) { - switch (error_type) { - case script_error_t::memory_limit: - kprintf("Detailed memory stats: total allocations = %zd, total memory allocated = %zd, huge memory pieces = %zd, small memory pieces = %zd, defragmentation calls = %zd\n", - script_mem_stats.total_allocations, script_mem_stats.total_memory_allocated, script_mem_stats.huge_memory_pieces, script_mem_stats.small_memory_pieces, script_mem_stats.defragmentation_calls); - break; - case script_error_t::timeout: - kprintf("Script timeout value = %d\n", script_timeout); - break ; - default: - break; - } + if (error_type == script_error_t::memory_limit || script_mem_stats.real_memory_used > max_memory / 2) { + kprintf("Detailed memory stats: total allocations = %zd, total memory allocated = %zd, huge memory pieces = %zd, small memory pieces = %zd, defragmentation calls = %zd," + "real memory used = %zd, max real memory used = %zd, memory used = %zd, max memory used = %zd, memory_limit = %zd\n", + script_mem_stats.total_allocations, script_mem_stats.total_memory_allocated, script_mem_stats.huge_memory_pieces, script_mem_stats.small_memory_pieces, script_mem_stats.defragmentation_calls, + script_mem_stats.real_memory_used, script_mem_stats.max_real_memory_used, script_mem_stats.memory_used, script_mem_stats.max_memory_used, script_mem_stats.memory_limit); } const size_t buf_size = 5000; diff --git a/server/php-runner.h b/server/php-runner.h index aeb519bf38..eef7ec6d3f 100644 --- a/server/php-runner.h +++ b/server/php-runner.h @@ -17,7 +17,7 @@ #include "server/php-query-data.h" #include "server/ucontext-portable.h" -DECLARE_VERBOSITY(php_code); +DECLARE_VERBOSITY(php_runner); enum class run_state_t { finished, diff --git a/server/php-worker.cpp b/server/php-worker.cpp index 77844c253c..aae5ef366f 100644 --- a/server/php-worker.cpp +++ b/server/php-worker.cpp @@ -32,7 +32,8 @@ double PhpWorker::enter_lifecycle() noexcept { } on_wakeup(); - tvkprintf(php_code, 3, "PHP-worker lifecycle [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 3, "PHP-worker [state = %d, php-script state = %d, conn status = %d] lifecycle [req_id = %016llx]\n", + state, php_script ? static_cast(php_script->state) : -1, conn->status, req_id); paused = false; do { switch (state) { @@ -59,7 +60,8 @@ double PhpWorker::enter_lifecycle() noexcept { get_utime_monotonic(); } while (!paused); - tvkprintf(php_code, 3, "PHP-worker return in net reactor [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 3, "PHP-worker [state = %d, php-script state = %d, conn status = %d] return in net reactor [req_id = %016llx]\n", + state, php_script ? static_cast(php_script->state) : -1, conn->status, req_id); assert(conn->status == conn_wait_net); return get_timeout(); } @@ -86,14 +88,14 @@ void PhpWorker::on_wakeup() noexcept { } void PhpWorker::state_try_start() noexcept { - tvkprintf(php_code, 1, "PHP-worker try start [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 1, "PHP-worker try start [req_id = %016llx]\n", req_id); if (terminate_flag) { state = phpq_finish; return; } if (php_worker_run_flag) { // put connection into pending_http_query - tvkprintf(php_code, 2, "PHP-worker is waiting [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 2, "PHP-worker is waiting [req_id = %016llx]\n", req_id); auto *pending_q = reinterpret_cast(malloc(sizeof(conn_query))); @@ -138,7 +140,7 @@ void PhpWorker::state_init_script() noexcept { get_utime_monotonic(); start_time = precise_now; - tvkprintf(php_code, 1, "init PHP-script inside PHP-worker [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 1, "init PHP-script inside PHP-worker [req_id = %016llx]\n", req_id); assert(active_worker == nullptr); active_worker = this; vk::singleton::get().set_running_worker_status(); @@ -205,11 +207,11 @@ void php_worker_run_net_queue(PhpWorker *worker __attribute__((unused))) { } void PhpWorker::state_run() noexcept { - tvkprintf(php_code, 3, "execute PHP-worker [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 3, "execute PHP-worker [req_id = %016llx]\n", req_id); int f = 1; while (f) { if (terminate_flag) { - tvkprintf(php_code, 1, "PHP-worker terminate PHP-script [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 1, "PHP-worker terminate PHP-script [req_id = %016llx]\n", req_id); php_script->terminate(error_message, terminate_reason); } @@ -222,12 +224,12 @@ void PhpWorker::state_run() noexcept { paused = true; vk::singleton::get().set_wait_net_worker_status(); conn->status = conn_wait_net; - tvkprintf(php_code, 3, "PHP-script delayed due to net event [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 3, "PHP-script delayed due to net event [req_id = %016llx]\n", req_id); break; } - tvkprintf(php_code, 3, "PHP-worker before swap context [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 3, "PHP-worker before swap context [req_id = %016llx]\n", req_id); php_script->iterate(); - tvkprintf(php_code, 3, "PHP-worker after swap context [req_id = %016llx]\n", req_id);; + tvkprintf(php_runner, 3, "PHP-worker after swap context [req_id = %016llx]\n", req_id);; wait(0); // check for net events break; } @@ -237,24 +239,24 @@ void PhpWorker::state_run() noexcept { paused = true; vk::singleton::get().set_wait_net_worker_status(); conn->status = conn_wait_net; - tvkprintf(php_code, 3, "PHP-worker delay query due to net events [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 3, "PHP-worker delay query due to net events [req_id = %016llx]\n", req_id); break; } - tvkprintf(php_code, 2, "PHP-worker run query %016llx [req_id = %016llx]\n", query_stats_id, req_id); + tvkprintf(php_runner, 2, "PHP-worker run query %016llx [req_id = %016llx]\n", query_stats_id, req_id); run_query(); php_worker_run_net_queue(this); wait(0); // check for net events break; } case run_state_t::query_running: { - tvkprintf(php_code, 2, "PHP-worker paused due to query [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 2, "PHP-worker paused due to query [req_id = %016llx]\n", req_id); f = 0; paused = true; vk::singleton::get().set_wait_net_worker_status(); break; } case run_state_t::error: { - tvkprintf(php_code, 1, "PHP-worker catch error [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 1, "PHP-worker catch error [req_id = %016llx]\n", req_id); if (dl::is_malloc_replaced()) { // in case the error happened when malloc was replaced dl::rollback_malloc_replacement(); @@ -291,7 +293,7 @@ void PhpWorker::state_run() noexcept { break; } case run_state_t::finished: { - tvkprintf(php_code, 1, "PHP-worker finish PHP-script [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 1, "PHP-worker finish PHP-script [req_id = %016llx]\n", req_id); script_result *res = php_script->res; set_result(res); php_script->finish(); @@ -316,7 +318,7 @@ void PhpWorker::wait(int timeout_ms) noexcept { int new_net_events_cnt = epoll_fetch_events(0); // TODO: maybe we have to wait for timers too if (epoll_event_heap_size() > 0) { - tvkprintf(php_code, 3, "PHP-worker paused for nonblocking net activity [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 3, "PHP-worker paused for nonblocking net activity [req_id = %016llx]\n", req_id); wakeup(); return; } else { @@ -327,7 +329,7 @@ void PhpWorker::wait(int timeout_ms) noexcept { if (!net_events_empty()) { waiting = 0; } else { - tvkprintf(php_code, 3, "PHP-worker paused for blocking net activity [req_id = %016llx] [timeout = %.3lf]\n", req_id, timeout_ms * 0.001); + tvkprintf(php_runner, 3, "PHP-worker paused for blocking net activity [req_id = %016llx] [timeout = %.3lf]\n", req_id, timeout_ms * 0.001); wakeup_time = get_utime_monotonic() + timeout_ms * 0.001; } } @@ -393,7 +395,7 @@ void PhpWorker::state_free_script() noexcept { assert(active_worker == this); active_worker = nullptr; - tvkprintf(php_code, 1, "PHP-worker free PHP-script [query worked = %.5lf] [query waited for start = %.5lf] [req_id = %016llx]\n", worked, waited, req_id); + tvkprintf(php_runner, 1, "PHP-worker free PHP-script [query worked = %.5lf] [query waited for start = %.5lf] [req_id = %016llx]\n", worked, waited, req_id); vk::singleton::get().set_idle_worker_status(); if (mode == once_worker) { static int left = run_once_count; @@ -465,7 +467,7 @@ PhpWorker::PhpWorker(php_worker_mode_t mode_, connection *c, http_query_data *ht } else { target_fd = -1; } - tvkprintf(php_code, 1, "initialize PHP-worker [req_id = %016llx]\n", req_id); + tvkprintf(php_runner, 1, "initialize PHP-worker [req_id = %016llx]\n", req_id); } PhpWorker::~PhpWorker() {