Skip to content

Commit

Permalink
XIONE-14127 WPE_ERR_ProcessCrash with function "__libc_do_syscall" (r…
Browse files Browse the repository at this point in the history
…dkcentral#5063)

* XIONE-14127 WPE_ERR_ProcessCrash with function "__libc_do_syscall"
DELIA-64762: WPE_ERR_ProcessCrash with function__libc_do_syscall
connectivity monitor thread termination changed

* XIONE-14127 WPE_ERR_ProcessCrash with function "__libc_do_syscall"
DELIA-64762: WPE_ERR_ProcessCrash with function__libc_do_syscall
connectivity monitor thread termination changed
  • Loading branch information
gururaajar authored Mar 26, 2024
1 parent 3f39499 commit 89913f4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 38 deletions.
5 changes: 5 additions & 0 deletions Network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ All notable changes to this RDK Service will be documented in this file.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.

## [1.3.6] - 2024-03-25
### Fixed
- Fixed WPE_ERR_ProcessCrash with function__libc_do_syscall
- Changed the connectivity monitor thread termination

## [1.3.5] - 2024-02-19
### Fixed
- Fixed Network connnectivity monitor crash during reboot
Expand Down
2 changes: 1 addition & 1 deletion Network/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ using namespace std;

#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 3
#define API_VERSION_NUMBER_PATCH 5
#define API_VERSION_NUMBER_PATCH 6

/* Netsrvmgr Based Macros & Structures */
#define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR"
Expand Down
2 changes: 1 addition & 1 deletion Network/Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ namespace WPEFramework {
static Network *_instance;
static Network *getInstance() {return _instance;}
Config config;
ConnectivityMonitor& connectivityMonitor = ConnectivityMonitor::getInstance();
ConnectivityMonitor connectivityMonitor;

private:
PluginHost::IShell* m_service;
Expand Down
59 changes: 29 additions & 30 deletions Network/NetworkConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ namespace WPEFramework {
#if LIBCURL_VERSION_NUM < 0x074200
int numfds, repeats = 0;
#endif
char *endpoint;
char *endpoint = nullptr;
while (1)
{
if (CURLM_OK != (mc = curl_multi_perform(curl_multi_handle, &handles)))
Expand All @@ -324,7 +324,7 @@ namespace WPEFramework {
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &endpoint);
if (curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &response_code) == CURLE_OK) {
if(curlVerboseEnabled())
LOGINFO("endpoint = <%s> response code <%d>",endpoint, static_cast<int>(response_code));
LOGINFO("endpoint = <%s> http response code <%d>", endpoint, static_cast<int>(response_code));
if (HttpStatus_302_Found == response_code) {
if ( (curl_easy_getinfo(msg->easy_handle, CURLINFO_REDIRECT_URL, &url) == CURLE_OK) && url != nullptr) {
//LOGWARN("captive portal found !!!");
Expand All @@ -333,8 +333,8 @@ namespace WPEFramework {
}
}
}
//else
// LOGERR("endpoint = <%s> error = %d (%s)", endpoint, msg->data.result, curl_easy_strerror(msg->data.result));
else
LOGERR("endpoint = <%s> curl error = %d (%s)", endpoint, msg->data.result, curl_easy_strerror(msg->data.result));
http_responses.push_back(response_code);
}
time_earlier = time_now;
Expand Down Expand Up @@ -429,7 +429,11 @@ namespace WPEFramework {
break;
default:
InternetConnectionState = NO_INTERNET;
LOGINFO("Internet State: NO_INTERNET Response code: <%d> %.1f%%", static_cast<int>(http_response_code), (percentage*100));
if(http_response_code == -1)
LOGERR("Internet State: NO_INTERNET curl error");
else
LOGWARN("Internet State: NO_INTERNET Received http response code: <%d> %.1f%%", static_cast<int>(http_response_code), percentage * 100);
break;
}
}

Expand Down Expand Up @@ -513,40 +517,40 @@ namespace WPEFramework {

bool ConnectivityMonitor::stopInitialConnectivityMonitoring()
{
if (isMonitorThreadRunning())

if(isContinuesMonitoringNeeded)
{
LOGWARN("Continuous Connectivity Monitor is running");
return true;
}
else
{
if(isContinuesMonitoringNeeded)
if (!isMonitorThreadRunning())
{
LOGWARN("Continuous Connectivity Monitor is running");
return true;
LOGWARN("Connectivity monitor not running");
}
else
{
stopFlag = true;
cv_.notify_all();

if (thread_.joinable()) {
thread_.join();
threadRunning = false;
LOGINFO("Stoping Initial Connectivity Monitor");
}
else
LOGWARN("thread not joinable !");
stopFlag = true;
cv_.notify_all();

if (thread_.joinable())
{
thread_.join();
threadRunning = false;
LOGINFO("Stoping Initial Connectivity Monitor");
}
else
LOGWARN("thread not joinable !");
}
else
LOGWARN("Continuous Connectivity Monitor not running");

return true;
}

bool ConnectivityMonitor::stopContinuousConnectivityMonitoring()
{
LOGINFO("Entry");
if (!isMonitorThreadRunning())
{
LOGWARN("Connectivity monitor not running");
return false;
}
cv_.notify_all();
stopFlag = true;
Expand Down Expand Up @@ -595,17 +599,12 @@ namespace WPEFramework {

if(stopFlag)
{
LOGWARN("stopFlag true exiting");
threadRunning = false;
break;
}
//wait for next timout or conditon signal
std::unique_lock<std::mutex> lock(mutex_);
if (cv_.wait_for(lock, std::chrono::seconds(timeout.load())) == std::cv_status::timeout)
{
LOGINFO("Connectivity monitor thread timeout");
}
else
if (cv_.wait_for(lock, std::chrono::seconds(timeout.load())) != std::cv_status::timeout)
{
if(!stopFlag)
{
Expand Down
7 changes: 1 addition & 6 deletions Network/NetworkConnectivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ namespace WPEFramework {

class ConnectivityMonitor : public Connectivity {
public:
static ConnectivityMonitor& getInstance() {
static ConnectivityMonitor instance;
return instance;
}

bool isConnectedToInternet(nsm_ipversion ipversion);
nsm_internetState getInternetConnectionState(nsm_ipversion ipversion);
std::string getCaptivePortalURI();
Expand All @@ -119,7 +114,6 @@ namespace WPEFramework {
void signalConnectivityMonitor();
void resetConnectivityCache() { g_internetState = nsm_internetState::UNKNOWN;}

private:
ConnectivityMonitor() : stopFlag(false), threadRunning(false), isContinuesMonitoringNeeded(false)
{
setConnectivityMonitorEndpoints(getConnectivityDefaultEndpoints());
Expand All @@ -129,6 +123,7 @@ namespace WPEFramework {
LOGINFO("~ConnectivityMonitor");
stopContinuousConnectivityMonitoring();
}
private:

std::vector<std::string> getConnectivityMonitorEndpoints();
ConnectivityMonitor(const ConnectivityMonitor&) = delete;
Expand Down

0 comments on commit 89913f4

Please sign in to comment.