开发者

How to handle multiple connections Abyss Server in XMLRPC - C++

开发者 https://www.devze.com 2023-03-19 22:16 出处:网络
The scenario is the next one: I have a XMLRPC-C++ applcation, listening for connections on PORT=8081. It implements an Abyss Server, using the xmlrpc-c library as next:

The scenario is the next one: I have a XMLRPC-C++ applcation, listening for connections on PORT=8081. It implements an Abyss Server, using the xmlrpc-c library as next:

xmlrpc_c::serverAbyss myAbyssServer(
        myRegistry, //handler of methods
        port,       //8081        
        "xmlrpc_log"   
        );

when I create multiple connections from a script calling many XMLRPC methods, it works fine. the script is something like this: Script1: rpc.method1(parameters); rpc.method2(parameters); rpc.methodN(parameters);

If I check connections in the server with netstat and the xmlrpc_log when this script is executing, the output is something like XMLRPC-SERVER:8081 XMLRPC-CLIENT:SOME TIME_WAIT. Though the XMLRPC_CLIENT IP is the same, fore very rpc.method call it creates a new connections.

The problem appears when I execute two of this scripts in the开发者_运维技巧 same client. It means, the call rpc.methodM(parameters) in one script, is executed simultaneously with the rpc.methodN(parameters) in the other script, in the same client. This produces a crash in the server, and XMLRPC-SERVER stay down till a restart the process.

I read the Abyss help, and runOnce() method will not help. By default, calling the constructor as above, the MaxConnections by default is 30, and timeout 15 segs, for the Abyss server.

Is there some configuration to avoid this crash? I will need to support more than one client at the same time and many connections simultaneously.

Thanks for any help related to this,

Sincerely, Luchux.


Well. apparently the server is handling the multiple connections and supporting multithreading with pthreads. The problem should be in my code executed by the RPC calls, I guess because a reentrant/thread safety problem.

  • After some break working with other project, I came back to this code and the problem was in a Natural Language library, with some not re-entrant methods. They solved it, I solved it :) -
0

精彩评论

暂无评论...
验证码 换一张
取 消