“已经侦听”当调用RPC调用时 [英] "Already listening" when invoking an RPC call

查看:370
本文介绍了“已经侦听”当调用RPC调用时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Microsoft RPC进行进程间通信。我有一个接口,它接受一个字节管道作为in参数(IDL描述):

I use Microsoft RPC for interprocess communications. I have an interface with a set of methods accepting a byte pipe as an "in" parameter (IDL description):

[
    uuid(ActualGuidHere), 
    version(1.0), 
    pointer_default(unique)
]

interface IMyInterface
{
    //other irrelevant methods here
    error_status_t rpcDoAction( [in] pipe byte params );
    //more irrelevant methods here
}

我在客户端通过由MIDL生成的客户端存根调用这样的方法,并委托给NdrClientCall2(),它不会到达服务器端,但是NdrClientCall2()返回RPC_S_ALREADY_LISTENING(服务器已经在监听),这是真的令人困惑。

every once in a while when I invoke such methods on a client side through a client stub generated by MIDL and delegated to NdrClientCall2(), it doesn't reach the server side, but NdrClientCall2() returns RPC_S_ALREADY_LISTENING ("The server is already listening") which is really confusing.

我在传输期间将记录添加到用于推/拉操作的函数中 - 对于以这种方式失败的任何调用,都不会调用它们。

I added logging into the functions used for push/pull operations during transfer - they are not ever called for any of the calls that fail this way. This implies that the transmission is not even started.

在调用没有管道作为参数的方法时,我从来没有遇到过这样的行为。

I never encounter such behaviour when calling methods that don't have pipes as parameters.

这是什么原因和解决方法?

What might be the reason and the workaround?

推荐答案

t认为有一个巨大的用户社区为直接使用的RPC API - 但我的猜测是,为了设置管道参数,RPC内部调用 RpcServerListen 。只有一次对该API的调用才能够阻止。

The documentation seems quite minimal - I don't think there is a huge user community for direct use of the RPC APIs - but my guess is that in order to set up the pipe parameter, it is necessary for RPC to internally call RpcServerListen. Only one call to that API is able to block at a time.

事实上,您只是偶尔发现问题,这表明它与时间有关,因此可能你在不同的线程上进行两个这样的调用,有时它们将同时发生?

The fact that you see the problem only occasionally suggests that it is time-related, so is it possible that you are making two such calls on different threads and sometimes they will be simultaneous?

在RPC库的实现中有一个与时间相关的错误,必须通过重试呼叫解决它(这在任何情况下可能是一个有效的解决方法)。

Either that or there is a timing-related bug in the RPC library's implementation and you will have to work around it by retrying the call (that may be an effective workaround in any case).

这篇关于“已经侦听”当调用RPC调用时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