You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I can't do CallRPC to remote erlang node more than one time.
The second CallRPC is stuck due to this line in the code:
sp.callbackWaitReply <- &ref
To Reproduce
Steps to reproduce the behavior:
Probably, I'm doing something wrong, but there is no documentation for this case.
My code:
func CreateNewNode() *ErlangHelper {
eh := new(ErlangHelper)
opts := node2.Options{}
// Initialize new node with given name, cookie, listening port range and epmd port
node, err := ergo.StartNode(configuration.Cfg.SelfNodeFullName, configuration.Cfg.Cookie, opts)
if err != nil {
panic(err)
}
// Initialize new instance of demoGenServ structure which implements Process behaviour
_, _ = node.Spawn("exporter", gen.ProcessOptions{}, eh)
return eh
}
type ErlangHelper struct {
gen.Server
ErlangProcess
}
type ErlangProcess struct {
*gen.ServerProcess
}
func (eh *ErlangHelper) Init(process *gen.ServerProcess, args ...etf.Term) error {
demo := &ErlangProcess{
ServerProcess: process,
}
// do not inherit parent State
demo.State = nil
//if err := process.Behavior().(DemoBehavior).InitDemo(demo, args...); err != nil {
// return err
//}
process.State = demo
eh.ServerProcess = process
return nil
}
func (eh *ErlangHelper) HandleInfo(process *gen.ServerProcess, message etf.Term) gen.ServerStatus {
return gen.ServerStatusOK
}
func (eh *ErlangHelper) CallRPC(node string, module string, f string, args ...etf.Term) etf.Term {
log.Debugf("Calling RPC to %v, module %v, func %v, args %v", node, module, f, args)
res, err := eh.ServerProcess.CallRPCWithTimeout(1, node, module, f, args...)
if err != nil {
panic(err)
}
return res
}
When I do CallRPC first time, it works, I receive information from an erlang (23) node.
But the second one is stuck, because no one reads sp.callbackWaitReply channel in the second call (I don't know why).
The only one thins that I need is send RPCs to another erlang nodes.
What I've missed? Thanks.
Expected behavior
RPC calls work
Screenshots
Environment (please complete the following information):
Arch: aarch64
OS: Mac
Framework Version 2.2.0
10
The text was updated successfully, but these errors were encountered:
Noksa
changed the title
Is there a chance to get CallRPC working to remote node?
Second CallRPC method is stuck when it is called against remote erlang node
Dec 1, 2022
Describe the bug
I can't do
CallRPC
to remote erlang node more than one time.The second
CallRPC
is stuck due to this line in the code:To Reproduce
Steps to reproduce the behavior:
Probably, I'm doing something wrong, but there is no documentation for this case.
My code:
When I do
CallRPC
first time, it works, I receive information from an erlang (23) node.But the second one is stuck, because no one reads
sp.callbackWaitReply
channel in the second call (I don't know why).The only one thins that I need is send RPCs to another erlang nodes.
What I've missed? Thanks.
Expected behavior
RPC calls work
Screenshots
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: