Quantcast

Application freezes for 2-3 minutes after updating wxWidgets 3.0 to wxWidgets 3.1

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Application freezes for 2-3 minutes after updating wxWidgets 3.0 to wxWidgets 3.1

saptha.global
Hi team,

Since by mistake I posted new request in the below URL : https://forums.wxwidgets.org/viewtopic.php?f=1&t=43336.
Please ignore the same.

since I am posting regularly in this forum, please find the new request:


Hi Team,

Recently we moved out application from wx3.0 to wx3.1.
After merging wxWidgets 3.1 changes to our application, but after starting the application we observed that application is freezed for 2-3 minutes where it is trying to read socket data from the server. Here we are observing wxSOCKET_IOERR.

Please find the code snippet for your reference.

/*Structure describes the format of the after encoding "SocketMessage". 
The byte array to be sent through the socket*/
typedef struct dataPacket
{
u8* pucData; /*byte array*/
u32 uiSize; /*Size of the byte array*/
}SockData;

E_RETURNCODES ConfigClient::getAll(void)
{
wxSocketClient* m_pGetSetSocket;
u8 *pucSockData = NULL;
SocketMessage stMsg;
SockData stSocketData;
wxIPV4address stAddr;

if(false == stAddr.Hostname(wxT("localhost")))
{
m_pLogFile->logMessage(__FILE__,__LINE__,wxT("configClient:: Not able to set the address for port %d"), iPort);
}
if( false == stAddr.Service(iPort))
{
m_pLogFile->logMessage(__FILE__,__LINE__,wxT("configClient:: Not able to set the service for port %d"), iPort);
}
if (NULL == m_pGetSetSocket)
{
/* Create the socket*/
m_pGetSetSocket = new wxSocketClient(wxSOCKET_BLOCK | wxSOCKET_WAITALL);
if (NULL == m_pGetSetSocket)
{
logMessage(__FILE__,__LINE__,wxT("configClient:: Not able to create a new client socket due to insufficient memory"));
return E_RET_ERROR;
}
m_pGetSetSocket->Connect(stAddr,true); // connection is successful
if(m_pGetSetSocket->IsConnected() == TRUE) 
{
// returning TRUE
}
// we are writing GET_ALL_REQ to the server to read all the configuration parameters from the server.
m_pGetSetSocket->WriteMsg(stSocketData.pucData, stSocketData.uiSize); 
// we checked socket error status & it is returning 0, hence socket write is passing successfully.
if(m_pGetSetSocket->Error() == true)
{
logMessage(__FILE__,__LINE__,wxT("configClient::getAll().Socket Error while sending CONFIG_MSG_GET_ALL_REQ request"));
return E_RET_ERROR;
}
delete []stSocketData.pucData;
// next we are trying to read data
{
pucSockData = new u8[MAX_LEN];
if (NULL != pucSockData)
{
// its failing in below function & it takes 2-3 minutes for reading data & later returns wxSOCKET_IOERR
m_pGetSetSocket->ReadMsg(pucSockData, MAX_LEN);
if(m_pGetSetSocket->Error() == true)
{
m_pLogFile->logMessage(__FILE__,__LINE__,wxT("configClient::getAll().Socket Error while reading"));
delete []pucSockData;
return E_RET_ERROR;
}
}
}
}
}

Also we are not setting any socket flags (wxSOCKET_BLOCK | wxSOCKET_WAITALL) before reading or writing on socket.

We observed that WriteMsg() is returning wxSOCKET_NOERROR, but ReadMsg() is taking 2-3 minutes time to execute & then returns wxSOCKET_IOERR.
Kindly tell us if we are doing anything wrong and let us know how to reach out the root cause for wxSOCKET_IOERR. 
Please provide any debug pointers for the above case.

Regards,
Giri

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Application freezes for 2-3 minutes after updating wxWidgets 3.0 to wxWidgets 3.1

oneeyeman
Hi,

On Mon, Apr 10, 2017 at 4:55 AM,  <[hidden email]> wrote:

