Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UdpLink crashes on receiving a DatagramReq in UnetStack3 #17

Closed
shortstheory opened this issue Feb 25, 2019 · 2 comments
Closed

UdpLink crashes on receiving a DatagramReq in UnetStack3 #17

shortstheory opened this issue Feb 25, 2019 · 2 comments
Assignees

Comments

@shortstheory
Copy link

I am using a simple UnetAgent:

class DummyAgent extends UnetAgent {
    void startup() {
      
        def link = agentForService Services.LINK
        subscribe link
    }
    Message processRequest(Message msg) {
        return msg
    }

    void processMessage(Message msg) {
      println "Received Msg"
    }
}

My simulation script is as follows:

platform = RealTimePlatform

simulate  {
  node '1', address: 1, location: [0, 0, 0], shell: true, stack: { container ->
    container.add 'da', new DummyAgent()
    container.add 'link', new UdpLink()
    container.add 'router', new org.arl.unet.net.Router()
  }
  node '2', address: 2, location: [200.m, 0, 0], shell: 5001, stack: { container ->
    container.add 'da', new DummyAgent()
    container.add 'link', new UdpLink()
    container.add 'router', new Router()
  }
  node '3', address: 3, location: [400.m, 0, 0], shell: 5002, stack: { container ->
    container.add 'da', new DummyAgent()
    container.add 'link', new UdpLink()
    container.add 'router', new Router()
  }
}

On running link << new org.arl.unet.DatagramReq(to: 3, reliability: true) on Node 1, I get the following exception:

Exception in thread "link [monitor]" org.arl.fjage.FjageError: request() should only be called from agent thread 44, but called from 47
	at org.arl.fjage.Agent.request(Agent.java:528)
	at org.arl.unet.NodeAddressCache.update(NodeAddressCache.java:79)
	at org.arl.unet.NodeAddressCache.getAddress(NodeAddressCache.java:42)
	at org.arl.unet.link.UdpLink.receiveDatagram(UdpLink.java:353)
	at org.arl.unet.link.UdpLink.access$700(UdpLink.java:17)
	at org.arl.unet.link.UdpLink$RxMonitor.run(UdpLink.java:449)

Surprisingly, I still get the DDN notification on the shell despite the error. However, I get no Datagram notifications in my DtnLink simulations.

@shortstheory
Copy link
Author

This also sometimes leads to a NullPointerException in UdpLink which causes my DtnLink to crash. I have not yet figured out how to reproduce this NPE.

@mchitre mchitre self-assigned this Mar 7, 2019
@mchitre mchitre added the bug label Mar 7, 2019
@mchitre mchitre added the invalid label Aug 7, 2019
@mchitre
Copy link
Member

mchitre commented Aug 7, 2019

Tested on latest UnetStack3 beta and seems OK. I guess it got fixed along the way :-)

@mchitre mchitre closed this as completed Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants