Commit 02ed49d8 authored by gejun's avatar gejun

Patch svn r35199

parent 1c838757
...@@ -21,7 +21,7 @@ DEFINE_int32(attachment_size, 0, "Carry so many byte attachment along with reque ...@@ -21,7 +21,7 @@ DEFINE_int32(attachment_size, 0, "Carry so many byte attachment along with reque
DEFINE_int32(request_size, 16, "Bytes of each request"); DEFINE_int32(request_size, 16, "Bytes of each request");
DEFINE_string(connection_type, "", "Connection type. Available values: single, pooled, short"); DEFINE_string(connection_type, "", "Connection type. Available values: single, pooled, short");
DEFINE_string(protocol, "baidu_std", "Protocol type. Defined in protocol/brpc/options.proto"); DEFINE_string(protocol, "baidu_std", "Protocol type. Defined in protocol/brpc/options.proto");
DEFINE_string(starting_server, "0.0.0.0:8014", "IP Address of the first server, port of i-th server is `first-port + i'"); DEFINE_string(starting_server, "0.0.0.0:8114", "IP Address of the first server, port of i-th server is `first-port + i'");
DEFINE_string(load_balancer, "rr", "Name of load balancer"); DEFINE_string(load_balancer, "rr", "Name of load balancer");
DEFINE_int32(timeout_ms, 100, "RPC timeout in milliseconds"); DEFINE_int32(timeout_ms, 100, "RPC timeout in milliseconds");
DEFINE_int32(backup_ms, -1, "backup timeout in milliseconds"); DEFINE_int32(backup_ms, -1, "backup timeout in milliseconds");
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "echo.pb.h" #include "echo.pb.h"
DEFINE_bool(echo_attachment, true, "Echo attachment as well"); DEFINE_bool(echo_attachment, true, "Echo attachment as well");
DEFINE_int32(port, 8014, "TCP Port of this server"); DEFINE_int32(port, 8114, "TCP Port of this server");
DEFINE_int32(idle_timeout_s, -1, "Connection will be closed if there is no " DEFINE_int32(idle_timeout_s, -1, "Connection will be closed if there is no "
"read/write operations during the last `idle_timeout_s'"); "read/write operations during the last `idle_timeout_s'");
DEFINE_int32(logoff_ms, 2000, "Maximum duration of server's LOGOFF state " DEFINE_int32(logoff_ms, 2000, "Maximum duration of server's LOGOFF state "
......
...@@ -581,7 +581,7 @@ void Controller::OnVersionedRPCReturned(const CompletionInfo& info, ...@@ -581,7 +581,7 @@ void Controller::OnVersionedRPCReturned(const CompletionInfo& info,
END_OF_RPC: END_OF_RPC:
if (new_bthread) { if (new_bthread) {
// [Essential for -usercode_in_pthread=true, nice to have otherwise] // [ Essential for -usercode_in_pthread=true ]
// When -usercode_in_pthread is on, the reserved threads (set by // When -usercode_in_pthread is on, the reserved threads (set by
// -usercode_backup_threads) may all block on bthread_id_lock in // -usercode_backup_threads) may all block on bthread_id_lock in
// ProcessXXXResponse(), until the id is unlocked or destroyed which // ProcessXXXResponse(), until the id is unlocked or destroyed which
...@@ -591,8 +591,24 @@ END_OF_RPC: ...@@ -591,8 +591,24 @@ END_OF_RPC:
// Make the id unlockable before creating the bthread fixes the issue. // Make the id unlockable before creating the bthread fixes the issue.
// When -usercode_in_pthread is false, this also removes some useless // When -usercode_in_pthread is false, this also removes some useless
// waiting of the bthreads processing responses. // waiting of the bthreads processing responses.
bthread_id_about_to_destroy(info.id);
// Note[_done]: callid is destroyed after _done which possibly takes
// a lot of time, stop useless locking
// Note[cid]: When the callid needs to be destroyed in done->Run(),
// it does not mean that it will be destroyed directly in done->Run(),
// conversely the callid may still be locked/unlocked for many times
// before destroying. E.g. in slective channel, the callid is referenced
// by multiple sub-done and only destroyed by the last one. Calling
// bthread_id_about_to_destroy right here which makes the id unlockable
// anymore, is wrong. On the other hand, the combo channles setting
// FLAGS_DESTROY_CID_IN_DONE to true must be aware of
// -usercode_in_pthread and avoid deadlock by their own (TBR)
if ((FLAGS_usercode_in_pthread || _done != NULL/*Note[_done]*/) &&
!has_flag(FLAGS_DESTROY_CID_IN_DONE)/*Note[cid]*/) {
bthread_id_about_to_destroy(info.id);
}
// No need to join this bthread since RPC caller won't wake up // No need to join this bthread since RPC caller won't wake up
// (or user's done won't be called) until this bthread finishes // (or user's done won't be called) until this bthread finishes
bthread_t bt; bthread_t bt;
...@@ -605,9 +621,8 @@ END_OF_RPC: ...@@ -605,9 +621,8 @@ END_OF_RPC:
LOG(FATAL) << "Fail to start bthread"; LOG(FATAL) << "Fail to start bthread";
EndRPC(info); EndRPC(info);
} else { } else {
if (_done != NULL) { if (_done != NULL/*Note[_done]*/ &&
// [Optional] _done possibly takes a lot of time, stop !has_flag(FLAGS_DESTROY_CID_IN_DONE)/*Note[cid]*/) {
// useless locking.
bthread_id_about_to_destroy(info.id); bthread_id_about_to_destroy(info.id);
} }
EndRPC(info); EndRPC(info);
...@@ -809,14 +824,14 @@ void Controller::EndRPC(const CompletionInfo& info) { ...@@ -809,14 +824,14 @@ void Controller::EndRPC(const CompletionInfo& info) {
// Join is not signalled when the done does not Run() and the done // Join is not signalled when the done does not Run() and the done
// can't Run() because all backup threads are blocked by Join(). // can't Run() because all backup threads are blocked by Join().
// Call OnRPCEnd for async RPC. The one for sync RPC is called in
// Channel::CallMethod to count in latency of the context-switch.
OnRPCEnd(base::gettimeofday_us()); OnRPCEnd(base::gettimeofday_us());
const bool destroy_cid_in_done = has_flag(FLAGS_DESTROY_CID_IN_DONE); const bool destroy_cid_in_done = has_flag(FLAGS_DESTROY_CID_IN_DONE);
_done->Run(); _done->Run();
// NOTE: Don't touch this Controller anymore, because it's likely to be // NOTE: Don't touch this Controller anymore, because it's likely to be
// deleted by done. // deleted by done.
if (!destroy_cid_in_done) { if (!destroy_cid_in_done) {
// Make this thread not scheduling itself when launching new
// bthreads, saving signalings.
// FIXME: We're assuming the calling thread is about to quit. // FIXME: We're assuming the calling thread is about to quit.
bthread_about_to_quit(); bthread_about_to_quit();
CHECK_EQ(0, bthread_id_unlock_and_destroy(saved_cid)); CHECK_EQ(0, bthread_id_unlock_and_destroy(saved_cid));
...@@ -825,8 +840,10 @@ void Controller::EndRPC(const CompletionInfo& info) { ...@@ -825,8 +840,10 @@ void Controller::EndRPC(const CompletionInfo& info) {
RunUserCode(RunDoneInBackupThread, this); RunUserCode(RunDoneInBackupThread, this);
} }
} else { } else {
// OnRPCEnd() of sync RPC is called in the caller's thread. // OnRPCEnd for sync RPC is called in Channel::CallMethod to count in
// FIXME: We're assuming the calling thread is about to quit. // latency of the context-switch.
// Check comments in above branch on bthread_about_to_quit.
bthread_about_to_quit(); bthread_about_to_quit();
add_flag(FLAGS_DESTROYED_CID); add_flag(FLAGS_DESTROYED_CID);
CHECK_EQ(0, bthread_id_unlock_and_destroy(saved_cid)); CHECK_EQ(0, bthread_id_unlock_and_destroy(saved_cid));
...@@ -837,14 +854,13 @@ void Controller::RunDoneInBackupThread(void* arg) { ...@@ -837,14 +854,13 @@ void Controller::RunDoneInBackupThread(void* arg) {
} }
void Controller::DoneInBackupThread() { void Controller::DoneInBackupThread() {
// Call OnRPCEnd for async RPC. The one for sync RPC is called in // OnRPCEnd for sync RPC is called in Channel::CallMethod to count in
// Channel::CallMethod to count in latency of the context-switch. // latency of the context-switch.
OnRPCEnd(base::gettimeofday_us()); OnRPCEnd(base::gettimeofday_us());
const CallId saved_cid = _correlation_id; const CallId saved_cid = _correlation_id;
const bool destroy_cid_in_done = has_flag(FLAGS_DESTROY_CID_IN_DONE); const bool destroy_cid_in_done = has_flag(FLAGS_DESTROY_CID_IN_DONE);
_done->Run(); _done->Run();
// NOTE: Don't touch this Controller anymore, because it's likely to be // NOTE: Don't touch fields of controller anymore, it may be deleted.
// deleted by done.
if (!destroy_cid_in_done) { if (!destroy_cid_in_done) {
CHECK_EQ(0, bthread_id_unlock_and_destroy(saved_cid)); CHECK_EQ(0, bthread_id_unlock_and_destroy(saved_cid));
} }
...@@ -862,12 +878,11 @@ void Controller::SubmitSpan() { ...@@ -862,12 +878,11 @@ void Controller::SubmitSpan() {
void Controller::HandleSendFailed() { void Controller::HandleSendFailed() {
// NOTE: Must launch new thread to run the callback in an asynchronous // NOTE: Must launch new thread to run the callback in an asynchronous
// call. Users are likely to hold a lock before async CallMethod returns // call. Users may hold a lock before asynchronus CallMethod returns and
// and grab the same lock inside the callback. If we call the callback // grab the same lock inside done->Run(). If we call done->Run() in the
// on top of the same stack of CallMethod, we're deadlocked. // same stack of CallMethod, we're deadlocked.
// Sync call is opposite: We cannot run the callback with new thread // We don't need to run the callback with new thread in a sync call since
// in a sync call otherwise we can't leave CallMethod before the // the created thread needs to be joined anyway before CallMethod ends.
// callback is done.
if (!FailedInline()) { if (!FailedInline()) {
SetFailed("Must be SetFailed() before calling HandleSendFailed()"); SetFailed("Must be SetFailed() before calling HandleSendFailed()");
LOG(FATAL) << ErrorText(); LOG(FATAL) << ErrorText();
......
...@@ -490,6 +490,7 @@ private: ...@@ -490,6 +490,7 @@ private:
// Append server information to `_error_text' // Append server information to `_error_text'
void AppendServerIdentiy(); void AppendServerIdentiy();
// Used by ParallelChannel
static const int8_t CALLMETHOD_CANNOT_RUN_DONE = 0; static const int8_t CALLMETHOD_CANNOT_RUN_DONE = 0;
static const int8_t CALLMETHOD_CAN_RUN_DONE = 1; static const int8_t CALLMETHOD_CAN_RUN_DONE = 1;
static const int8_t CALLMETHOD_DID_RUN_DONE = 2; static const int8_t CALLMETHOD_DID_RUN_DONE = 2;
......
...@@ -556,8 +556,8 @@ bool MemcacheResponse::PopGet( ...@@ -556,8 +556,8 @@ bool MemcacheResponse::PopGet(
return false; return false;
} }
if (header.status != (uint16_t)STATUS_SUCCESS) { if (header.status != (uint16_t)STATUS_SUCCESS) {
LOG_IF(FATAL, header.extras_length != 0) << "GET response must not have flags"; LOG_IF(ERROR, header.extras_length != 0) << "GET response must not have flags";
LOG_IF(FATAL, header.key_length != 0) << "GET response must not have key"; LOG_IF(ERROR, header.key_length != 0) << "GET response must not have key";
const int value_size = (int)header.total_body_length - (int)header.extras_length const int value_size = (int)header.total_body_length - (int)header.extras_length
- (int)header.key_length; - (int)header.key_length;
if (value_size < 0) { if (value_size < 0) {
...@@ -690,8 +690,8 @@ bool MemcacheResponse::PopStore(uint8_t command, uint64_t* cas_value) { ...@@ -690,8 +690,8 @@ bool MemcacheResponse::PopStore(uint8_t command, uint64_t* cas_value) {
base::string_printf(&_err, "Not enough data"); base::string_printf(&_err, "Not enough data");
return false; return false;
} }
LOG_IF(FATAL, header.extras_length != 0) << "STORE response must not have flags"; LOG_IF(ERROR, header.extras_length != 0) << "STORE response must not have flags";
LOG_IF(FATAL, header.key_length != 0) << "STORE response must not have key"; LOG_IF(ERROR, header.key_length != 0) << "STORE response must not have key";
int value_size = (int)header.total_body_length - (int)header.extras_length int value_size = (int)header.total_body_length - (int)header.extras_length
- (int)header.key_length; - (int)header.key_length;
if (header.status != (uint16_t)STATUS_SUCCESS) { if (header.status != (uint16_t)STATUS_SUCCESS) {
...@@ -700,7 +700,7 @@ bool MemcacheResponse::PopStore(uint8_t command, uint64_t* cas_value) { ...@@ -700,7 +700,7 @@ bool MemcacheResponse::PopStore(uint8_t command, uint64_t* cas_value) {
_buf.cutn(&_err, value_size); _buf.cutn(&_err, value_size);
return false; return false;
} }
LOG_IF(FATAL, value_size != 0) << "STORE response must not have value, actually=" LOG_IF(ERROR, value_size != 0) << "STORE response must not have value, actually="
<< value_size; << value_size;
_buf.pop_front(sizeof(header) + header.total_body_length); _buf.pop_front(sizeof(header) + header.total_body_length);
if (cas_value) { if (cas_value) {
...@@ -855,8 +855,8 @@ bool MemcacheResponse::PopCounter( ...@@ -855,8 +855,8 @@ bool MemcacheResponse::PopCounter(
(unsigned)n, (unsigned)sizeof(header), header.total_body_length); (unsigned)n, (unsigned)sizeof(header), header.total_body_length);
return false; return false;
} }
LOG_IF(FATAL, header.extras_length != 0) << "INCR/DECR response must not have flags"; LOG_IF(ERROR, header.extras_length != 0) << "INCR/DECR response must not have flags";
LOG_IF(FATAL, header.key_length != 0) << "INCR/DECR response must not have key"; LOG_IF(ERROR, header.key_length != 0) << "INCR/DECR response must not have key";
const int value_size = (int)header.total_body_length - (int)header.extras_length const int value_size = (int)header.total_body_length - (int)header.extras_length
- (int)header.key_length; - (int)header.key_length;
_buf.pop_front(sizeof(header) + header.extras_length + header.key_length); _buf.pop_front(sizeof(header) + header.extras_length + header.key_length);
...@@ -975,8 +975,8 @@ bool MemcacheResponse::PopVersion(std::string* version) { ...@@ -975,8 +975,8 @@ bool MemcacheResponse::PopVersion(std::string* version) {
(unsigned)n, (unsigned)sizeof(header), header.total_body_length); (unsigned)n, (unsigned)sizeof(header), header.total_body_length);
return false; return false;
} }
LOG_IF(FATAL, header.extras_length != 0) << "VERSION response must not have flags"; LOG_IF(ERROR, header.extras_length != 0) << "VERSION response must not have flags";
LOG_IF(FATAL, header.key_length != 0) << "VERSION response must not have key"; LOG_IF(ERROR, header.key_length != 0) << "VERSION response must not have key";
const int value_size = (int)header.total_body_length - (int)header.extras_length const int value_size = (int)header.total_body_length - (int)header.extras_length
- (int)header.key_length; - (int)header.key_length;
_buf.pop_front(sizeof(header) + header.extras_length + header.key_length); _buf.pop_front(sizeof(header) + header.extras_length + header.key_length);
......
...@@ -127,8 +127,7 @@ public: ...@@ -127,8 +127,7 @@ public:
for (int i = 0; i < ndone; ++i) { for (int i = 0; i < ndone; ++i) {
new (d->sub_done(i)) SubDone; new (d->sub_done(i)) SubDone;
d->sub_done(i)->cntl.ApplyClientSettings(settings); d->sub_done(i)->cntl.ApplyClientSettings(settings);
d->sub_done(i)->cntl._run_done_state = d->sub_done(i)->cntl._run_done_state = Controller::CALLMETHOD_CAN_RUN_DONE;
Controller::CALLMETHOD_CAN_RUN_DONE;
} }
// Setup the map for finding sub_done of i-th sub_channel // Setup the map for finding sub_done of i-th sub_channel
if (ndone != nchan) { if (ndone != nchan) {
...@@ -271,7 +270,7 @@ public: ...@@ -271,7 +270,7 @@ public:
// [ Rendezvous point ] // [ Rendezvous point ]
// One and only one thread arrives here. // One and only one thread arrives here.
// all call_id of sub calls are destroyed and call_id of _cntl is // all call_id of sub calls are destroyed and call_id of _cntl is
// still locked (because of _destroy_cid_in_done = true); // still locked (because FLAGS_DESTROY_CID_IN_DONE is true);
// Merge responses of successful calls if fail_limit is not reached. // Merge responses of successful calls if fail_limit is not reached.
// nfailed may be increased during the merging. // nfailed may be increased during the merging.
......
...@@ -534,8 +534,8 @@ void ProcessRpcResponse(InputMessageBase* msg_base) { ...@@ -534,8 +534,8 @@ void ProcessRpcResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
if (meta.has_stream_settings()) { if (meta.has_stream_settings()) {
SendStreamRst(msg->socket(), meta.stream_settings().stream_id()); SendStreamRst(msg->socket(), meta.stream_settings().stream_id());
} }
......
...@@ -109,8 +109,8 @@ void ProcessEspResponse(InputMessageBase* msg_base) { ...@@ -109,8 +109,8 @@ void ProcessEspResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ", " << berror(rc); << "Fail to lock correlation_id=" << cid << ", " << berror(rc);
return; return;
} }
......
...@@ -213,8 +213,8 @@ void ProcessHttpResponse(InputMessageBase* msg) { ...@@ -213,8 +213,8 @@ void ProcessHttpResponse(InputMessageBase* msg) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -543,8 +543,8 @@ void ProcessHuluResponse(InputMessageBase* msg_base) { ...@@ -543,8 +543,8 @@ void ProcessHuluResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -134,8 +134,8 @@ void ProcessMemcacheResponse(InputMessageBase* msg_base) { ...@@ -134,8 +134,8 @@ void ProcessMemcacheResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -102,8 +102,8 @@ void ProcessNovaResponse(InputMessageBase* msg_base) { ...@@ -102,8 +102,8 @@ void ProcessNovaResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -93,8 +93,8 @@ void ProcessNsheadMcpackResponse(InputMessageBase* msg_base) { ...@@ -93,8 +93,8 @@ void ProcessNsheadMcpackResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -321,8 +321,8 @@ void ProcessNsheadResponse(InputMessageBase* msg_base) { ...@@ -321,8 +321,8 @@ void ProcessNsheadResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ", " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -155,8 +155,8 @@ void ProcessPublicPbrpcResponse(InputMessageBase* msg_base) { ...@@ -155,8 +155,8 @@ void ProcessPublicPbrpcResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -83,8 +83,8 @@ void ProcessRedisResponse(InputMessageBase* msg_base) { ...@@ -83,8 +83,8 @@ void ProcessRedisResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(FATAL, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -3463,8 +3463,8 @@ void OnServerStreamCreated::Run(bool error, ...@@ -3463,8 +3463,8 @@ void OnServerStreamCreated::Run(bool error,
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -474,8 +474,8 @@ void ProcessSofaResponse(InputMessageBase* msg_base) { ...@@ -474,8 +474,8 @@ void ProcessSofaResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -433,8 +433,8 @@ void ProcessUbrpcResponse(InputMessageBase* msg_base) { ...@@ -433,8 +433,8 @@ void ProcessUbrpcResponse(InputMessageBase* msg_base) {
Controller* cntl = NULL; Controller* cntl = NULL;
const int rc = bthread_id_lock(cid, (void**)&cntl); const int rc = bthread_id_lock(cid, (void**)&cntl);
if (rc != 0) { if (rc != 0) {
LOG_IF(FATAL, rc != EINVAL) << "Fail to lock correlation_id=" LOG_IF(ERROR, rc != EINVAL && rc != EPERM)
<< cid.value << ": " << berror(rc); << "Fail to lock correlation_id=" << cid << ": " << berror(rc);
return; return;
} }
......
...@@ -1333,7 +1333,7 @@ int RtmpStreamBase::SendAACMessage(const RtmpAACMessage& msg) { ...@@ -1333,7 +1333,7 @@ int RtmpStreamBase::SendAACMessage(const RtmpAACMessage& msg) {
return _rtmpsock->Write(msg2); return _rtmpsock->Write(msg2);
} }
int RtmpStreamBase::SendUserMessage(void* msg) { int RtmpStreamBase::SendUserMessage(void*) {
CHECK(false) << "You should implement your own SendUserMessage"; CHECK(false) << "You should implement your own SendUserMessage";
return 0; return 0;
} }
...@@ -1429,7 +1429,7 @@ void RtmpStreamBase::SignalError() { ...@@ -1429,7 +1429,7 @@ void RtmpStreamBase::SignalError() {
void RtmpStreamBase::OnFirstMessage() {} void RtmpStreamBase::OnFirstMessage() {}
void RtmpStreamBase::OnUserData(void* data) { void RtmpStreamBase::OnUserData(void*) {
LOG(INFO) << remote_side() << '[' << stream_id() LOG(INFO) << remote_side() << '[' << stream_id()
<< "] ignored UserData{}"; << "] ignored UserData{}";
} }
......
...@@ -324,7 +324,7 @@ void SubDone::Run() { ...@@ -324,7 +324,7 @@ void SubDone::Run() {
if (rc != 0) { if (rc != 0) {
// _cid must be valid because schan does not dtor before cancelling // _cid must be valid because schan does not dtor before cancelling
// all sub calls. // all sub calls.
LOG(FATAL) << "Fail to lock correlation_id=" LOG(ERROR) << "Fail to lock correlation_id="
<< _cid.value << ": " << berror(rc); << _cid.value << ": " << berror(rc);
return; return;
} }
......
...@@ -505,7 +505,7 @@ int Socket::ResetFileDescriptor(int fd) { ...@@ -505,7 +505,7 @@ int Socket::ResetFileDescriptor(int fd) {
// Make the fd non-blocking. // Make the fd non-blocking.
if (base::make_non_blocking(fd) != 0) { if (base::make_non_blocking(fd) != 0) {
PLOG(FATAL) << "Fail to set fd=" << fd << " to non-blocking"; PLOG(ERROR) << "Fail to set fd=" << fd << " to non-blocking";
return -1; return -1;
} }
// turn off nagling. // turn off nagling.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment