[Xorp-hackers] Socket error

illidan illidan at lineway.net
Mon Feb 16 14:08:31 PST 2009


Pavlin Radoslavov wrote:
> illidan <illidan at lineway.net> wrote:
>
>  
>> Hello,
>>
>> I was trying to open a socket using socket4 library.
>> I used function send_tcp_open_and_bind :
>>
>> create_socket.cc :
>> void SocketServer::get_create_socket() {
>>     XorpCallback2<void, const XrlError&, const string*>::RefPtr cb;
>>     IPv4 localIP("10.10.10.10");
>>     int localPort = 100;
>>     cb = callback(this,&SocketServer::get_socket_id);
>>     
>> send_tcp_open_and_bind("fea",_rtr.instance_name(),localIP,localPort,cb);
>> }
>> void SocketServer::get_socket_id(const XrlError& e,const string* id) {
>>     if(e==XrlCmdError::OKAY()) {
>>         fprintf(stderr,"I receive the response : %s\n",id->c_str());
>>         _socket_id = id->c_str();
>>         listen();
>>         return;
>>     }
>> }
>>
>> When I run this program, I receive correctly the socket_id, but I get 
>> an error in rtrmgr process :
>>
>> "[ 2009/02/16 13:11:01 WARNING xorp_rtrmgr:32679 XrlFinderTarget +721 
>> ../xrl/targets/finder_base.cc 
>> handle_finder_event_notifier_0_1_register_instance_event_interest ] 
>> Handling method for 
>> finder_event_notifier/0.1/register_instance_event_interest failed: 
>> XrlCmdError 102 Command failed failed to add watch
>> [ 2009/02/16 13:11:01 ERROR xorp_fea:32681 FEA +128 xrl_fea_io.cc 
>> register_instance_event_interest_cb ] Failed to register event 
>> interest in instance create_socket: 102 Command failed failed to add 
>> watch"
>>
>> What could be the problem? Did I do something wrong??
>>     
>
> Was your create_socket program still running, and in READY state?
>
> You can verify both by using the following XRL by hand (you need to
> replace "fea" with the target name of your module):
> libxipc/call_xrl finder://fea/common/0.1/get_status
>
> If everything is normal you should see the following output:
> status:u32=3&reason:txt=
>   
In fact, create_socket was not a process but a tool.
I did it like bgp/tools/xorpsh_print_peers.
I have my own process (call consensus), but I don't really know  when  
to start the tcp socket. So I did this tool to try to open a socket 
(like a tester).

I just try to create my socket in consensus

XrlCmdError
ConsensusTarget::consensus_0_1_add_ip(const string& ip) {
   _ip = ip;
   // I try to create my socket
   XLOG_INFO("%s\n", "Starting up CONSENSUS");
   SocketServer socket(_rtr,_eventloop);
   socket.get_create_socket();
   return XrlCmdError::OKAY();
}

I run rtrmgr with the config file "static.boot and I add a consensus IP 
with CLI. When I add the IP and "commit"  it makes an error and kill my 
process :

Starting consensus protocol
[ 2009/02/16 23:00:34 TRACE xorp_rtrmgr RTRMGR ] Validating with XRL: 
 >finder://consensus/common/0.1/get_status<
[ 2009/02/16 23:00:34 TRACE xorp_rtrmgr RTRMGR ] Expanding xrl 
$(consensus.targetname)/consensus/0.1/add_ip?ip:txt=$(@)
[ 2009/02/16 23:00:34 TRACE xorp_rtrmgr RTRMGR ] Executing XRL: 
 >finder://consensus/consensus/0.1/add_ip?ip:txt=10.10.10.1<
[ 2009/02/16 23:00:34 INFO xorp_consensus CONSENSUS ] Starting up CONSENSUS
[ 2009/02/16 23:00:34 INFO xorp_consensus CONSENSUS ] Starting up CONSENSUS
[ 2009/02/16 23:00:34 TRACE xorp_rtrmgr RTRMGR ] Validating with XRL: 
 >finder://consensus/common/0.1/get_status<
[ 2009/02/16 23:00:34  INFO xorp_rtrmgr:13806 RTRMGR +2233 task.cc 
run_task ] No more tasks to run
[ 2009/02/16 23:00:34 TRACE xorp_rtrmgr RTRMGR ] 
apply_config_change_done: status: 1 response:  target: 
xorpsh-13811-my_computer
[ 2009/02/16 23:00:34  ERROR xorp_rtrmgr:13806 RTRMGR +754 
module_manager.cc done_cb ] Command 
"path_to_xorp/consensus/xorp_consensus": terminated with signal 11.
[ 2009/02/16 23:00:34  INFO xorp_rtrmgr:13806 RTRMGR +299 
module_manager.cc module_exited ] Module abnormally killed: consensus

And apparently the process has not been started :
#./call_xrl finder://consensus/common/0.1/get_status
[ 2009/02/16 23:03:05  ERROR call_xrl:13896 XRL +57 call_xrl.cc 
response_handler ] Failed.  Reason: 201 Resolve failed 
("finder://consensus/common/0.1/get_status")
[ 2009/02/16 23:03:06 WARNING call_xrl XRL ] request: 
finder://consensus/common/0.1/get_status resolve failed
[ 2009/02/16 23:03:06 WARNING call_xrl XRL ] request: 
finder://consensus/common/0.1/get_status failed after 0 retries
[ 2009/02/16 23:03:06  ERROR call_xrl:13896 XRL +231 call_xrl.cc 
input_cmds ] No callback: finder://consensus/common/0.1/get_status
Stopping.

What did I do wrong??

Thanks for your help!

Michael
> FYI, the values for the static codes are listed in
> libxorp/status_codes.h and the value for PROC_READY is 3.
>
> Regards,
> Pavlin
>
>  
>> Thanks
>>
>> Michael
>>
>> _______________________________________________
>> Xorp-hackers mailing list
>> Xorp-hackers at icir.org
>> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers
>>     




More information about the Xorp-hackers mailing list