apr_send has been locked

2015-02-06 Thread GHui
I code a simple server and client. But the server is locked at apr_socket_send.
 The server apr_socket_send is block.
 Any help will be appreciated.
  
 --GHui

Re: apr_getnameinfo get localhost

2015-02-03 Thread GHui
Thank you. That's did help me.

-GHui

-- Original --
From:  Yann Ylavic;ylavic@gmail.com;
Send time: Tuesday, Feb 3, 2015 5:18 PM
To: GHuiugi...@gmail.com; 
Cc: devdev@apr.apache.org; 
Subject:  Re: apr_getnameinfo get localhost



Hi GHui,

as you can see, apr_getnameinfo() does not give a different answer
than the system's one.

Address 172.18.4.2 really resolves to localhost in your environment,
whereas 172.18.4.3 is unknow.
You will have to take a look at your DNS (172.18.0.1) configuration.

Regards,
Yann.


On Tue, Feb 3, 2015 at 6:57 AM, GHui ugi...@gmail.com wrote:
 The following is the log when I execute the command.
 ---
  [root@myHOST ~]# nslookup 172.18.4.2
 Server: 172.18.0.1
 Address:172.18.0.1#53

 Non-authoritative answer:
 2.4.18.172.in-addr.arpa name = localhost.

 Authoritative answers can be found from:

 [root@myHOST ~]# nslookup 172.18.4.3
 Server: 172.18.0.1
 Address:172.18.0.1#53

 ** server can't find 3.4.18.172.in-addr.arpa.: NXDOMAIN

 [root@myHOST ~]# ./hostname 172.18.4.2
IP: 172.18.4.2
HOST: localhost
 [root@myHOST ~]# ./hostname 172.18.4.3
IP: 172.18.4.3
HOST: (null)
  [root@myHOST ~]#

 -- Original --
 From:  Yann Ylavic;ylavic@gmail.com;
 Send time: Monday, Feb 2, 2015 5:03 PM
 To: aprdev@apr.apache.org;
 Subject:  Re: apr_getnameinfo get localhost

 Oups, meant to send my reply to the list...

 On Mon, Feb 2, 2015 at 10:01 AM, Yann Ylavic ylavic@gmail.com wrote:
 What does nslookup (or alike) output for these IPs ?

 On Mon, Feb 2, 2015 at 9:41 AM, GHui ugi...@gmail.com wrote:

 There is some error, so I resend again.

 [root@myHOST ~]# ./hostname 172.18.4.49
IP: 172.18.4.49
HOST: (null)
 [root@myHOST ~]# ./hostname 172.18.4.48
IP: 172.18.4.48
HOST: localhost

 Note: The 172.18.4.49 and 172.18.4.48 are not in /etc/hosts.



 -- Original --
 From:  Joshua Marantz;jmara...@google.com;
 Send time: Sunday, Feb 1, 2015 10:56 PM
 To: GHuiugi...@gmail.com;
 Cc: Jeff Trawicktraw...@gmail.com; devdev@apr.apache.org;
 Subject:  Re: apr_getnameinfo get localhost

 I am not an expert in this apr routine, but I think it might help if you
 gave the command-line argument you used when testing your program.

 -Josh

 On Sun, Feb 1, 2015 at 7:17 AM, GHui ugi...@gmail.com wrote:


 Is there any good news? Any help will be appreciated.

 --GHui


 -- Original --
 From:  ugiwgh;ugi...@gmail.com;
 Send time: Thursday, Jan 29, 2015 9:03 AM
 To: Jeff Trawicktraw...@gmail.com;
 Cc: devdev@apr.apache.org;
 Subject:  Re: apr_getnameinfo get localhost


 From:  Jeff Trawick;traw...@gmail.com; Send time: Wednesday, Jan 28,
 2015 10:26 PM
 On Wed, Jan 28, 2015 at 2:26 AM, GHui ugi...@gmail.com wrote:

 I used the function  apr_getnameinfo to get remote hostname. But it
 return localhost.
 I don't know why this happend.
 Any help will be appreciated.
 --GHui


 Please show code, such as where the second parameter to
 apr_getnameinfo()
 came from.
 --
 Born in Roswell... married an alien...
 http://emptyhammock.com/


 The code is following.
 -
 int main(int argc,char **argv)
 {
   if(2!=argc)
   {
 printf(Usage: %s ip\n,argv[0]);
 return 1;
   }
   char *remoteip=argv[1];
   printf(IP: %s\n,remoteip);
   apr_initialize();
   apr_pool_t *mp;
   apr_pool_create(mp,NULL);
   apr_sockaddr_t *sa;
   apr_sockaddr_info_get(sa,remoteip,APR_INET,10089,0,mp);
   char *hostname=NULL;
   apr_getnameinfo(hostname,sa,0);
   printf(HOST: %s\n,hostname);

   apr_terminate();
   return 0;
 }
 