> Hi team,
>
> Since by mistake I posted new request in the below URL :
> https://forums.wxwidgets.org/viewtopic.php?f=1&t=43336.
> Please ignore the same.
>
> since I am posting regularly in this forum, please find the new request:
>
>
> Hi Team,
>
> Recently we moved out application from wx3.0 to wx3.1.
> After merging wxWidgets 3.1 changes to our application, but after starting
> the application we observed that application is freezed for 2-3 minutes
> where it is trying to read socket data from the server. Here we are
> observing wxSOCKET_IOERR.
>
> Please find the code snippet for your reference.
>
> /*Structure describes the format of the after encoding "SocketMessage".
> The byte array to be sent through the socket*/
> typedef struct dataPacket
> {
> u8* pucData; /*byte array*/
> u32 uiSize; /*Size of the byte array*/
> }SockData;
>
> E_RETURNCODES ConfigClient::getAll(void)
> {
> wxSocketClient* m_pGetSetSocket;
> u8 *pucSockData = NULL;
> SocketMessage stMsg;
> SockData stSocketData;
> wxIPV4address stAddr;
>
> if(false == stAddr.Hostname(wxT("localhost")))
> {
> m_pLogFile->logMessage(__FILE__,__LINE__,wxT("configClient:: Not able to set
> the address for port %d"), iPort);
> }
> if( false == stAddr.Service(iPort))
> {
> m_pLogFile->logMessage(__FILE__,__LINE__,wxT("configClient:: Not able to set
> the service for port %d"), iPort);
> }
> if (NULL == m_pGetSetSocket)
> {
> /* Create the socket*/
> m_pGetSetSocket = new wxSocketClient(wxSOCKET_BLOCK | wxSOCKET_WAITALL);
> if (NULL == m_pGetSetSocket)
> {
> logMessage(__FILE__,__LINE__,wxT("configClient:: Not able to create a new
> client socket due to insufficient memory"));
> return E_RET_ERROR;
> }
> m_pGetSetSocket->Connect(stAddr,true); // connection is successful
> if(m_pGetSetSocket->IsConnected() == TRUE)
> {
> // returning TRUE
> }
> // we are writing GET_ALL_REQ to the server to read all the configuration
> parameters from the server.
> m_pGetSetSocket->WriteMsg(stSocketData.pucData, stSocketData.uiSize);
> // we checked socket error status & it is returning 0, hence socket write is
> passing successfully.
> if(m_pGetSetSocket->Error() == true)
> {
> logMessage(__FILE__,__LINE__,wxT("configClient::getAll().Socket Error while
> sending CONFIG_MSG_GET_ALL_REQ request"));
> return E_RET_ERROR;
> }
> delete []stSocketData.pucData;
> // next we are trying to read data
> {
> pucSockData = new u8[MAX_LEN];
> if (NULL != pucSockData)
> {
> // its failing in below function & it takes 2-3 minutes for reading data &
> later returns wxSOCKET_IOERR
> m_pGetSetSocket->ReadMsg(pucSockData, MAX_LEN);
> if(m_pGetSetSocket->Error() == true)
> {
> m_pLogFile->logMessage(__FILE__,__LINE__,wxT("configClient::getAll().Socket
> Error while reading"));
> delete []pucSockData;
> return E_RET_ERROR;
> }
> }
> }
> }
> }
>
> Also we are not setting any socket flags (wxSOCKET_BLOCK | wxSOCKET_WAITALL)
> before reading or writing on socket.
>
> We observed that WriteMsg() is returning wxSOCKET_NOERROR, but ReadMsg() is
> taking 2-3 minutes time to execute & then returns wxSOCKET_IOERR.
> Kindly tell us if we are doing anything wrong and let us know how to reach
> out the root cause for wxSOCKET_IOERR.
> Please provide any debug pointers for the above case.

Tried to reproduce it in a sample?

Thank you.

>
> Regards,
> Giri
>
> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
>
> To unsubscribe, send email to [hidden email]
> or visit http://groups.google.com/group/wx-users

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Application freezes for 2-3 minutes after updating wxWidgets 3.0 to wxWidgets 3.1

Gunter Königsmann
In reply to this post by saptha.global
>
> Also we are not setting any socket flags (wxSOCKET_BLOCK |
> wxSOCKET_WAITALL) before reading or writing on socket.
>
> We observed that WriteMsg() is returning wxSOCKET_NOERROR, but ReadMsg()
> is taking 2-3 minutes time to execute & then returns wxSOCKET_IOERR.

Does only trying to read if IsData() and IsConnected() both return true
help? And does SetTimeout() reduce the waiting time?

Kind regards,

    Gunter.

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Application freezes for 2-3 minutes after updating wxWidgets 3.0 to wxWidgets 3.1

saptha.global
Hi 
Thanks for your inputs.

before calling Readmsg() function i.e. reading socket data, we are checking below functions as suggested:

 m_pGetSetSocket->IsConnected() : returning TRUE
 m_pGetSetSocket->IsData() : its failing here...

Kindly provide your inputs.

Regards,
Giri

On Tuesday, April 11, 2017 at 1:46:19 AM UTC+5:30, Gunter Königsmann wrote:
>
> Also we are not setting any socket flags (wxSOCKET_BLOCK |
> wxSOCKET_WAITALL) before reading or writing on socket.
>
> We observed that WriteMsg() is returning wxSOCKET_NOERROR, but ReadMsg()
> is taking 2-3 minutes time to execute & then returns wxSOCKET_IOERR.

Does only trying to read if IsData() and IsConnected() both return true
help? And does SetTimeout() reduce the waiting time?

Kind regards,

    Gunter.

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Loading...