Project

General

Profile

Bug #1314 » 0001-retry-to-send-stream-or-channel-to-ust-at-EAGAIN.patch

Heng Guo, 06/11/2021 05:08 AM

View differences:

src/bin/lttng-sessiond/ust-consumer.c
struct ust_app_channel *channel, struct ust_app_stream *stream)
{
int ret;
int retry = 0;
assert(app);
assert(stream);
......
DBG2("UST consumer send stream to app %d", app->sock);
again:
/* Relay stream to application. */
pthread_mutex_lock(&app->sock_lock);
ret = lttng_ust_ctl_send_stream_to_ust(app->sock, channel->obj, stream->obj);
......
} else {
DBG3("UST app send stream to ust failed. Application is dead.");
}
if ((ret == -EAGAIN) && (retry < DEFAULT_APP_SOCKET_RETRY_TIMES)) {
retry ++;
DBG("Retry to send stream to ust. sock:%d, retry:%d", app->sock, retry);
goto again;
}
goto error;
}
channel->handle = channel->obj->handle;
......
struct ust_app_session *ua_sess, struct ust_app_channel *channel)
{
int ret;
int retry = 0;
assert(app);
assert(ua_sess);
......
DBG2("UST app send channel to sock %d pid %d (name: %s, key: %" PRIu64 ")",
app->sock, app->pid, channel->name, channel->tracing_channel_id);
again:
/* Send stream to application. */
pthread_mutex_lock(&app->sock_lock);
ret = lttng_ust_ctl_send_channel_to_ust(app->sock, ua_sess->handle, channel->obj);
......
} else {
DBG3("UST app send channel to ust failed. Application is dead.");
}
if ((ret == -EAGAIN) && (retry < DEFAULT_APP_SOCKET_RETRY_TIMES)) {
retry ++;
DBG("Retry to send channel to ust. sock:%d, retry:%d", app->sock, retry);
goto again;
}
goto error;
}
src/common/defaults.h
#define DEFAULT_APP_SOCKET_RW_TIMEOUT CONFIG_DEFAULT_APP_SOCKET_RW_TIMEOUT
#define DEFAULT_APP_SOCKET_TIMEOUT_ENV "LTTNG_APP_SOCKET_TIMEOUT"
/*
* Default retry times of receiving and sending stream or channel to ust
* for an application socket.
*/
#define DEFAULT_APP_SOCKET_RETRY_TIMES 1
#define DEFAULT_UST_STREAM_FD_NUM 2 /* Number of fd per UST stream. */
#define DEFAULT_SNAPSHOT_NAME "snapshot"
(2-2/9)