apr_getnameinfo get localhost

2015-01-27 Thread GHui
I used the function  apr_getnameinfo to get remote hostname. But it return 
localhost. 
I don't know why this happend. 
Any help will be appreciated.

--GHui

Re: apr_getnameinfo get localhost

2015-01-28 Thread GHui
From:  Jeff Trawick;traw...@gmail.com; Send time: Wednesday, Jan 28, 2015 
10:26 PM

On Wed, Jan 28, 2015 at 2:26 AM, GHui ugi...@gmail.com wrote:
I used the function  apr_getnameinfo to get remote hostname. But it return 
localhost. 
I don't know why this happend. 
Any help will be appreciated.
--GHui

Please show code, such as where the second parameter to apr_getnameinfo() came 
from.
-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

The code is following.
-
int main(int argc,char **argv)
{
  if(2!=argc)
  {
printf(Usage: %s ip\n,argv[0]);
return 1;
  }
  char *remoteip=argv[1];
  printf(IP: %s\n,remoteip);
  apr_initialize();
  apr_pool_t *mp;
  apr_pool_create(mp,NULL);
  apr_sockaddr_t *sa;
  apr_sockaddr_info_get(sa,remoteip,APR_INET,10089,0,mp);
  char *hostname=NULL;
  apr_getnameinfo(hostname,sa,0);
  printf(HOST: %s\n,hostname);

  apr_terminate();
  return 0;
}


Re: apr_getnameinfo get localhost

2015-02-01 Thread GHui
Is there any good news? Any help will be appreciated.
  
 --GHui
  

 

 -- Original --
  From:  ugiwgh;ugi...@gmail.com;
 Send time: Thursday, Jan 29, 2015 9:03 AM
 To: Jeff Trawicktraw...@gmail.com; 
 Cc: devdev@apr.apache.org; 
 Subject:  Re: apr_getnameinfo get localhost

 


   From:  Jeff Trawick;traw...@gmail.com; Send time: Wednesday, Jan 28, 
2015 10:26 PM

   On Wed, Jan 28, 2015 at 2:26 AM, GHui ugi...@gmail.com wrote:
 I used the function  apr_getnameinfo to get remote hostname. But it return 
localhost. 
I don't know why this happend. 
Any help will be appreciated.
--GHui

Please show code, such as where the second parameter to apr_getnameinfo() came 
from.
-- 
  Born in Roswell... married an alien...
http://emptyhammock.com/ 

The code is following.
-
int main(int argc,char **argv)
{
  if(2!=argc)
  {
printf(Usage: %s ip\n,argv[0]);
return 1;
  }
  char *remoteip=argv[1];
  printf(IP: %s\n,remoteip);
  apr_initialize();
  apr_pool_t *mp;
  apr_pool_create(mp,NULL);
  apr_sockaddr_t *sa;
  apr_sockaddr_info_get(sa,remoteip,APR_INET,10089,0,mp);
  char *hostname=NULL;
  apr_getnameinfo(hostname,sa,0);
  printf(HOST: %s\n,hostname);

  apr_terminate();
  return 0;
}


Re: apr_getnameinfo get localhost

2015-02-02 Thread GHui
There is some error, so I resend again.

