Loading cmds/dumpstate/DumpstateService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ binder::Status DumpstateService::startBugreport(int32_t calling_uid, if (ds_ != nullptr) { MYLOGE("Error! There is already a bugreport in progress. Returning."); if (listener != nullptr) { listener->onError(IDumpstateListener::BUGREPORT_ERROR_CONCURRENT_BUGREPORTS_FORBIDDEN); listener->onError(IDumpstateListener::BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS); } return exception(binder::Status::EX_SERVICE_SPECIFIC, "There is already a bugreport in progress"); Loading cmds/dumpstate/binder/android/os/IDumpstateListener.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ interface IDumpstateListener { const int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT = 4; /* There is currently a bugreport running. The caller should try again later. */ const int BUGREPORT_ERROR_CONCURRENT_BUGREPORTS_FORBIDDEN = 5; const int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS = 5; /** * Called on an error condition with one of the error codes listed above. Loading cmds/dumpstate/dumpstate.cpp +15 −3 Original line number Diff line number Diff line Loading @@ -766,6 +766,17 @@ status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, ZipWriter::ErrorCodeString(err)); return UNKNOWN_ERROR; } bool finished_entry = false; auto finish_entry = [this, &finished_entry] { if (!finished_entry) { // This should only be called when we're going to return an earlier error, // which would've been logged. This may imply the file is already corrupt // and any further logging from FinishEntry is more likely to mislead than // not. this->zip_writer_->FinishEntry(); } }; auto scope_guard = android::base::make_scope_guard(finish_entry); auto start = std::chrono::steady_clock::now(); auto end = start + timeout; struct pollfd pfd = {fd, POLLIN}; Loading @@ -782,11 +793,11 @@ status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, int rc = TEMP_FAILURE_RETRY(poll(&pfd, 1, time_left_ms())); if (rc < 0) { MYLOGE("Error in poll while adding from fd to zip entry %s:%s", entry_name.c_str(), strerror(errno)); MYLOGE("Error in poll while adding from fd to zip entry %s:%s\n", entry_name.c_str(), strerror(errno)); return -errno; } else if (rc == 0) { MYLOGE("Timed out adding from fd to zip entry %s:%s Timeout:%lldms", MYLOGE("Timed out adding from fd to zip entry %s:%s Timeout:%lldms\n", entry_name.c_str(), strerror(errno), timeout.count()); return TIMED_OUT; } Loading @@ -807,6 +818,7 @@ status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, } err = zip_writer_->FinishEntry(); finished_entry = true; if (err != 0) { MYLOGE("zip_writer_->FinishEntry(): %s\n", ZipWriter::ErrorCodeString(err)); return UNKNOWN_ERROR; Loading cmds/dumpstate/tests/dumpstate_smoke_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ TEST_F(DumpstateBinderTest, SimultaneousBugreportsNotAllowed) { EXPECT_FALSE(status.isOk()); WaitTillExecutionComplete(listener2.get()); EXPECT_EQ(listener2->getErrorCode(), IDumpstateListener::BUGREPORT_ERROR_CONCURRENT_BUGREPORTS_FORBIDDEN); IDumpstateListener::BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS); // Meanwhile the first call works as expected. Service should not die in this case. WaitTillExecutionComplete(listener1.get()); Loading cmds/dumpstate/utils.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,8 @@ DurationReporter::~DurationReporter() { if (log_only_) { MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC); } else { // TODO(124089395): Remove or rewrite when bugreport latency is fixed. MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC); // Use "Yoda grammar" to make it easier to grep|sort sections. printf("------ %.3fs was the duration of '%s' ------\n", (float)elapsed / NANOS_PER_SEC, title_.c_str()); Loading Loading
cmds/dumpstate/DumpstateService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ binder::Status DumpstateService::startBugreport(int32_t calling_uid, if (ds_ != nullptr) { MYLOGE("Error! There is already a bugreport in progress. Returning."); if (listener != nullptr) { listener->onError(IDumpstateListener::BUGREPORT_ERROR_CONCURRENT_BUGREPORTS_FORBIDDEN); listener->onError(IDumpstateListener::BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS); } return exception(binder::Status::EX_SERVICE_SPECIFIC, "There is already a bugreport in progress"); Loading
cmds/dumpstate/binder/android/os/IDumpstateListener.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ interface IDumpstateListener { const int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT = 4; /* There is currently a bugreport running. The caller should try again later. */ const int BUGREPORT_ERROR_CONCURRENT_BUGREPORTS_FORBIDDEN = 5; const int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS = 5; /** * Called on an error condition with one of the error codes listed above. Loading
cmds/dumpstate/dumpstate.cpp +15 −3 Original line number Diff line number Diff line Loading @@ -766,6 +766,17 @@ status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, ZipWriter::ErrorCodeString(err)); return UNKNOWN_ERROR; } bool finished_entry = false; auto finish_entry = [this, &finished_entry] { if (!finished_entry) { // This should only be called when we're going to return an earlier error, // which would've been logged. This may imply the file is already corrupt // and any further logging from FinishEntry is more likely to mislead than // not. this->zip_writer_->FinishEntry(); } }; auto scope_guard = android::base::make_scope_guard(finish_entry); auto start = std::chrono::steady_clock::now(); auto end = start + timeout; struct pollfd pfd = {fd, POLLIN}; Loading @@ -782,11 +793,11 @@ status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, int rc = TEMP_FAILURE_RETRY(poll(&pfd, 1, time_left_ms())); if (rc < 0) { MYLOGE("Error in poll while adding from fd to zip entry %s:%s", entry_name.c_str(), strerror(errno)); MYLOGE("Error in poll while adding from fd to zip entry %s:%s\n", entry_name.c_str(), strerror(errno)); return -errno; } else if (rc == 0) { MYLOGE("Timed out adding from fd to zip entry %s:%s Timeout:%lldms", MYLOGE("Timed out adding from fd to zip entry %s:%s Timeout:%lldms\n", entry_name.c_str(), strerror(errno), timeout.count()); return TIMED_OUT; } Loading @@ -807,6 +818,7 @@ status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, } err = zip_writer_->FinishEntry(); finished_entry = true; if (err != 0) { MYLOGE("zip_writer_->FinishEntry(): %s\n", ZipWriter::ErrorCodeString(err)); return UNKNOWN_ERROR; Loading
cmds/dumpstate/tests/dumpstate_smoke_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ TEST_F(DumpstateBinderTest, SimultaneousBugreportsNotAllowed) { EXPECT_FALSE(status.isOk()); WaitTillExecutionComplete(listener2.get()); EXPECT_EQ(listener2->getErrorCode(), IDumpstateListener::BUGREPORT_ERROR_CONCURRENT_BUGREPORTS_FORBIDDEN); IDumpstateListener::BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS); // Meanwhile the first call works as expected. Service should not die in this case. WaitTillExecutionComplete(listener1.get()); Loading
cmds/dumpstate/utils.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,8 @@ DurationReporter::~DurationReporter() { if (log_only_) { MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC); } else { // TODO(124089395): Remove or rewrite when bugreport latency is fixed. MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC); // Use "Yoda grammar" to make it easier to grep|sort sections. printf("------ %.3fs was the duration of '%s' ------\n", (float)elapsed / NANOS_PER_SEC, title_.c_str()); Loading