[root@myHOST ~]# ./hostname 172.18.4.49
IP: 172.18.4.49
HOST: (null)
[root@myHOST ~]# ./hostname 172.18.4.48
IP: 172.18.4.48
HOST: localhost

Note: The 172.18.4.49 and 172.18.4.48 are not in /etc/hosts.

 




-- Original --
From:  Joshua Marantz;jmara...@google.com;
Send time: Sunday, Feb 1, 2015 10:56 PM
To: GHuiugi...@gmail.com; 
Cc: Jeff Trawicktraw...@gmail.com; devdev@apr.apache.org; 
Subject:  Re: apr_getnameinfo get localhost



I am not an expert in this apr routine, but I think it might help if you gave 
the command-line argument you used when testing your program.

-Josh



On Sun, Feb 1, 2015 at 7:17 AM, GHui ugi...@gmail.com wrote:
 
 Is there any good news? Any help will be appreciated.
  
 --GHui
  

 

 -- Original --
  From:  ugiwgh;ugi...@gmail.com;
 Send time: Thursday, Jan 29, 2015 9:03 AM
 To: Jeff Trawicktraw...@gmail.com; 
 Cc: devdev@apr.apache.org; 
 Subject:  Re: apr_getnameinfo get localhost

 


   From:  Jeff Trawick;traw...@gmail.com; Send time: Wednesday, Jan 28, 
2015 10:26 PM

   On Wed, Jan 28, 2015 at 2:26 AM, GHui ugi...@gmail.com wrote:
 I used the function  apr_getnameinfo to get remote hostname. But it return 
localhost. 
I don't know why this happend. 
Any help will be appreciated.
--GHui

Please show code, such as where the second parameter to apr_getnameinfo() came 
from.
-- 
  Born in Roswell... married an alien...
http://emptyhammock.com/ 

The code is following.
-
int main(int argc,char **argv)
{
  if(2!=argc)
  {
printf(Usage: %s ip\n,argv[0]);
return 1;
  }
  char *remoteip=argv[1];
  printf(IP: %s\n,remoteip);
  apr_initialize();
  apr_pool_t *mp;
  apr_pool_create(mp,NULL);
  apr_sockaddr_t *sa;
  apr_sockaddr_info_get(sa,remoteip,APR_INET,10089,0,mp);
  char *hostname=NULL;
  apr_getnameinfo(hostname,sa,0);
  printf(HOST: %s\n,hostname);

  apr_terminate();
  return 0;
}


apr_socket_create in short connect

2015-04-15 Thread GHui
I use apr_socket_create in a short connect. 
And it takes up more and more memory as the program runs.
Any help will be appreciated.
--GHui

How to release apr_socket_accept memory pool

2015-08-19 Thread GHui
I code a server with apr_socket_accept and apr_pollset_poll. But 
apr_socket_accept and apr_pollset_add take up the memory pool. I cann't release 
or clear memory pool. So it take up more and more memory. 
Any help will be appreciated. -GHui

Re: How to release apr_socket_accept memory pool

2015-08-19 Thread GHui
On  Thu, 2015-08-20 at 6:30 AM , Nick wrote:


On Wed, 2015-08-19 at 19:02 +0800, GHui wrote:

 I code a server with apr_socket_accept and apr_pollset_poll. But
 apr_socket_accept and apr_pollset_add take up the memory pool. I
 cann't release or clear memory pool. So it take up more and more
 memory. 

Can you not solve that problem by using a subpool for those
functions?  That way you can give the subpool the lifetime
you need it to have, regardless of other resources that
prevent you clearing the parent pool.

 


If do this, every connect need create a subpool, and clear mpool when close the 
connect.

apr_socket* server takes up more and more RES as it runs.

2015-07-29 Thread GHui
I use apr_pollset_poll and apr_socket_accept to accept short client connect. 
Only one client connects it every second. The RES increase from 3068 to 33m 
when it runs for about 12 hours, and VIRT is 2106m when the program starts. If 
there is no client connect, the RES doesn't rise.

Any help will be appreciated. GHui